Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 09-03-2013, 11:36 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gsk8 View Post
I would also like to update the User Titles via a scheduled task. VB can't help and sent me here.

I have a hack that auto-bans spammers, but I still have to update the counters manually in order for the "banned" to show in the User Title.....

Been trying to figure this out off and on for a few years
Quote:
Originally Posted by Smitty View Post
Same here. And running the update manually with over 250,000 registered people takes a *long* time.
What mod? Please link me to it .

For now try editing a cron job and by that I mean the file for instance one related to a scheduled task that runs at least daily. Where can you add the code? Ensure your scheduled tasks are enabled then edit the file cleanup.php OR cleanup2.php OR dailycleanup.php which is located in the /includes/cron/ folder and add the query just below:

PHP Code:
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ######################################################################## 

PHP Code:
// Update usertitles for banned members
$vbulletin->db->query_write("UPDATE " TABLE_PREFIX "user
SET usertitle = 'Banned'
WHERE usergroupid = '8' AND usertitle != 'Banned'
"
);

// Update user ranks to none for banned members
$vbulletin->db->query_write("UPDATE " TABLE_PREFIX "user AS user
LEFT JOIN " 
TABLE_PREFIX "usertextfield AS usertextfield
ON user.userid = usertextfield.userid
SET usertextfield.rank = NULL
WHERE usergroupid = '8'
"
); 
If you utilize cleanup.php, its the file ran when the Hourly Cleanup scheduled task runs, so with that being said the username update would take place every hour. If you have quite a few members as some noted, you may wish to do this once per day and would then instead edit the file dailycleanup.php instead, now the user title update takes place once per day - less queries and less often unless updating something live is a good rule of thumb.

Enjoy!


Note: Should delete entries in ranks table using query similar to the below as well HOWEVER this sets usertitle to guest and removes user info from post and requires fix broken user profiles to be used so just an example query for now until I have time to adjust it properly i.e. insert into instead of delete:

PHP Code:
// Delete the entry in ranks table for the banned members
$vbulletin->db->query_write("DELETE " TABLE_PREFIX "usertextfield
FROM " 
TABLE_PREFIX "usertextfield LEFT JOIN " TABLE_PREFIX "user
ON usertextfield.userid = user.userid
WHERE usertextfield.rank IS NULL
"
); 
Edit: In all honesty using the data manager via a custom script would be best in a situation like this versus queries running via cron jobs just so your aware, the above queries will work though (don't use the bottom one, that deletes entries it was scratch code but works just throws the data manager for a loop per say).
Reply With Quote
  #22  
Old 09-08-2013, 03:59 PM
Smitty's Avatar
Smitty Smitty is offline
 
Join Date: Sep 2002
Location: Southern Ohio
Posts: 385
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the tip.
Reply With Quote
Благодарность от:
TheLastSuperman
  #23  
Old 05-20-2014, 01:53 AM
joeychgo's Avatar
joeychgo joeychgo is offline
 
Join Date: Mar 2004
Location: Chicago, IL
Posts: 933
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What about updating rank badges when paid subscriptions expire?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:50 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03827 seconds
  • Memory Usage 2,199KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (3)post_thanks_box
  • (1)post_thanks_box_bit
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete