Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 02-05-2010, 06:44 AM
xash xash is offline
 
Join Date: Dec 2009
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to retain Custom Title after Usergroup is changed?

When a user with a Custom Title is moved to a Usergroup that doesn't allow Custom Titles, the user's original Custom Title is reset to the default Usergroup Title.

e.g.

John is part of Primary Usergroup: Members, which has a default user title "Member"
Members do not have permission to edit Custom Title
John is then added to a Secondary Usergroup: Premium Member
John can now change his Custom Title from "Member" to anything else
John changes his Custom Title to "King"
John is subsequently removed from Secondary Usergroup: Premium Member, but remains in Primary Usergroup: Members
John's user title is now automatically reset to "Member" because Primary Usergroup: Members does not allow Custom Titles

The only way I've found to override this is to set "Custom User Title: Yes, admin set (HTML allowed)" from the user's profile in the Admin Control Panel. If this option is set, then the the user retains their Custom Title even after being moved to a Usergroup that doesn't allow Custom Titles. But this requires me to manually make this change for each user.

Is there a script or a hack that can do this for me automatically? Any ideas?

Thanks you in advance for your suggestions.
Reply With Quote
  #2  
Old 02-05-2010, 07:50 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is really how it is supposed to work.

But to answer your question, no i have never seen a modification for this.
Reply With Quote
  #3  
Old 02-05-2010, 08:38 AM
xash xash is offline
 
Join Date: Dec 2009
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your response, Marco. Yes, I know that's by design, but I'm looking for a way to override it.

On further research, I think what I need is to create a cron job with an sql query that does the following:

UPDATE user
SET customtitle = 1
WHERE usergroupid = X

I gleaned this info from here and here.

Customtitle data values are:

0 = No Custom User Title
1 = Admin Set
2 = User Set

and X would be the usergroup ID of the Secondary Usergroup: Premium Member.

So, essentially, the above sql query would set all customtitle datavalues to Admin Set for the usergroup Premium Member, which is what I need.

Is my understanding of the above correct? Can usergroupid be used in the sql query to specify users whose secondary usergroup matches the usergroupid?

How do I create a cron job with the above sql query? I know how to add a new task using "Schedule Task Manager" in Admin CP, but what code do I need in the .php file to run the above query?

If someone could point me in the right direction, or provide a link to an example .php file with an sql query, I would much appreciate it.

Thanks.

--------------- Added [DATE]1265416347[/DATE] at [TIME]1265416347[/TIME] ---------------

No one here knows how to run this sql query in php? :

UPDATE user
SET customtitle = 1
WHERE usergroupid = X

All I need is a small .php script which runs this single query. Thanks in advance for your time.
Reply With Quote
  #4  
Old 02-10-2010, 03:26 AM
xash xash is offline
 
Join Date: Dec 2009
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I think I found a solution that should work in theory. Apparently, I don't need to create a cron job at all. What I need instead is to create a plugin with my PHP code. I'm posting here for anyone searching for a similar solution.

Instead of a php script, all I need to do is:

1. "Add New Plugin" from the Admin Control Panel
2. Choose Product as "vBulletin"
3. Set the hook location to paidsub_complete
4. Enter the PHP code directly into the "Plugin PHP Code" text box
Reply With Quote
Reply

Thread Tools
Display Modes

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 06:46 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.03508 seconds
  • Memory Usage 2,182KB
  • Queries Executed 13 (?)
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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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_postinfo_query
  • fetch_postinfo
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete