aneuryzm
aneuryzm

Reputation: 64844

Drupal, user profiles: adding fields *only* editable by administrators

I would like to add a field to user profiles that only administrator can use and change for each user.

In other words, it should be visible in users profiles but not editable by users (only by administrators).

I cannot do it with drupal permissions, right ?

thanks

Upvotes: 1

Views: 1247

Answers (2)

Turion
Turion

Reputation: 6156

This is nearly the same question as Drupal 7 fields - only editable by specific roles - how?. Use the Field Permissions module.

Upvotes: 1

googletorp
googletorp

Reputation: 33285

With hook_form_alter you can set a permission on form fields. That way only users with the permission can edit it.

Example:

$form['example']['#access'] = user_access('permission');

Upvotes: 2

Related Questions