Wait ajax to complete before continue loop

I’ve modified my codes based on Jory Hogeveen comments, and it solved my problem. What I do is, to not using the regular loop but instead use a recursive function that calls itself after it finishes calling for the request. For those who are looking for the same answer, please see below. var users_info = … Read more

Allow admins to login as other users

You’ll need to find out what specific capabilities Admin users are missing. Once you know the full list, you can use add_cap() to add those capabilities to the Admin users and enable them to do whatever the other roles are doing. From Shold I manually add ‘cap’ to admin role ? – $role = get_role( … Read more

Hide menu item when users are logged in/out

I should suggest a custom walker to, not that hard at all. starting with: https://developer.wordpress.org/reference/functions/wp_get_nav_menu_items/ in the foreach loop you are able to check based on title. in this part you will use: https://developer.wordpress.org/reference/functions/is_user_logged_in/ foreach($nav_items as $item): if($item->title == ‘Register’): if(is_user_logged_in()): //Do your thing when logged in else: //Do your thing when not logged in … Read more

Is it possible to access plugin data from a custom feed template?

The solution, for anyone else interested, was to clear cookies and the cache: clean_user_cache($current_user->ID); wp_clear_auth_cookie(); wp_set_current_user($current_user->ID); wp_set_auth_cookie($current_user->ID, true, false); update_user_caches($current_user); if( current_user_can( ‘mepr-active’, ‘memberships:1,2’ ) ) { echo ‘Hi ‘ . $current_user->user_login . ‘! You are a member’; } else { echo ‘Hi ‘ . $current_user->user_login . ‘! You <strong>not</strong> a member’; }

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

Filter to wp_list_authors

wp_list_authors(), displays a list of the sites’s authors (users), and if the user has authored any posts, the author name is displayed as a link to their posts. Use $authors = get_users( [ ‘role__in’ => [ ‘auther’] ], // add other parameters ); Then loop through $authors to create your own list. foreach ( $authors … Read more