vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Supermods can edit user's custom titles via the ModCP (https://vborg.vbsupport.ru/showthread.php?t=110046)

j883376 03-10-2006 10:00 PM

Supermods can edit user's custom titles via the ModCP
 
As some of you may or may not know, a Supermod has a couple of good, but also very limited tools when it comes to editing a user. The built in functions are as follows

[Ban User] [View Profile] [Change Signature] [Change Avatar] [Change Profile Picture]

Now, if they can ban them, edit their sig, their avatar, and their profile picture, why shouldn't they be able to edit the member's custom title?
Once installed, Supermods will have a new option in their ModCP when they search for a user labeled [Change Custom Title]

This hack requires 3 edits to the file user.php which can be found in the modcp directory of your forums.

Find
PHP Code:

print_table_header(construct_phrase($vbphrase['showing_users_x_to_y_of_z'], '1'$db->num_rows($users), $db->num_rows($users)), 7); 

And change it to
PHP Code:

print_table_header(construct_phrase($vbphrase['showing_users_x_to_y_of_z'], '1'$db->num_rows($users), $db->num_rows($users)), 8); 

Next, you must find
PHP Code:

$cell[] = iif($caneditavatar'<span class="smallfont">' construct_link_code($vbphrase['change_avatar'], 'user.php?' $vbulletin->session->vars['sessionurl'] . "do=avatar&amp;u=$user[userid]") . '</span>'); 

Below that add:
PHP Code:

$cell[] = iif($caneditavatar'<span class="smallfont">' construct_link_code($vbphrase['change_title'], "user.php?$session[sessionurl]do=usertitle&amp;u=$user[userid]") . '</span>'); 

Finally, find
PHP Code:

// ###################### Start editsig ####################### 

Above it add:
PHP Code:

// ###################### Start usertitle ######################

if ($_REQUEST['do'] == 'usertitle')
{

if (!
can_moderate(0'caneditavatar'))
{
print_stop_message('no_permission_avatars');
}
$noalter explode(','$vbulletin->config['SpecialUsers']['undeletableusers']);
if (!empty(
$noalter[0]) AND in_array($vbulletin->GPC['userid'], $noalter))
{
print_stop_message('user_is_protected_from_alteration_by_undeletableusers_var');
}
print_form_header('user','dousertitle');
print_table_header('Change usertitle');
if (empty(
$vbulletin->GPC['userid']))
{
print_stop_message('invalid_user_specified');
}
construct_hidden_code('userid'$vbulletin->GPC['userid']);
print_input_row($vbphrase['user_title'], 'usertitle'$user['usertitle']);
print_select_row($vbphrase['custom_user_title'], 'customtitle', array(=> $vbphrase['no'], => $vbphrase['yes'], => $vbphrase['yes_but_not_parsing_html']), $user['customtitle']);
print_submit_row('Save','Reset');
print_table_footer();
}

// ###################### Start dousertitle ######################

if ($_REQUEST['do'] == 'dousertitle')
{
$vbulletin->input->clean_array_gpc('p', array(
        
'usertitle'      => TYPE_STR,
        
'customtitle'      => TYPE_INT
));

if (!
can_moderate(0'caneditavatar'))
{
print_stop_message('no_permission_avatars');
}
$noalter explode(','$vbulletin->config['SpecialUsers']['undeletableusers']);
if (!empty(
$noalter[0]) AND in_array($vbulletin->GPC['userid'], $noalter))
{
print_stop_message('user_is_protected_from_alteration_by_undeletableusers_var');
}

$userinfo fetch_userinfo($vbulletin->GPC['userid']);


# silent error type -- none of the functions used here can actually produce errors, so :)
$userdm =& datamanager_init('User'$vbulletinERRTYPE_SILENT);
# load the user into the datamanager
$userdm->set_existing($userinfo); 
# call the usertitle function with appropriate parameters
$userdm->set_usertitle($vbulletin->GPC['usertitle'], false$vbulletin->usergroupcache["$userinfo[usergroupid]"], true$permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'] );
$userdm->save(); 
if (
can_moderate(0'canviewprofile'))
{
define('CP_REDIRECT'"user.php?do=viewuser&amp;u=" $vbulletin->GPC['userid']);
}
else
{
define('CP_REDIRECT'"index.php?do=home");
}

print_stop_message('saved_user_title_x_successfully'$vbulletin->GPC['usertitle']);


You need also make a phrase for it to display the words Custom Title in the ModCP

ACP > Languages & Phrases > Phrase Manager > Add New Phrase

Phrase Type: Control Panel User Management
Product: vBulletin
Varname: change_title
Text: Change Title

You're all done! Now go check the ModCP and you should have a nice new option to change the custom title. :)

hiiped 03-11-2006 03:03 AM

This is cool

thanks

j883376 03-11-2006 03:41 AM

Quote:

Originally Posted by hiiped
This is cool

thanks

If you install it, please click Install. :(

OWNAGE TIME 03-11-2006 07:04 PM

Good job man thanks.

~Ownage

j883376 03-12-2006 05:37 PM

I wish there were hooks inside of those 2 spots so I wouldn't need to have a Code Modification for this and could use a plugin :(

Zowners 03-16-2006 08:20 PM

very nice! Thanks man!

Snake 03-28-2006 11:45 AM

Cool hack. Thanks!

j883376 03-29-2006 09:55 PM

Quote:

Originally Posted by Aftermath
Cool hack. Thanks!

Please hit Install if you install this hack :(

Deagle Man 04-09-2006 11:59 AM

GREAT hack. Thank you very much.

/me clicks install

Sir Rb 04-29-2006 10:28 PM

Awsome :)

Soonerdude 04-24-2007 02:25 PM

I need something like this for 3.6.x

WhaLberg 04-24-2007 02:30 PM

Quote:

Originally Posted by Soonerdude (Post 1234675)
I need something like this for 3.6.x

Why don't you give it a try if it works for 3.6.x or not.


All times are GMT. The time now is 05:49 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.01252 seconds
  • Memory Usage 1,779KB
  • 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
  • (6)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (12)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