Hide Non Activated Users From Member List
ShadowKyogre Offline
Junior Member
**
Posts: 5
Joined: Apr 2012
Post: #6
RE: Hide Non Activated Users From Member List
(04-05-2012 04:54 PM)ZiNgA BuRgA Wrote:  Do a select COUNT(*) (also, ordering doesn't make any sense here)

PHP Code:
		$query = $GLOBALS['db']->simple_select('users','COUNT(*) AS num_users','usergroup!=5');
		$activeusercount = $GLOBALS['db']->fetch_field($query, 'num_users');


Note that you may wish to put an index on the usergroup column if you do this, as the query can be slow if there are a lot of users.


Updated the modification I made earlier to use that method for counting the number of active users. As for the indexing, I would set it up like this, correct?:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function xtmn_hnau_activate(){
	xtmn_hnau_deactivate();
	// check if we have an index on the users table. If not, make it.
	if(!$db->is_fulltext("users") && $db->supports_fulltext_boolean("users"))
	{
		$db->create_fulltext_index("users", "usergroup","activeuser");
	}
	//end change here
	xtmn_hnau_last_reg_users();
}

function xtmn_hnau_deactivate(){
	if(is_object($GLOBALS['cache']->handler)){
		$GLOBALS['cache']->handler->delete('xtmn_hnau_last_reg_users');
	}
	$GLOBALS['db']->delete_query('datacache','title="xtmn_hnau_last_reg_users"');
	// check if we have an index on the users table. If so, drop the index created by the plugin.
	if($db->is_fulltext("users"))
	{
		$db->drop_index("users","activeuser");
	}
	//end change here
}

04-06-2012 10:44 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
RE: Hide Non Activated Users From Member List - ShadowKyogre - 04-06-2012 10:44 AM

 Standard Tools
Forum Jump: