j883376
03-10-2006, 10:00 PM
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
[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
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
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 $cell[] = iif($caneditavatar, '<span class="smallfont">' . construct_link_code($vbphrase['change_avatar'], 'user.php?' . $vbulletin->session->vars['sessionurl'] . "do=avatar&u=$user[userid]") . '</span>');
Below that add: $cell[] = iif($caneditavatar, '<span class="smallfont">' . construct_link_code($vbphrase['change_title'], "user.php?$session[sessionurl]do=usertitle&u=$user[userid]") . '</span>');
Finally, find // ###################### Start editsig #######################
Above it add: // ###################### 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_alterat ion_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(0 => $vbphrase['no'], 1 => $vbphrase['yes'], 2 => $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_alterat ion_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', $vbulletin, ERRTYPE_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&u=" . $vbulletin->GPC['userid']);
}
else
{
define('CP_REDIRECT', "index.php?do=home");
}
print_stop_message('saved_user_title_x_successfull y', $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
[b]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. :)
[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
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
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 $cell[] = iif($caneditavatar, '<span class="smallfont">' . construct_link_code($vbphrase['change_avatar'], 'user.php?' . $vbulletin->session->vars['sessionurl'] . "do=avatar&u=$user[userid]") . '</span>');
Below that add: $cell[] = iif($caneditavatar, '<span class="smallfont">' . construct_link_code($vbphrase['change_title'], "user.php?$session[sessionurl]do=usertitle&u=$user[userid]") . '</span>');
Finally, find // ###################### Start editsig #######################
Above it add: // ###################### 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_alterat ion_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(0 => $vbphrase['no'], 1 => $vbphrase['yes'], 2 => $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_alterat ion_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', $vbulletin, ERRTYPE_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&u=" . $vbulletin->GPC['userid']);
}
else
{
define('CP_REDIRECT', "index.php?do=home");
}
print_stop_message('saved_user_title_x_successfull y', $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
[b]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. :)