How to redirect user after session timeout

You can filter the login_url: add_filter( ‘login_url’, ‘wpse103239_login_url’ ); function wpse103239_login_url() { return ‘your-login-url’; } See also this answer for a bunch more options. Reference The login_url filter is mentioned in the Codex page for wp_login_url(), but there doesn’t seem to be a Codex page for the filter itself.

how to get the top 10 popular blogs

If I understand you correctly, something like this should help you. global $wpdb; $results = $wpdb->get_results( “SELECT post_author, SUM(comment_count) as comments FROM {$wpdb->posts} WHERE post_type=”post” AND post_status=”publish” GROUP BY post_author ORDER BY comments DESC LIMIT 10″); This will return you 10 authors of most commented posts (with highest sum of comments count of each post … Read more

WP_User_Query not searching

WP_User_Query searches the $wpdb->users table. It will not join on your custom table. How would it know what to JOIN? The possible tables names and structures are practically infinite. I believe you might be able to use a filter on pre_user_query to insert your own values in the WHERE clause but there is no JOIN … Read more

Change User Role based on Point System Issue

You have to remove the previous role first, then add the new role like $u = new WP_User( $user_ID); $role_of_user= $u->roles[0]; $u->remove_role($role_of_user); $u->add_role(‘new_role’); If user has more than 1 role then $u = new WP_User( $user_ID); foreach($u->roles as $role){ $u->remove_role($role); } $u->add_role(‘new_role’);

Get user ID when action row link is clicked

I am passing the user ID as user via the link so its show in my custom list table url. For example, admin.php?page=history_logger&user=3 The user ID is in the query variable. You can access it using a PHP global variable. $_GET[‘user’] $user_id = $_GET[‘user’]; Do not assume that this request (link) came from the Users … Read more

get_comment_author_link not working properly

Simple solution drop this in your functions.php function your_get_comment_author_link () { global $comment; if ($comment->user_id == ‘0’) { if (!empty ($comment->comment_author_url)) { $url = $comment->comment_author_url; } else { $url=”#”; } } else { $url = get_author_posts_url($comment->user_id); } echo “<a href=\”” . $url . “\”>” .get_comment_author () . “</a>”; } If the user is registered this … Read more

Making WordPress available while logged into another website

The function wp_authenticate is pluggable, meaning you can override it with a function of your own of the same name. You could rewrite that to contact your “self-hosted, secure, members-only website” for logins instead of using the WordPress login system. There are other pluggable functions in that file, like wp_validate_auth_cookie, which may prove useful with … Read more