edit_own_user_account_permission.module in Edit own user account permission 7
File
edit_own_user_account_permission.module
View source
<?php
function edit_own_user_account_permission_permission() {
return array(
'edit own user account' => array(
'title' => t('Edit own user account'),
'description' => t('This module add \'edit own user account\' permission.'),
),
);
}
function edit_own_user_account_permission_form_alter(&$form, &$form_state, $form_id) {
global $user;
if ($form_id == 'user_profile_form' && $user->uid == arg(1) && !user_access('edit own user account')) {
$form['account']['name']['#access'] = 0;
$form['account']['mail']['#access'] = 0;
$form['account']['current_pass']['#access'] = 0;
$form['account']['pass']['#access'] = 0;
}
}