2021-06-24, 11:23 AM
Hello Guys,
I want to add MentionMe tag and connect it with other accounts which is under Master account, For example when an account or master account tagged by a member an alert should go to all accounts under master account and master account also..
One more thing is when the alert opened by any of them ( Master or accounts under master ) the alert should disappear for all of them..
I kinda achieved the first point after reviewing Enhanced Account Switcher by adding to MentionMe plugin under 'mentionMeMyAlertsDoNewReplyEnd()' function this:
Now for the second point, I'm not sure where to start?
Thank you
best regards
Kurdish
I want to add MentionMe tag and connect it with other accounts which is under Master account, For example when an account or master account tagged by a member an alert should go to all accounts under master account and master account also..
One more thing is when the alert opened by any of them ( Master or accounts under master ) the alert should disappear for all of them..
I kinda achieved the first point after reviewing Enhanced Account Switcher by adding to MentionMe plugin under 'mentionMeMyAlertsDoNewReplyEnd()' function this:
$count = 0;
$user = get_user((int) $uid);
$accounts = $eas->accountswitcher_cache;
if (is_array($accounts)) {
// If recipient is master account send alerts to attached users
foreach ($accounts as $key => $account) {
if ($user['uid'] == $account['as_uid']) {
++$count;
if ($count > 0) {
$alert = new MybbStuff_MyAlerts_Entity_Alert((int) $account['uid'], $alertType, $tid);
$alert->setExtraDetails(array(
'thread_title' => $subject,
'pid' => $pid,
'tid' => $tid
));
$alert->setFromUserId($fromUser);
$alerts[] = $alert;
$mentionedAlready[$uid] = true;
}
}
}
}
// If there are no users attached to the current account but the current account is attached to another user
if ($count == 0 && $user['as_uid'] != 0) {
$master = get_user((int) $uid);
// Get the masters permission
$permission = user_permissions($master['uid']);
// If the master has permission to use the Enhanced Account Switcher, get the userlist
if ($permission['as_canswitch'] == 1) {
// If recipient is attached account, alert master account
if ($master['uid'] == $user['as_uid']) {
$alert = new MybbStuff_MyAlerts_Entity_Alert((int) $account['uid'], $alertType, $tid);
$alert->setExtraDetails(array(
'thread_title' => $subject,
'pid' => $pid,
'tid' => $tid
));
$alert->setFromUserId($fromUser);
$alerts[] = $alert;
$mentionedAlready[$uid] = true;
}
if (is_array($accounts)) {
// If recipient has the same master account, send alert
foreach ($accounts as $key => $account) {
// Leave recipient out
if ($account['uid'] == $user['uid']) {
continue;
}
if ($master['uid'] == $account['as_uid']) {
$alert = new MybbStuff_MyAlerts_Entity_Alert((int) $account['uid'], $alertType, $tid);
$alert->setExtraDetails(array(
'thread_title' => $subject,
'pid' => $pid,
'tid' => $tid
));
$alert->setFromUserId($fromUser);
$alerts[] = $alert;
$mentionedAlready[$uid] = true;
}
}
}
}
}
// If there are no users attached to the a recipient and the recipient isn't attached to another user
if ($count == 0 && $user['as_uid'] == 0) {
$alert = new MybbStuff_MyAlerts_Entity_Alert((int) $account['uid'], $alertType, $tid);
$alert->setExtraDetails(array(
'thread_title' => $subject,
'pid' => $pid,
'tid' => $tid
));
$alert->setFromUserId($fromUser);
$alerts[] = $alert;
$mentionedAlready[$uid] = true;
}
if (!empty($alerts)) {
MybbStuff_MyAlerts_AlertManager::getInstance()->addAlerts($alerts);
}
Now for the second point, I'm not sure where to start?
Thank you
best regards
Kurdish