vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Rank / Display Group (https://vborg.vbsupport.ru/showthread.php?t=282870)

Captain Tycoon 05-13-2012 11:02 PM

Rank / Display Group
 
Ok so basically, I made a custom script outside the admincp so I can have certain people with certain usergroups be able to edit peoples usergroups upto a certain level.

The problem is, the rank images (from display group) aren't being updated up until I manually run the "Update User Titles and Ranks" maintenance script.

I noticed there isnt anywhere in the database that shows what rank a person is in, and it bases it on the display group...

What exactly do I need to do, to make the "Update User Titles and Ranks" maintenance run for that specific userid only, so I can have it automatically run upon running the custom script.

kh99 05-14-2012 12:36 AM

The rank is calculated in includes/class_dm_user.php, if any information has been set that could affect the rank. The code that does it when you run "Update User Titles and Ranks" in the admincp is in admincp/misc.php. It creates a user datamanger and sets (among other things) the user posts to the same value it already has. That seems like it wouldn't do anything, but the user datamanager code detects that the posts have been set and recalculates rank. I think setting the usergroup should also trigger it to be recalculated, but of course that only would happen if you're using the datamanager to set it (which I'm guessing your script doesn't?). In any case you should just be able to do something like:

Code:

$userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$userdm->set_existing($user);
$userdm->set('posts', $user['posts']); // This will activate the rank update
$userdm->save();



All times are GMT. The time now is 07:02 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01075 seconds
  • Memory Usage 1,708KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete