PDA

View Full Version : Lock Members from editing profile


dakotausa
04-07-2004, 11:01 AM
This is another hack on vb2 that i'd like to see here, also would it be possible to lock them out of editing their options, but still let them in the User CP? Preferably a hack that'd allow for Lock/Unlock. either All are locked or all are unlocked, so i guess they'd be controlled by one click.

If confused i'll do my best to clarify.

Thank you.
dakotausa

NTLDR
04-07-2004, 11:42 AM
This has been a default usergroup permission since vB2.

Usergroup Manager -> Select a usergroup -> 'Can Edit Own Profile' -> No.

68 Z-28
04-07-2004, 04:44 PM
I understand that, but would like to make it imposed on a single person, not a whole usergroup. I'd like to stay away from creating a new usergroup.

68 Z-28
04-13-2004, 04:26 AM
bump

EvilLS1
04-13-2004, 04:57 AM
Well since you're a fellow F-Body owner & car enthusiast I'll help ya out. ;)


Run this query via phpmyadmin:

ALTER TABLE user ADD pban smallint(5) unsigned DEFAULT 1 NOT NULL

In admincp/user.php find:

{
print_profilefield_row($profilefield, $userfield);
}


Below it add:

print_yes_no_row($vbphrase['can_edit_profile'], 'pban',$user[pban]);


Find:

if ($_POST['do'] == 'update')
{
globalize($_POST, array(
'password',
'user',
'membergroup',
'modifyavatar',
'birthday',
'signature',
'modifyprofilepic',
'joindate',
'lastvisit',
'lastactivity',
'lastpost',
'options',
'referrer',
'threaddisplaymode' => INT
));


Replace it with:

if ($_POST['do'] == 'update')
{
globalize($_POST, array(
'password',
'user',
'membergroup',
'modifyavatar',
'birthday',
'signature',
'modifyprofilepic',
'joindate',
'lastvisit',
'lastactivity',
'lastpost',
'options',
'referrer',
'pban',
'threaddisplaymode' => INT
));


Find:

$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "usertextfield
(userid, signature)
VALUES
($userid, '" . addslashes($signature) . "')
");
}


Below it add:

$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET pban=$pban WHERE userid=$userid");


In profile.php find:

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


Below it add:

if ($bbuserinfo[pban]==0)
{
print_no_permission();
}


If you want to stop them from editing other things just place that same code under whichever parts you don't want them to edit. For example, if you wanted to stop them from editing the options you would find this:

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

And add this below it:


if ($bbuserinfo[pban]==0)
{
print_no_permission();
}


Same goes for the avatar, signature, and whatever else you want to limit. Or if you prefer to limit them from everything you would just add that code below this:

// ################################################## ##########################
// ALL FUNCTIONS BELOW HERE REQUIRE 'canmodifyprofile' PERMISSION, SO CHECK IT


In your admincp under "Languages & Phrases" click "Phrase Manager", then click "Add new Phrase". Add the following phrase:

Varname: can_edit_profile
Text: Can edit Profile?

Then to lock a member from editing his profile you would just click user options and set can edit profile to "no".

Lugnut
05-19-2004, 09:50 PM
Thank you, thank you, thank you. I've been looking for something like this, but the closest thing I found was a hack that changed way too many things I didn't need changed.

Boofo
05-19-2004, 09:57 PM
I have alos added to this to make a link in the memberinfo for locking and unlocking each user's profile. And also added the safety check for the Super Admin user so no one can change his (or her) profile. The link only shows up to Admins.