Cannot Update user meta in custom field

Welcome, either use edit_user_profile_update which is passed user_id add_action(‘edit_user_profile_update’, ‘save_extra_fields_country_institution_user_form’ ); function save_extra_fields_country_institution_user_form($user_id){ # again do this only if you can if(!current_user_can(‘manage_options’) || !current_user_can( ‘edit_user’ )) return false; # save my custom field $result = update_user_meta($user_id, ‘verifier_assign_country’, ‘test3′); } OR when I tested on ‘edit_user_profile’, the whole user object is being passed, not just the … Read more

Displaying user data within ACF relational field (user type)

You don’t actually need to call get_userdata(), all the data you need should be in the relational field array: EDIT: Add post ID and User ID to calls to get_field(). <?php $posts = get_sub_field(‘who_to_show’); if( $posts ): ?> <?php foreach( $posts as $post): setup_postdata($post); $user_info = get_field( ‘relational_user_field’, $post->ID ); $image = get_the_field(‘author_image’, ‘user_’.$user_info->ID ); … Read more

If logged in user views his profile page

You can make use of the get_current_user_id(), get_the_author_meta(‘ID’), and get_edit_user_link() functions. Take the below snippet for instance: if( get_current_user_id() === get_the_author_meta(‘ID’) ){ printf( ‘<a href=”https://wordpress.stackexchange.com/questions/314019/%s”>Edit Profile</a>’, get_edit_user_link() ); } get_current_user_id() will return int(0) if nobody is logged in, or the integer ID of the current user. This effectively removes the need for is_user_logged_in(). get_the_author_meta(‘ID’) will … Read more

Getting different user data depending on where I use variable

I’ve only seen some parts of your code, but I guess I know where the problem lies… If this is what you’re printing in the loop: <script type=”text/javascript”> jQuery(document).ready(function($) { $(‘.callback’).val(‘<?php echo $user->first_name; ?> <?php echo $user->last_name; ?>’); }); </script> <?php echo do_shortcode( ‘[contact-form-7 id=”12345″]’ ); ?> And you want to output multiple forms on … Read more

How to exclude posts for current user

I’m not entirely sure what the problem is, because you’ve already mentioned all the tools that you need to solve it… Just use pre_get_posts filter, check if the user is logged in, get the IDs of posts he should not see and exclude them in query: function remove_some_posts_for_user( $query ) { if ( ! is_admin() … Read more

Send admin new order email to logged in user as well

What you have makes sense, except that your variable names dont match. You have $object in your function definition and in the function code you are trying to use $order. Adjusted: /* SEND ADMIN E-MAIL TO LOGGED IN USER */ /* — */ add_filter( ‘woocommerce_email_recipient_new_order’, ‘your_email_recipient_filter_function’, 10, 2); /* Add parents e-mail address to new … Read more

get_user_meta() in multiste with respect to subdomain

You could catch and store the data separately on a per blog basis by filtering the user meta update call, via the update_user_metadata filter… function myplugin_init() { add_filter( ‘update_user_metadata’, ‘myplugin_update_points’, 10, 5 ); } function myplugin_update_points( $null, $object_id, $meta_key, $meta_value, $prev_value ) { if ($meta_key == ‘qa_point’) { remove_filter( ‘update_user_metadata’, ‘myplugin_update_points’, 10, 5 ); global … Read more