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

Include banned members in total member count?

Dr.Yontem

Formerly Tilkißey
#2

XenForo_Model_User file
line 899-907
PHP:
public function countTotalUsers()
{
return $this->_getDb()->fetchOne('
SELECT COUNT(*)
FROM xf_user
WHERE user_state = \'valid\'
 AND is_banned = 0
');
}
you can change it to
PHP:
public function countTotalUsers()
{
return $this->_getDb()->fetchOne('
SELECT COUNT(*)
FROM xf_user
WHERE user_state = \'valid\'
');
}
but, if u ask me, i dont recommend this, coz, you ve to re-edit this file after all updates
 
R

ragtek

Guest
#3
but, if u ask me, i dont recommend this, coz, you ve to re-edit this file after all updates
You can overwrite/extend the original classes/methods without editing the files.

that's why it's important to use xenforo_model::create('model_name') to initialize the models instead of $foo = new model_name... (what your add-ons still aren't making, even it was recommended several times by shamil and other developers...)
 

Dr.Yontem

Formerly Tilkißey
#4
You can overwrite/extend the original classes/methods without editing the files.

that's why it's important to use xenforo_model::create('model_name') to initialize the models instead of $foo = new model_name... (what your add-ons still aren't making, even it was recommended several times by shamil and other developers...)
i am not sure that i know overwrite to an original class via listener

PS: i use create('blabla') in my add-ons' updated versions ;)
 
R

ragtek

Guest
#7
i am not sure that i know overwrite to an original class via listener
PHP:
class Ragtek_C1_Model_User extends XFCP_Ragtek_C1_Model_User
{
    public function countTotalUsers()
    {
        return $this->_getDb()->fetchOne('
            SELECT COUNT(*)
            FROM xf_user
            WHERE user_state = \'valid\'
        ');
    }
}
that's it.

1. create the listener to extend the user model
2. use the proxy class system to overwrite the method (extending the class from an non existing proxy class)
(class Ragtek_C1_Model_User extends XFCP_Ragtek_C1_Model_User

to see how it's working, check xenforo_application:: resolveDynamicClass line 330