<?php
public function comment_new($uid, $who, $text)
{
global $mybb, $db;
$data = array(
'user' => $uid,
'sender' => $who,
'text' => $db->escape_string($text),
'date' => time()
);
$db->insert_query('profilecomments', $data);
return TRUE;
}
<?php
public function comment_new($uid, $who, $text)
{
global $mybb, $db, $Alerts;
$data = array(
'user' => $uid,
'sender' => $who,
'text' => $db->escape_string($text),
'date' => time()
);
$cid = $db->insert_query('profilecomments', $data);
if(!empty($Alerts) && is_object($Alerts))
{
$Alerts->addAlert($uid, 'profile_comment', $cid, $who);
}
return TRUE;
}
<?php
$plugins->run_hooks('myalerts_alerts_output_end', $alert);
<?php
elseif ($alert['alert_type'] == 'profile_comment')
{
$alert['threadLink'] = $mybb->settings['bburl'].'/'.get_profile_link($mybb->user['uid']);
$alert['message'] = 'You have a new profile comment.';
if($user = get_user($alert['from_id']))
{
$alert['message'] = $lang->sprintf('You have a new profile comment from {1}.', htmlspecialchars_uni($user['username']));
}
$alert['rowType'] = 'postAlert';
}
<?php
$possible_settings = array(
'rep',
'pm',
'buddylist',
'quoted',
'post_threadauthor',
);
<?php
$possible_settings[] = 'profile_comment';
<?php
if($mybb->usergroup['cancp'])
{
$query = $db->simple_select('users', 'uid, myalerts_settings', 'myalerts_settings!=\'\'');
while($user = $db->fetch_array($query))
{
$settings = json_decode($possible_settings, true);
$settings['profile_comment'] = 1;
$settings = json_encode($settings);
$db->update_query('users', array('myalerts_settings' => $db->escape_string($settings)), 'uid=\''.(int)$user['uid'].'\'');
}
}
<?php
$alert['message'] = $lang->sprintf('{1} added you to their buddy list. ({2})', htmlspecialchars_uni($user));
<?php
$alert['message'] = $lang->sprintf('You have a new profile comment from {1}.', htmlspecialchars_uni($user['username']));