I am developing a custom plugin on a multisite installation that, unfortunately, I am not so use to work with.
Tis is the problem: I need to add a field into che profile page of a user and I need that the value that will be insertered is going to be stored as user meta and also as option (inside the wp_options table).
Everything works fine if I am the Super Admin, the option will be stored and I can use them later in my theme, but when I try to store the values with the update_option()
function I am not able to do it and I cannot store the values.
Here you can find my experimenting code but please notice that even if I have no problem with the function update_usermeta()
I can't store my info in the wp_options table...
function ohw_update_field( $user_id ){
$field = 'side_banner_' . $user_id;
$side_ad = $_POST[ $name ];
update_usermeta( $user_id, $name, $side_ad );
update_option( $name, $side_ad );
}
add_action( 'personal_options_update', 'ohw_update_field' );
add_action( 'edit_user_profile_update', 'ohw_update_field' );
As you can see I am trying to use the $user_id
in order to create an unique field in the table, probably I'll start to use an array to serialize the information in an unique field but I would like to understand why the admin of a site of the network is not able to save an option...
I mean, as I read on the Codex a user should have the manage_options
capability in order to access this database, so why is only the super admin the one who's able to do it?
Thank you in advance for all the answers and have a great day!