0

I use the Entity Registration module and I created a registration form for specific events in a Drupal 7 site. For the registered users, the fields are name, surname, birth date, upload administrative files etc.

Is there a way for administrators to have specific fields they can fill and that are not available to registered users?

2
  • you can use markup fields in form,can you tell me which fields type admin can only fill
    – user52318
    Apr 3, 2019 at 13:29
  • An admin can add a checkbox for telling participant was present or not to the event ...
    – davidvera
    Apr 3, 2019 at 15:34

1 Answer 1

0

You could use hook_form_alter to accomplish this

yourmodule_regform_alter($form, $form_state) {
    global $user;
    if($user->uid!=<whatever>) {
        unset($form['field_attended'];
    }
}

If you want to use permissions, you could create your own with hook_permission

function administer_attendee_permission() {
    return array('set attendee status' => array(
      'title' => t('Set status for event attendees'),
      'description' => t('Set the status for event attendees'),
     );
}

Then your form alter changes to

yourmodule_regform_alter($form, $form_state) {
    if(!user_access('set attendee status') {
        unset($form['field_attended'];
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.