ArashDev Posted September 10, 2023 Share Posted September 10, 2023 hi I want to add an option to the user menu so that administrators can see whether there are posts awaiting approval or not. To do this, I'm using the following code: {{$approval = new \IPS\core\extensions\core\ModCp\Unapproved; $approvalqueu = $approval->getApprovalQueueCount( ( \IPS\Settings::i()->ApprovalQueueIcon_bypass_cache) ? : TRUE );}} {{if ( (! \IPS\Settings::i()->ApprovalQueueIcon_hide_empty) || $approvalqueu )}} <li class="capproval cUserNav_icon"> <a href='{url="app=core&module=modcp&controller=modcp&tab=approval" seoTemplate="modcp_approval"}' id='elFullApproval' data-ipsTooltip title='{lang="modcp_approval" escape="true"}' data-ipsMenu data-ipsMenu-closeOnClick='false'> <i class='fa fa-eye'></i> {{if $approvalqueu}}<span class='ipsNotificationCount' data-notificationType='reports'>{$approvalqueu}</span>{{endif}} </a> <div id='elFullApproval_menu' class='ipsMenu ipsMenu_wide ipsHide'> <div class='ipsMenu_headerBar'><h4 class='ipsType_sectionHead'>{lang="approval_center_header"}</h4></div> <div class='ipsMenu_innerContent' data-role="approvalList"></div> <div class='ipsMenu_footerBar ipsType_center'> <a href='{url="app=core&module=modcp&controller=modcp&tab=approval" seoTemplate="modcp_approval"}'><i class='fa fa-bars'></i> {lang="approval_center_link"}</a> </div> </div> </li> {{endif}} I want it to behave like other menu items, showing the list of posts awaiting approval when I click on it. I've written the following code for this purpose, but it's not working. {{$approval = new \IPS\core\extensions\core\ModCp\Unapproved; $approvalqueu = $approval->getApprovalQueueCount( ( \IPS\Settings::i()->ApprovalQueueIcon_bypass_cache) ? : TRUE );}} {{if ( (! \IPS\Settings::i()->ApprovalQueueIcon_hide_empty) || $approvalqueu )}} <li class="capproval cUserNav_icon"> <a href='{url="app=core&module=modcp&controller=modcp&tab=approval" seoTemplate="modcp_approval"}' id='elFullApproval' data-ipsTooltip title='{lang="modcp_approval" escape="true"}' data-ipsMenu data-ipsMenu-closeOnClick='false'> <i class='fa fa-eye'></i> {{if $approvalqueu}}<span class='ipsNotificationCount' data-notificationType='reports'>{$approvalqueu}</span>{{endif}} </a> <div id='elFullApproval_menu' class='ipsMenu ipsMenu_wide ipsHide'> <div class='ipsMenu_headerBar'><h4 class='ipsType_sectionHead'>{lang="approval_center_header"}</h4></div> <div class='ipsMenu_innerContent' data-role="approvalList"> {{foreach $approval->getItems() as $item}} {{if $item->approve_url}} <a href='{$item->approve_url}'>{$item->title}</a><br> {{else}} {$item->title}<br> {{endif}} {{endforeach}} </div> <div class='ipsMenu_footerBar ipsType_center'> <a href='{url="app=core&module=modcp&controller=modcp&tab=approval" seoTemplate="modcp_approval"}'><i class='fa fa-bars'></i> {lang="approval_center_link"}</a> </div> </div> </li> {{endif}} Link to comment Share on other sites More sharing options...
Management terabyte Posted September 13, 2023 Management Share Posted September 13, 2023 I'm on my phone right now, but at a first look the code seems okay. Maybe you're missing some parameter in the call. If you try to debug the getItems() output, what do you get? Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! > Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now