Display custom image field in user profile

Check out the documentation for ACF image fields: https://www.advancedcustomfields.com/resources/image/ When you use get_field on an image field, it looks like it returns the ID for the image, not a URL. This might have been different in a previous version of ACF. I think something like this might work: $image = get_field(‘user_avatar’, $user->ID’); $size=”full”; // (thumbnail, … Read more

Auto copy value from specific user meta field to another field

You can simply hook function to sync phone number field as following; <?php // HOOK ON REGISTERING NEW USER/CUSTOMER add_action(‘user_register’, ‘mm_sync_phone_number’ , 20, 1); // HOOK ON PERSONAL OPTIONS UPDATE add_action(‘personal_options_update’, ‘mm_sync_phone_number’ , 20, 1); // HOOK ON USER PROFILE UPDATE add_action(‘edit_user_profile_update’,’mm_sync_phone_number’ , 20, 1); function mm_sync_phone_number( $user_id ) { // GET PHONE NUMBER FROM … Read more

Existing user_meta fields not updated

You can’t change some user meta fields using edit_user_profile_update hook, because it is triggered before processing data from the form. So, you save user’s meta to database, then edit form is processed and WP overrides your values. This hook is triggered after each profile edit. You should use insert_user_meta filter (available since WP v4.4) to … Read more

Updating WooCommerce product field when product author updates profile field

So combined with that code for setting the value before it’s inserted in the db, you also need to add this code to add the post ID to an array stored in the user’s meta (after it has been updated): add_action( ‘wp_insert_post’, ‘smyles_update_user_products’, 10, 3 ); function smyles_update_user_products( $post_ID, $post, $update ) { if ( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)