public function alert_comment($user, $commentor, $cid) { global $mybb, $db, $settings, $cache, $plugins; /* if the admin choosed alertbar, or "MyAlerts or Alert bar" but MyAlerts don't exist, notify the user */ if ($settings["mpcommentsnotification"] == "alertbar" || $settings["mpcommentsnotification"] == "myalertsoralertbar" && !MyProfileUtils::myalerts_exists()) { $update_array = array("mpnewcomments" => $user["mpnewcomments"] + 1); $db->update_query("users", $update_array, "uid='{$user['uid']}'", "1"); $user["mpnewcomments"]++; } elseif (($settings["mpcommentsnotification"] == "myalerts" || $settings["mpcommentsnotification"] == "myalertsoralertbar") && MyProfileUtils::myalerts_exists()) { $myalerts_plugins = $cache->read('mybbstuff_myalerts_alert_types'); if (isset($myalerts_plugins[MyProfileCommentsMyAlertsFormatter::alert_type_code()]) && $myalerts_plugins[MyProfileCommentsMyAlertsFormatter::alert_type_code()]['enabled'] == 1) { $alertType = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache)->getByCode(MyProfileCommentsMyAlertsFormatter::alert_type_code()); $alert = MybbStuff_MyAlerts_Entity_Alert::make($user["uid"], $alertType, null, array("cid" => $cid)); MybbStuff_MyAlerts_AlertManager::createInstance($mybb, $db, $cache, $plugins, $alertType)->addAlert($alert); } } }