2012-12-18, 03:19 AM
(This post was last modified: 2012-12-18, 04:46 AM by blogantinom.)
Hi euantor, the link to the PMs are showing the wrong ids, what would that be?
I did it for the thankyou plugin.
Basically:
1) Change the file mybb/thankyoulike.php
After:
And at the end add the function:
2) Then change mybb/inc/plugins/myalerts.php
after $alert['rowType'] = 'postAlert'; }
add:
3) Enable the alert for all users
I think that's all to have you thankyou plugin working with myalerts
Of course you could use the "add_hook" method as instructed here.
(2012-12-17, 05:35 AM)maniacmusic Wrote: Can someone make a like-plugin that supports MyAlerts?
I did it for the thankyou plugin.
Basically:
1) Change the file mybb/thankyoulike.php
After:
Quote:if($tlid)add:
{
Quote:
//Add alert for the thanks
thankyoulike__addThankyouAlert($thread, $post);
And at the end add the function:
Quote:function thankyoulike__addThankyouAlert($thread, $post)
{
global $mybb, $cache, $Alerts;
if ($mybb->settings['myalerts_enabled'] AND $Alerts instanceof Alerts)
{
// UID to give alert to, alert type - should be unique - usually the name of your plugin, TID - use only if alert is related to specific thread, Alert from UID - in this case I want users to know who awarded them, Alert content - any specific content you wish to send in the alert
$Alerts->addAlert($post['uid'], 'post_thankyou', $post['tid'], $mybb->user['uid'], array(
'tid' => $post['tid'],
't_subject' => $thread['subject'],
'pid' => $post['pid']
));
}
}
2) Then change mybb/inc/plugins/myalerts.php
after $alert['rowType'] = 'postAlert'; }
add:
Quote:elseif ($alert['alert_type'] == 'post_thankyou' /* AND $mybb->settings['myalerts_alert_post_thankyou'] */)Add "'post_thankyou'," to the end of the two instances of the "$possible_settings = array(", like this:
{
$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';
}
Quote: $possible_settings = array(
'rep',
'pm',
'buddylist',
'quoted',
'post_threadauthor',
//mod_start
'post_thankyou', //mod_end
);
3) Enable the alert for all users
Quote:UPDATEmybb
.mybb_users
SETmyalerts_settings
= '{"rep":1,"pm":1,"buddylist":1,"quoted":1,"post_threadauthor":1,"post_thankyou":1}';
I think that's all to have you thankyou plugin working with myalerts

Of course you could use the "add_hook" method as instructed here.