Alert Improvements by Xon

Alert Improvements by Xon 1.5.6

No permission to download
@Xon loving the idea of this and it gets me halfway to where I'm hoping to be... is there any way to do the following in current-state:

1.) prevent alerts from being marked as read upon clicking the "Alerts" dropdown (account_alerts_popup) in the top nav? Similar to the built-in option "Alerts page skips mark read" that works for the /account/alerts page?

2.) integrate the "Mark unread" into the account_alerts_popup without it redirecting to the /accounts/alerts page when being clicked? I've added the "mark unread" option from "account_alerts_extra" in my account_alerts_popup template, which works well in the pop-up, however, due to the line in account_alerts_extra, i'm redirected to "xen:link 'account/unread-alert'" upon clicking the "mark unread" link... the idea is to be able to mark it as unread from within the pop-up on any page and to carry on about your business on the forum without diverting.

Appreciate any help!!
 
Last edited:
@Xon loving the idea of this and it gets me halfway to where I'm hoping to be... is there any way to do the following in current-state:

1.) prevent alerts from being marked as read upon clicking the "Alerts" dropdown (account_alerts_popup) in the top nav? Similar to the built-in option "Alerts page skips mark read" that works for the /account/alerts page?

2.) integrate the "Mark unread" into the account_alerts_popup without it redirecting to the /accounts/alerts page when being clicked? I've added the "mark unread" option from "account_alerts_extra" in my account_alerts_popup template, which works well in the pop-up, however, due to the line in account_alerts_extra, i'm redirected to "xen:link 'account/unread-alert'" upon clicking the "mark unread" link... the idea is to be able to mark it as unread from within the pop-up on any page and to carry on about your business on the forum without diverting.

Appreciate any help!!
FYI, #1 was resolved via here:
https://xenforo.com/community/threads/click-alerts-not-mark-all-as-read.150548/

#2 is still a lingering question
 
Last edited:
for those curious, i was able to accomplish #2 in a roundabout-ish way in accout_alerts_popup:

replaced:
Code:
<a class="markAlertUnread fa"  href="{xen:link 'account/unread-alert', '', 'alert_id={$alert.alert_id}'}">
        <span class="unreadLink">
            <xen:comment>Lack of linebreaks necessary to avoid unnecessary space</xen:comment>
            {xen:phrase sv_mark_unread}</span></a>{xen:if {$alert.isSummary},','}

with:
Code:
<a class="markAlertUnread fa">

<script>
$(document).ready(function(){
$("#href{$alert.alert_id}").click(function(){
$.get( "{xen:link 'account/unread-alert', '', 'alert_id={$alert.alert_id}'}" );
location.reload();
});
});
</script>

<span class="unreadLink"></span></a>

this makes the call behind the scenes. only downside is that it's not an ajax call, so i had to refresh the current page to see the results.
 
Last edited:
  • Like
Reactions: Xon
The pop-up should only show upto 25 alerts. This is hardcoded into XF.
any idea where in the core code it's limited to 25? i'd really like to increase this number if at all possible and don't mind adjusting a file here or there :)
 
I believe it'll be library/XenForo/Model/Alert.php on line 173.
this works if this mod is disabled, but once re-enabling, it's limited to 25. any ideas why the mod would revert, @Xon ?

edit: disregard. the answer is that a copy of Alert.php is found in the mod files and also needs to be updated: SV > AlertImprovements > XenForo > Model > Alerts.php
line 322
 
Hi Xon,

we got the following error when running this add-on and had to disable it. Is there a chance you can make this add-on fit for PXC?

Code:
[TABLE]
[TR]
[TH]Request State[/TH]
[/TR]
[TR]
[TH]Stack Trace[/TH]
[/TR]
[TR]
[TD]Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Percona-XtraDB-Cluster prohibits use of GET_LOCK with pxc_strict_mode = ENFORCING - library/Zend/Db/Statement/Mysqli.php:214
Generated By: XXXXXXXXX, Today at 4:45 PM[/TD]
[/TR]
[TR]
[TD]#0 /home/nginx/domains/xxxx/public/library/Zend/Db/Statement.php(317): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/nginx/domains/xxxx/public/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/nginx/domains/xxxx/public/library/Zend/Db/Adapter/Abstract.php(825): Zend_Db_Adapter_Abstract->query('select get_lock...', Array)
#3 /home/nginx/domains/xxxx/public/library/SV/AlertImprovements/XenForo/Model/Alert.php(226): Zend_Db_Adapter_Abstract->fetchOne('select get_lock...', Array)
#4 /home/nginx/domains/xxxx/public/library/SV/AlertImprovements/XenForo/Model/Alert.php(347): SV_AlertImprovements_XenForo_Model_Alert->getSummarizeLock(108043)
#5 /home/nginx/domains/xxxx/public/library/XenForo/Model/Alert.php(75): SV_AlertImprovements_XenForo_Model_Alert->_getAlertsFromSource(108043, 'fetchPopupItems', Array)
#6 /home/nginx/domains/xxxx/public/library/XenForo/ControllerPublic/Account.php(74): XenForo_Model_Alert->getAlertsForUser(108043, 'fetchPopupItems')
#7 /home/nginx/domains/xxxx/public/library/Audentio/UIX/ControllerPublic/Account.php(54): XenForo_ControllerPublic_Account->actionAlertsPopup()
#8 /home/nginx/domains/xxxx/public/library/XenForo/FrontController.php(369): Audentio_UIX_ControllerPublic_Account->actionAlertsPopup()
#9 /home/nginx/domains/xxxx/public/library/XenForo/FrontController.php(152): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#10 /home/nginx/domains/xxxx/public/index.php(13): XenForo_FrontController->run()
#11 {main}[/TD]
[/TR]
[TR]
[TD]array(3) {
["url"] => string(187) "https://xxxx/account/alerts-popup?&_xfRequestUri=%2Faccount%2Falerts&_xfNoRedirect=1&_xfToken=&_xfResponseType=json"
["_GET"] => array(5) {
["/account/alerts-popup"] => string(0) ""
["_xfRequestUri"] => string(15) "/account/alerts"
["_xfNoRedirect"] => string(1) "1"
["_xfToken"] => string(58) ""
["_xfResponseType"] => string(4) "json"
}
["_POST"] => array(0) {
}
}[/TD]
[/TR]
[/TABLE]
 
  • Like
Reactions: Xon
Probably not, the use of get_lock was redundant because of the use of flood-checking. Plenty of stuff breaks if you disable flood-checking due to race conditions which are simply to fix by rate limiting a user.
 
we got the following error when running this add-on and had to disable it. Is there a chance you can make this add-on fit for PXC?
The update to fix this looks to have fixed a pile of micro-stalls a galera clustering I manage was encountering every so often.
 
  • Like
Reactions: HWS
Back
Top Bottom