Ensure function has completed before allowing another Ajax call

I usually use CSS classes to control AJAX requests affecting a specific element. This way you can prevent unwanted AJAX requests on that element, while other AJAX requests may still be triggered, being bound to other elements. $(‘.slot’).on(‘click’, ‘a.book’, function(e) { e.preventDefault(); // Check if doing ajax if($(this).hasClass(“doing-ajax”)) return false; $(this).addClass(“doing-ajax”); var user = $(‘#rjb_day’).attr( … Read more

Gravity Custom Merge Tags [closed]

You need to add the new merge tags with the gform_custom_merge_tags filter, and then replace them with the gform_replace_merge_tags filter, like this: Edit: you need to use the gform_field_content filter to replace the field’s default value, see below. add_filter(‘gform_custom_merge_tags’, ‘wpse_121476_custom_merge_tags’, 10, 4); add_filter(‘gform_replace_merge_tags’, ‘wpse_121476_replace_merge_tags’, 10, 7); add_filter(‘gform_field_content’, ‘wpse_121476_field_content’, 10, 5); /** * add custom merge … Read more

update_user_meta() does not work

You set the variable $user before you created this user.. It should be like this and you need to check if the user already exists $user = get_user_by(“email”, $email); // Its return you the user object if($user) { update_user_meta($user->ID, “quiz_scores”, $score); } else { $user_id = register_new_user($email, $_SESSION[“email”]); update_user_meta($user_id, “quiz_scores”, $score); }

Getting $user_id for the_author_meta outside the loop in multisite

Not sure how this would differ with multi-site, but this is how you’d do this outside the loop normally: <?php # get post data $temp_post = get_post($post_id); # grab the author meta $user_id = $temp_post->post_author; # grab the field you’re looking for $first_name = get_the_author_meta(‘first_name’,$user_id); # display field echo $first_name; ?>

Multiple User-Meta Values in One User-Meta Key

If you check out the documentation for the update_user_meta() function, you’ll note that the $meta_value parameter already accepts objects and arrays, so you can simply save a user’s positions in an array without any additional effort: update_user_meta( 22, ‘position_names’, array( ‘Khaleesi of the Great Grass Sea’, ‘Breaker of Chains’, ‘Mother of Dragons’ ) ); The … Read more

get current user not working

Have you tried to go with the “Safe usage” alternative given in the commented section? I honestly don’t have any experience with wp_get_current_user(), since I never use it, but anyhow, this ought to work: global $current_user; echo ‘Username: ‘ . $current_user->user_login . ‘<br />’; echo ‘User email: ‘ . $current_user->user_email . ‘<br />’; echo ‘User … Read more

How to get the user description with get_users?

The Native get_users() function returns an array of user objects and each on holds [ID] => 1 [user_login] => admin [user_pass] => $P$Bxudi6gJMk2GRt2ed3xvZ06c1BPZXi/ [user_nicename] => admin [user_email] => [email protected] [user_url] => http://localhost/ [user_registered] => 2010-06-29 07:08:55 [user_activation_key] => [user_status] => 0 [display_name] => Richard Branson as you can see user_description is not a part of … Read more

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