wp_usermeta – Read from database, but save function broken

You have not provided the whole code so don’t understand where you are wrong, this script is working fine for me. add_action( ‘personal_options_update’, ‘save_extra_profile_fields’ ); add_action( ‘edit_user_profile_update’, ‘save_extra_profile_fields’ ); function save_extra_profile_fields( $user_id ) { if ( current_user_can(‘edit_user’,$user_id) ) update_user_meta($user_id, ‘uidnumber’, sanitize_text_field($_POST[‘uidnumber’])); } add_action(‘show_user_profile’, ‘show_extra_profile_fields’); add_action(‘edit_user_profile’, ‘show_extra_profile_fields’); function show_extra_profile_fields( $user ) { ?> <p class=”form-row form-row-wide”> … Read more

Buddypress avatar image in database [closed]

BuddyPress does not store the avatar path in the database. It loads avatars using the directory path – usually …/wp-content/uploads/avatars/. For example, the full sized avatar for a member might be …/wp-content/uploads/avatars/1/ef1e70a512662ea4fdca5b2efb6f76ab-bpfull.jpg where 1 is the user_id. Check your BP installation to find the exact path to the avatars.

Updating user meta on save post

You could query all the authors and loop through to update their dates. The below query pulls all users who have a programme_id of the current post_id and allocates an array of their IDs. You can then loop through to update whatever is necessary: /** Save Custom Metaboxes **/ function save_custom_meta_boxes( $post_id, $post ) { … Read more

Show global Message in User Profiles with admin only Input field in WordPress Backend

You just need to move the capability check “inwards”: function wpse_230369_quote_of_the_day( $user ) { $quote = esc_attr( get_option( ‘quote_of_the_day’ ) ); ?> <div class=”visible-only-for-admin”> <h3>Quote of the Day Input Field</h3> <table class=”form-table” > <tr> <th><label for=”quote_of_the_day”>Quote of the Day</label></th> <td> <?php if ( current_user_can( ‘administrator’ ) ) : ?> <input type=”text” name=”quote_of_the_day” value=”<?php echo $quote … Read more

wordpress meta value compare between two date

After some research on wp codex I found my solution. Here I have to change birth_date format during save. I saved value like yy-mm-dd this format and changed my meta_query Here is the code $studentdata = get_users( array( ‘meta_query’=> array( array( ‘key’ => ‘birth_date’, ‘value’ => array( $startyear.’-01-01′,$endyear.’-12-31′), ‘compare’ => ‘BETWEEN’, ) ), ‘role’=>’student’ ) … Read more

How to update user profile custom fields

I use update_user_meta to update the fields. You can add this in functions.php of your child theme. function save_extra_user_profile_fields( $user_id ) { if ( !current_user_can( ‘edit_user’, $user_id ) ) { return false; } update_user_meta( $user_id, ‘telephone’, $_POST[‘telephone’] ); } add_action( ‘personal_options_update’, ‘save_extra_user_profile_fields’ ); add_action( ‘edit_user_profile_update’, ‘save_extra_user_profile_fields’ );