In order to allow editors to edit other's author meta (update_user_attribute), I must give them the 'manage_options' capability or else I get a 'Cheatin' huh' die message. I only want to give them this capability on one specific Edit Author Meta page.
I give 'editor' permission to 'list_users' to access the Users admin table. I give 'editor' permission to 'manage_options' upon entering the specific author meta page. (I tried placing at the top of function save_profile_fields but still got the die message.)
I remove the 'manage_options' capability at the bottom of the save_profile_fields function. This works, but if the editor neglects to save anything on the author meta page, the editor keeps the 'manage_options' capability.
if( !current_user_can( 'manage_options' ) && current_user_can( 'edit_others_posts' ) ){
$edit_editor_role = get_role( 'editor' );
$edit_editor_role->add_cap( 'manage_options' );
}
Where would one remove the capability 'manage_options' from the editor role?
$edit_editor_role = get_role( 'editor' );
$edit_editor_role->remove_cap( 'manage_options' );