Add Permissions to edit "admin only" Custom Profile Fields
This is regarding the SMF 2 packed in feature Custom Profile Fields
Allow other groups to edit custom profile fields set to "users can see this field, only admins can edit" WITHOUT having to add the permission "Administrate forum and database" to that group.
The 4 options available, one really leaves you limited "users can see this field, only admins can edit". For those with CPF additions, that only admins are allowed to change, but also want to give another member of staff, or another member group the permissions as well.
I've asked for this several times since I upgraded to SMF 2, and kept being told it was either impossible, or would take serious modifications to get it to work. Well, I found out how, and it's actually just a few simple modifications.Sources/ManagePersmissions
'profile_remote_avatar' => array(false, 'profile', 'use_avatar'),
'manage_cp_fields' => array(false, 'maintenance', 'administrate'),Sources/Profile-Modify.php
if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0))
if ($row['private'] != 0 && !allowedTo('manage_cp_fields') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0))Sources/Profile.php
// Get the right restrictions in place...
$where = 'active = 1';
if (!allowedTo('admin_forum') && $area != 'register')
// Get the right restrictions in place...default/languages/ManagePermissions.php
$where = 'active = 1';
if (!allowedTo('manage_cp_fields') && $area != 'register')
add anywhere in the file before ?>
$txt['permissionname_manage_cp_fields'] = 'Modify Member Custom Profile Fields';
$txt['permissionhelp_manage_cp_fields'] = 'Allows this group to modify other Members Custom Profile Fields';
There are 2 different ways this permission works for those that are added
selecting Option #1 , in the pic, just allows the member to modify their own Custom Profile Fields set to users can see this field, only admins can edit". ( this is useful if a member is in good standing and admins trust them to modify their own custom fields normally only admins are able to modify for members.
selecting both 1 & 2 , which seems best suited for staff members, will allow them to modify the custom fields on any members profile, to help with custom fields that only admins can modify for members.
Sure not many will have use for this, but the option is there for those who wanted this option as well.