PDA

View Full Version : PHP - Manually inserted user account does not show on stats at bottom of home page


adam parnell
04-05-2011, 09:23 AM
Hello all,

I have a script to integrate my forum with another system and I can quite happily create a new user however I have noticed it doesnt appear in the stats at the bottom and the last user is shown as the last user created through the forum admin panel.

I know if I run the CRON for daily stats my user now appears.

How can I get the stats to update when I create the user in my php form?

Thanks and best regards to all

kh99
04-05-2011, 12:34 PM
It looks like you could call function build_user_statistics() in includes/functions_databuild.php (assuming you didn't use the vB_DataManager_User() class to add your user, because then it would already be called for you).

Andy
04-05-2011, 02:34 PM
How can I get the stats to update when I create the user in my php form?

Thanks and best regards to all

Looks like the table datastore holds that value in the userstats field.

adam parnell
04-05-2011, 04:00 PM
Interesting,

Do you have an example of using vB_DataManager_User()

Best regards?

kh99
04-05-2011, 04:11 PM
You could look at admincp/user.php, search for "Start do update". (It's the code for adding a user from the ACP). I think this line:

$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_CP);


creates an instance of that class. But if you did your own db writes because you didn't want to use a lot of the vbulletin code then you probably wouldn't want to use that class.

Andy
04-05-2011, 04:17 PM
Interesting,

Do you have an example of using vB_DataManager_User()

Best regards?

My custom scripts always act upon the database tables directly.

adam parnell
04-06-2011, 02:47 PM
Thanks.

Andy,

I do most it manually but I'm not sure about updating the stats which is why is someone has a simple example I can just plop in after the insert command that would be great

Open to suggestions and ideas