• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Question on "Awaiting Approval" count

Trombones13

Well-known member
#1
This thread will kinda make it obvious (my surprises are always ruined by questions! :(), but I'm working on a little tweak to show the number of users "Awaiting Approval" in the moderator bar. However, I can't figure out how to make the count for the number of users awaiting approval to appear on the frontend. I presume it's something similar to this, which is the display/count for reported items on the moderator bar:
Code:
<a href="{xen:link reports}" class="reportedItems modLink">
				<span class="itemLabel">{xen:phrase reported_items}:</span>
				<span class="itemCount {xen:if {$session.reportCounts.total}, 'alert'}">{$session.reportCounts.total}</span>			</a>
However, I don't know what the class and itemCount conditional should be set to instead of reportCounts. Is this going to require a file change, or is it just a matter of having the correct class in the code?
 
R

ragtek

Guest
#2
AFAIK the value is not available in the frontend
YOu'll need to run
PHP:
$userModel->countUsers(array('user_state' => 'moderated')),
and assign the value to the view.

IMHO the best point for this would be container_public_params
 

Trombones13

Well-known member
#3
Thanks! I'll attempt to get it working later tonight (gotta check out the old Have You Seen? videos and make sure I know what I'm doing...I think the pagenav one has me close to finished already) and post back if I have further issues. :D
 

Trombones13

Well-known member
#4
Apparently I'm doing something wrong, because I'm getting the "Please enter a valid callback method." error. :(

Listening to event: controller_public_params
Callback: KurtApproveBar_Listener_count::count (had ::listen there before, but that didn't work either)

File library/KurtApproveBar/Listener/count.php:
PHP:
<?php

class KurtApproveBar_Listener_count
     {
     public static function count(array &$params}
     {
         $userModel->countUsers(array('user_state' => 'moderated')),
     }
?>
Help would be appreciated...I think I might hopefully be sorta close (how's that for confident? haha) thanks to Kier's video and Lawrence's guide, but I'm not sure what's going wrong here. :/
 
R

ragtek

Guest
#5
There is o userModel available in the scope;)

You could try
class KurtApproveBar_Listener_count
{
public static function count(array &$params}
{
$userModel= XenForo_Model::create('XenForo_Model_User');
$userModel->countUsers(array('user_state' => 'moderated')),
}
 

Trombones13

Well-known member
#6
Still getting the "Please enter a valid callback method" error. :( Does that mean it has to do with what I've put in for KurtApproveBar_Listener_count::count? :confused:
 
R

ragtek

Guest
#9
Still getting the "Please enter a valid callback method" error. :( Does that mean it has to do with what I've put in for KurtApproveBar_Listener_count::count? :confused:
I'm not sure what you're doing and i don't have the time to discuss about it, so if you're interessted in coding, check the code;)
If not, install it^^
 
R

ragtek

Guest
#11
my code:
PHP:
<?php
class Ragtek_ApproveMember_StaticMethods{

    public static function addGlobalAppMembers(&$params, $dep){
        $memberModel = XenForo_Model::create('XenForo_Model_User');
        $params['appcounter'] = $memberModel->countUsers(array('user_state' => 'moderated'));
    }
}
Listenersettings:
event.PNG
 

Trombones13

Well-known member
#12
*pumps fist in air*
The only reason why this wasn't working (well, after I fixed the code--didn't have "$dep" or the "params" thing done correctly) was because when I upload things to the server via FireFTP, I have to fix the permissions...and I hadn't remembered to do so until just a moment ago, hence why I was receiving the "Please enter a valid callback method" errors. It's working now:
XF Awaiting Approval Pic.png
Thanks a bunch for your help, ragtek! :D
 

Rudy

Well-known member
#14
donate xxx$ to paypal account ragga@ragtek.org:p
then download the attachment, unpack & upload it, install the xml file
place {$appcounter} into your template
check if it's working
say thx
Downloaded the attachment, but the readme.html file says to upload everything in the /upload directory, then install the .xml file. Do we still need to place {$appcounter} in the template? May want to update that readme.html file if so.
 
R

ragtek

Guest
#15
Downloaded the attachment, but the readme.html file says to upload everything in the /upload directory, then install the .xml file. Do we still need to place {$appcounter} in the template? May want to update that readme.html file if so.
I think that we have already a other version of this add-on (with automatic template including in the modbar)
I'll check it when i'm in the office and if it's so, i hope that ajnos can release it here.
 

Rudy

Well-known member
#17
A "bimp" for this thread...even if I get code for the template edit to put this up in the moderator bar, it would work for now. I have the rest of the plugin installed but disabled.

I can put "{$appcounter}" in the moderator bar, but nothing appears. If I highlight the area with the mouse, though, i can see the number of unapproved users. All it needs is a little extra code to go with this in the template, and it would be ready to go.
 

mrGTB

Well-known member
#18
I would like to see this added as a default part of XenForo before 1.1 Gold. It's very much needed as an instant indicator on the front-page without having to keep venturing into the back-end to check things each time.
 

Rudy

Well-known member
#20
I would like to see this added as a default part of XenForo before 1.1 Gold. It's very much needed as an instant indicator on the front-page without having to keep venturing into the back-end to check things each time.
Agreed. Moderators on my forums usually don't have time to check the new member queue several times per day--the Awaiting Activation mod we put in place is used constantly and we get members approved much faster.

I'm OK with it being an add-on but would be nice to have it be part of XF proper, especially since the additional code is so minimal.