MyBB Community Forums

Full Version: MyAlerts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
That's what Plugins Alerts Pack contains. It features two extra "core" alerts, one for threads subscriptions and one for forum subscriptions, meaning that every people who's subscribed to a specific thread will receive an alert whenever someone replies.

That snippet adds a simple, but effective way to alert only once the user.

Here's the same example I wrote on GitHub: right now if you are a) mentioned, b) quoted in a post which c) is a reply to a thread you've made and d) you are subscribed to that thread too, you get 4 alerts related to the same thread (assuming you are using MentionMe and Plugins Alerts Pack). This situation happens in rare cases but in more common scenarios you get at least 2 alerts for the same event.

That's exactly what that code prevents. If you should get 2 or more alerts for the same thread, it will deliver only one (the first one). It should reduce the amount of queries and the number of alerts in the database without using any extra query.
@shade, do you mean we should add this code to the inc/plugins/MyAlerts/Alerts.class.php. ?

I will look Pluggin Alert pack. I guess i have installed it.I think It only works when a users is subscribed my email notification, and does not work by no email notification. I will see to it and will let you know. I guess, it would be a great feature to receive alerts without email notification. Saving users email filling with replies only. I mean it would be great it those pluggins should work in no email notification also. Let the user decide which they need.
I've tested it multiple time and it works, but Euan is checking it out before officially adding it in the core. I'd wait for his approval to update your Alerts.class.php file.

Anyway, for no email notification you should edit the core accordingly: http://community.mybb.com/thread-138270-...#pid997758
(2013-03-29, 12:11 AM)Shade Wrote: [ -> ]I think that the Internal Server Error you're getting is fired due to the server ending the script because of its execution taking too long to load. This might be the same for all Forums with an high number of users.

The script Wildcard provided, although it is correct, runs one query per setting per user. Simplified example: if you have 9447 users and 5 alert types (why you're not using MentionMe, Plugins Alerts Pack or Moderation Alerts Pack? bad boy Big Grin), the script will run 1*5*9447 = 47235 queries. This is a really high value isn't it? Big Grin

The solution is quite easy: rather than querying the database in the foreach loop, just build an array of data and then build a single query with insert_query_multiple() function. Result: 2 SELECT queries, 1 INSERT query, fast edits.

I've edited Wildcard's script, just upload and run it once by opening the file from your browser.

I haven't tested the script, but it should work.

Update 12/05/2013

The script has been updated with noticeable optimizations. Thanks to Omar G. for pointing them out ( http://community.mybb.com/thread-127444-...#pid987880 )

When I access this file tick that has been there even be lost in all users? what should I do?
is there a way to force the user update their my alerts ??
I will be merging Shade's suggested modification in tonight now that I'm off work. I'll also be including his force alerts script in the core.
(2013-07-02, 04:32 PM)Euan T Wrote: [ -> ]I will be merging Shade's suggested modification in tonight now that I'm off work. I'll also be including his force alerts script in the core.

Try to include, that everyone who subscribe a thread get alert notification and let user decide to receive email or no email notification. (shade suggested me some modification for that, but it would be great if it would come by default )
It will not be coming until it is possible without a core edit. MyAlerts tries to work without modifying the MyBB core as much as possible and subscription alerts are too messy without alterations.
Right, I just pushed version 1.05. Not any major changes, more of a slight cleanup and merging Shade's suggested change. To download 1.05, please click here: https://github.com/euantorano/MyAlerts/archive/1.05.zip

@Leefish: I looked into the registration problem and it works perfectly fine locally. Odd that it shouldn't work for your site. How it works is:

- User registers
- All alert settings for that user are automatically enabled
Hmm, I have seen that others have this not working as well (new users with no alerts enabled). I have a customised register page, and I have a plugin that runs on registration:

$plugins->add_hook('member_do_register_end', 'redirectafterregistration_do');

function redirectafterregistration_do()
{
	global $lang;

	$lang->load("registeredonreg");

	redirect("aboutleefish.php", $lang->redirecting_onreg);
	//redirect('aboutleefish.php');
	return;
}

So are you saying on a default install with no plugins a new user gets the alerts?