MyBB Community Forums

Full Version: MyAlerts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
thanks that sort of worked, it never change the link colur on multi quote.
(2013-04-29, 08:27 PM)echofloripa Wrote: [ -> ]
(2013-04-27, 03:04 PM)Euan T Wrote: [ -> ]The problem is with how the plugin's architecture is built. It would be possible, but such a major change isn't planned just now.

There could be a default list, which is the one already used. Other alerts could use a different chosen list. The problem is that the replies and thanked alerts would end up blurring the moderators alerts (still to be built).

thanks for your attention

Another suggestion is to create a "hello word alert" sort of plugin, so easy the creation of alerts. I tried get other alert extension plugin, but they are overly complicated. That would make it easier to start new extentions to myalerts.

thanks for your great work!

Could work, but it's still a fair bit of work.

As for the hello world plugin, it's a nice idea. I need to update the Wiki too.

(2013-04-29, 08:44 PM)adbrad Wrote: [ -> ]thanks that sort of worked, it never change the link colur on multi quote.

Yes, you'd need to change the class for the multiquote too Smile
hi thanks i found out the a:visted class was overriding it, so had to sort that out.
If anyone's interested in modifying the popup menu's animations, here's a catchy "tooltip" effect which elegantly moves the popup from high to bottom with fading animations. Replace your myalerts.js file with:

jQuery.noConflict();

jQuery(document).ready(function($)
{
	$('body').on({
		click: function(event)
		{
			event.preventDefault();
			var popup_id = $(this).attr('id') + '_popup';
			
			var state = $(this).data('state');
			
			switch(state) {
				case 1:
				case undefined:
					$('#' + popup_id).attr("top", $(this).height() + 'px').animate({opacity: 'toggle', marginTop: "+=15px"}, 400, 'easeInOutQuint', function() {
						var toMarkRead = new Array;
						$('[id^="alert_row_popup_"]').each(function() {
							toMarkRead.push($(this).attr('id').substr(16));
						});
		
						$.get('xmlhttp.php?action=markRead', {
							my_post_key: my_post_key,
							toMarkRead: toMarkRead
						}, function(data) {
		
						});
					});
					$(this).data("state", 2);
					break;
				case 2:
					$('#' + popup_id).animate({opacity: 'toggle', marginTop: "-=15px"}, 400, 'easeInOutQuint');
					$(this).data("state", 1);
					break;
			}
			return false;
		}
	}, '.myalerts_popup_hook');

	$('.myalerts_popup *').on('click', function(event) {
		event.stopPropagation();
	});

	$("body:not('.myalerts_popup:visible')").on('click', function() {
   		$('.myalerts_popup:visible').animate({opacity: 'toggle', marginTop: "-=15px"}, 400, 'easeInOutQuint', function() {
			$(".myalerts_popup_hook").data('state', 1);
		});
	});

	$('#getUnreadAlerts').on('click', function(event) {
		event.preventDefault();
		$.get('xmlhttp.php?action=getNewAlerts', function(data) {
			$('#latestAlertsListing').prepend(data);
		});
	});

	$('.deleteAlertButton').on('click', function(event) {
		event.preventDefault();
		var deleteButton = $(this);

		$.getJSON(deleteButton.attr('href'), {accessMethod: 'js'}, function(data) {
			if (data['success'])
			{
				deleteButton.parents('tr').get(0).remove();
				if (data['template'])
				{
					$('#latestAlertsListing').html(data['template']);
				}
			}
			else
			{
				alert(data['error']);
			}
		});
	});

	if (typeof myalerts_autorefresh !== 'undefined' && myalerts_autorefresh > 0)
	{
		window.setInterval(function() {
			$.get('xmlhttp.php?action=getNewAlerts', function(data) {
				$('#latestAlertsListing').prepend(data);
			});
		}, myalerts_autorefresh * 1000);
	}

	if (typeof unreadAlerts !== 'undefined' && unreadAlerts > 0)
	{
		document.title = document.title + ' (' + unreadAlerts + ')';
	}

});
Hi Euan

Before this last update, I had changed myalerts to show a new type of alert that I included in G33K's thankyoulike plugin (which I also changed directly). My thankyoulike alerts are included in the Alerts table nicely. After getting totally confused in trying to create a plugin for this (I was using mentionme plugin as a starting point) I decided to re-apply the changes to the main alerts plugin.

For that I included the following to the list of elseifs that create the output (line 448 of myalerts.php)

Quote: //mod_start
elseif ($alert['alert_type'] == 'post_thankyou')
{
$alert['threadLink'] = $mybb->settings['bburl'].'/'.get_thread_link($alert['content']['tid'], 0, '').'?pid='.$alert['content']['pid'].'#pid'.$alert['content']['pid'];
$alert['message'] = $lang->sprintf($lang->myalerts_post_thankyou, $alert['user'], $alert['threadLink'], htmlspecialchars_uni($parser->parse_badwords($alert['content']['t_subject'])), $alert['dateline']);
$alert['rowType'] = 'postAlert';
}//mod_end

This is a sample of a post_thankyou in the Alerts table:

Quote:"92485","7002","1","1367693936","post_thankyou","13901","1415","{\"tid\":\"13901\",\"t_subject\":\"A matem\\u00e1tica de Deus!!!\",\"pid\":\"112319\"}","0"

I don't need any settings as this plugin should be anable for everyone.

Misteriously the alert is not been shown up. I know this isn't the proper way of doing this, but I desperately need to get this back to work, as my thousands of users are complaining for the lack of this alert.

Would give me any hint on why this isn`t working, as it did on previous version of my alerts?

thanks a lot
Echo
One way would be to always force the alert (set is_forced to 1) and that might fix it. The settings system is still a PITA the work with unfortunately and I need to get round to fixing/cleaning it up a fair deal.
(2013-05-04, 07:08 PM)Euan T Wrote: [ -> ]One way would be to always force the alert (set is_forced to 1) and that might fix it. The settings system is still a PITA the work with unfortunately and I need to get round to fixing/cleaning it up a fair deal.

Excuse for my ignorance, but where I could do this?
Wherever you actually insert the alert into the alerts table. I'd assume you do that in the thankyou/like plugin?

EDIT: example:

$Alerts->addAlert((int) $uidTo, 'thankyoulike', (int) $threadId, (int) $mybb->user['uid'], array('pid' => (int) $post['pid']), 1);
(2013-05-04, 07:21 PM)Euan T Wrote: [ -> ]Wherever you actually insert the alert into the alerts table. I'd assume you do that in the thankyou/like plugin?

EDIT: example:

$Alerts->addAlert((int) $uidTo, 'thankyoulike', (int) $threadId, (int) $mybb->user['uid'], array('pid' => (int) $post['pid']), 1);

This is what I used (which worked before)

$Alerts->addAlert($post['uid'], 'post_thankyou', $post['tid'], $mybb->user['uid'], array(
					'tid'       =>  $post['tid'],
					't_subject' =>  $thread['subject'],
					'pid'       =>  $post['pid']
					));
Yeah, try just adding a new parameter to the end which should be simply "1".