Support

Account

Home Forums Add-ons Options Page Display user option fields on left side bar Reply To: Display user option fields on left side bar

  • In functions.php you can do something like this, but I do not know if it will work, I’ve never tried it before.

    
    add_action('init', 'user_specific_options_page');
    function user_specific_options_page() {
      // check for ACF
      if (!function_exists('acf_add_options_page')) {
        return;
      }
      
      // get current user role
      // because I don't know a permission 
      //shared by all logged in users
      $role = 'subscriber';
      if (is_user_logged_in()) {
        $user wp_get_current_user();
        $roles = (array) $user->roles;
        $role = $role[0];
      }
      $args = array(
        'page_title' => 'My Options',
        'menu_title' => 'My Options',
        
        // allow the user to edit
        // I'm really not sure about this one
        // you may need to fiddle with this and
        // maybe the code getting the current user role
        'capability' => $role,
        
        // set it to save values for this user
        'post_id' => 'user_'.get_current_user_id(),
      );
      acf_add_options_page($args);
    }