MyBB Community Forums

Full Version: No banned members in $stats[lastusername] cache
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I can't seem to find the code(query/function) that is responsible for updating the Newest Member in the Board Statistics section of the Forum Index.

I am currently using (and unsatified with) this @ forum/index.php:
$newestmember = build_profile_link($stats['lastusername'], $stats['lastuid']);
	$newestmembergroup_query = $db->query("SELECT usergroup FROM ".TABLE_PREFIX."users WHERE uid='".$stats['lastuid']."' LIMIT 1;");
	$newestmembergroup_result = $db->fetch_array($newestmembergroup_query);
	if($newestmembergroup_result['usergroup']==7){$newestmember='<del>'.$stats['lastusername'].'</del>';}

Without the use of a plugin, I would like to alter the query that saves $stats['newest_user'] to the stats cache in a way that disqualifies a banned member from being cached as the newest member.
Something that finds the most recent user where usergroup != 7. Pretty simple idea if I knew where and how to implement it.

Do I need to modify something @ forum/stats.php near:
$stats['newest_user'] = build_profile_link($stats['lastusername'], $stats['lastuid']);

Or do I need to modify something @ forum/inc/class_datacache.php near:
function update_stats()
	{
		global $db;
		require_once MYBB_ROOT."inc/functions_rebuild.php";
		rebuild_stats();
	}

Or something @ forum/inc/functions_rebuild.php ?

These threads get close to topic: http://community.mybb.com/post-668424.html
http://community.mybb.com/thread-129767.html
____________________________________________

Also, I extended the $update_array @ forum/admin/modules/user/banning.php to "Ban & Wipe" spammer and SFS-blacklisted accounts. This allows all admins to only click Ban, instead of banning then manually clearing all potentially spammy aspects of the user's profile.
$update_array = array(
		'email' => '[email protected]',
		'avatar' => '',
		'usergroup' => intval($mybb->input['usergroup']),
		'additionalgroups' => '',
		'displaygroup' => 0,
		'usertitle' => 'Spammer',
		'regdate' => 0,
		'website' => '',
		'icq' => '',
		'aim' => '',
		'yahoo' => '',
		'msn' => '',
		'birthday' => '',
		'signature' => ''
	);

I would like to trigger the stats cache correction/rebuild immediately after the Ban & Wipe in case the newest member is a spammer. So I will also need some guidance on implementing the trigger.

p.s. FYI: Admins of www.powerpinochle.com and I only use permanent banning. Site is running version 1.6.9 (1609).
Over 100 views, but no replies. Have I done something wrong in the way I've posted? Or does no one understand? It can't be too hard for people familiar with MyBB codes, right?
Can anyone tell me how to update the cached Lastuser value using php code?