MyBB Community Forums

Full Version: Updating Newest member
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all,

I was wondering if someone could help me on a plugin i've developed.

What i want to do is update the latest member in datacache but i don't know how to, me and my friend have looked into the datacache / newusers and he reckons it's in JSON format, is there a cleaner way to update the newest member using a mybb function / class?

Thanks
Are you trying to manipulate the data directly in the database? The data is stored using php serialize/unserialize so you'll have to use that. Otherwise, if you have already added a user and want to update the stats to show the latest user ten just call the rebuild_stats function from inc/functions_rebuild.php
You've to use the following code where you've used integrating script;
$cache->update_stats(); 

This will update the forum's stats automatically, and you don't have to run recount and rebuild tool again and again Wink
Hi G33K and Yaldaram,

Thank you both for replying, What i wanted was to update the member count after my plugin creates an user account (It's a custom invites only system, registers users who only have a valid invite key) and the problem i'm having is the member count and the "latest member: ... " is not updating.

Quote:Are you trying to manipulate the data directly in the database?

I was going to yes, but after finding it as my friend thought in a JSON format (which it's not as your post states) posting here was our last efforts so to speak and then to find the solution is much simple, i won't be altering the database directly now.

Quote:You've to use the following code where you've used integrating script;
PHP Code:
$cache->update_stats();

This will update the forum's stats automatically, and you don't have to run recount and rebuild tool again and again

Thank you for your help both, much appreciated and i'll let you know how i get on.

Hi me again

When i include the file functions_rebuild.php i get the following error:
Fatal error: Call to a member function simple_select() on a non-object in C:\wamp\www\mybb\inc\functions_rebuild.php on line 19

I know the problem that simple_select() isn't included, but i dont know which file where the function is located, does anyone know where the simple_select() actually exists?

Thanks
Are you trying to run this function in a separate environment? That function only works if the MyBB variables are already initialized, either in a plugin, or by first including global.php
Yes, i'm not actually running it as a plugin.

I've included global.php / functions_rebuild.php but i get this error:

Direct initialization of this file is not allowed. - i understand that, but how can i run the script otherwise? i need to run the script directly.

Please make sure IN_MYBB is defined. - i have defined it, as well as THIS_SCRIPT

To include global.php you have to do this:

define("IN_MYBB", 1);
require_once "./global.php";
Thank you for all your support much appreciated as i've got it working now.

I didn't put the define("IN_MYBB", 1); before everything else.