MyBB Community Forums

Full Version: MyAlerts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For users wanting to use Shade's script to force alerts for lots of users (10k+ really), here's a modified version that runs 1000 users at a time then outputs a link to the next page. I have not tested it, but it should work.

<?php

define('IN_MYBB', 1);
require_once dirname(__FILE__)."/inc/init.php";

global $db;

$page = 0;
if (isset($mybb->input['page'])) {
	$page = (int) $mybb->input['page'];
}

if ($page < 1) {
	$page = 0;
}

if ($page != 0) {
	$db->query("DELETE FROM " . TABLE_PREFIX . "alert_setting_values");
}

$alert_type_query = $db->simple_select('alert_settings');

$alert_type_count = 0;

if ($db->num_rows($alert_type_query) > 0) {
	$alert_type_set = array();

	while ($alert_id = $db->fetch_field($alert_type_query, 'id')) {
		$alert_type_set[] = $alert_id;
		++$alert_type_count;
	}
} else {
	echo "MyAlerts not installed! Exiting...";
	die;
}

$query = $db->simple_select('users', 'uid', '', array('order_by' => 'uid', 'order_dir' => 'ASC', 'limit_start' => $page * 1000, 'limit' => 1000));

$user_count = 0;

if ($db->num_rows($query) > 0) {
	$settings = array();
	while ($user = $db->fetch_field($query, 'uid')) {
		++$user_count;
		$alert_type_user_set = array();

		foreach ($alert_type_set as $id) {
			$settings[] = array(
				"user_id" => $user,
				"setting_id" => $id,
				"value" => 1
			);
		}
	}

	$db->insert_query_multiple('alert_setting_values', $settings);

	$nextpage = $page + 1;

	//header("Location: force_enable_alerts.php?page={$nextpage}") ;
	echo <<<EOT
	<a href="force_enable_alerts.php?page=$nextpage">Click to process next 1000 users.</a>
EOT;
}
thanks for support
That's what I wanted to do to prevent too long MySQL queries that would fail on certain servers. Well done Euan, you've saved me a job Big Grin
it is work with myalerts?? http://www.mybbstuff.com/thread-14.html
SimpleLikes NEEDS MyAlerts to work correctly really Smile
any fix for like button see image, use waterfox browser



also i test like system they dont show on index page like alerts when someone like post
Have you enabled like alerts? To fix the button, you need to modify your CSS to add rules for the .bn_like class.
its enabled, which css and where which template??
ACP > Alerts Settings > Enable alerts for post likes

For the css, just add the class to your global.css and style it.
Quote:ACP > Alerts Settings > Enable alerts for post likes

its enabled on default, but still not works

Quote:For the css, just add the class to your global.css and style it.


can you provide the code??

like unlike button