Support » Plugin: Ultimate Member – User Profile, User Registration, Login & Membership Plugin » Lock a dropdown field for a specific role (for nsinelnikov)

  • Resolved Lion73

    (@lion73)


    Hi nsinelnikov,
    in registration form (which assigns “patient” role) I have e dropdown to choose doctor name.
    Doctors list in drop down is retrieved from the function:

    
    function doctors_dropdown_list() {
    $users = get_users(array(
      'meta_key' => 'last_name',
      'role' => 'um_doctor',
      'orderby' => 'meta_value',
    ));
      foreach ( $users as $user ) {
          $user_names[$user->display_name] = $user->display_name;
    }
      return $user_names; 
    }
    

    then called back in the “Choices Callback” option in field, OK.

    Now…when a doctor opens a patient’s profile I would like to block the dropdown so that it cannot be changed.
    Practically prevent the “doctor” role from changing this field.
    How can I do? Do you have anything to suggest to me?
    Thanks in advance
    Lion

    • This topic was modified 1 year, 4 months ago by Lion73.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Lion73

    (@lion73)

    Nsinelnikov are you there?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @lion73

    Sorry for the late response.

    You can disable the select field in the Profile Form via UM Form Builder.

    1. Edit the Select field to show the options
    2. Uncheck the option “Can user edit this field?”

    Please feel free to re-open this thread when there’s any question that may come.

    Regards,

    Thread Starter Lion73

    (@lion73)

    Hi Champ Camba,
    That doesn’t solve my problem.
    This prevent the “doctor” role from changing this field, but the “patient” role must be able to modify this field.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Lock a dropdown field for a specific role (for nsinelnikov)’ is closed to new replies.