How would I hook into `clear_auth_cookie` to return the user’s ID that’s currently being logged out?

That action doesn’t pass that data: function return_user_data_on_logout( $user ) { Here, $user will alway be undefined. Additionally, you need to tell add_action how many parameters the function takes. But.. do_action( ‘clear_auth_cookie’ ); No information is passed to begin with, that’s not how this particular event/action works. So how do we get the current user … Read more

Hook to change Logout url

There’s no need to regenerate the logout URL (the $logout_url part in your code) because the first parameter passed to your function is already the logout URL. So basically, just rename that $force_reauth to $logout_url and remove the $logout_url = wp_nonce_url( … );: function my_custom_logout_url($logout_url, $redirect=null){ // rename the $force_reauth // And remove this: //$logout_url … Read more

Logout redirects to /forums/

I discovered the Hikari Hooks Troubleshooter (http://hikari.ws/hooks-troubleshooter/) this weekend to find what plugins were loading my header with competing open graph metadata. Enable it, and visit the frontend. There will be a modal dialog over your site which should list the hooks into wp_logout. One of these will be the offending plugin. If you’re still … Read more

Logout using link (without nonce)

This will disable nonce checking for logging out – on your head be it: add_action( ‘login_form_logout’, function () { $user = wp_get_current_user(); wp_logout(); if ( ! empty( $_REQUEST[‘redirect_to’] ) ) { $redirect_to = $requested_redirect_to = $_REQUEST[‘redirect_to’]; } else { $redirect_to = ‘wp-login.php?loggedout=true’; $requested_redirect_to = ”; } /** * Filters the log out redirect URL. * … Read more

Force logout ALL users at a certain time

This should be possible, WordPress provides the WP_Session_Tokens class to manage logged in sessions. Then it’s just a matter of connecting it to the cron. The following is a simple plugin file which I think should do it. Add it to the plugins directory and it should start working. *not tested. <?php /* Plugin Name: … Read more

Deleting cookie to logout

You can log out the current user with wp_logout() function: I think it is much better approach. wp_logout() destroys current session, clears authorization cookie and call wp_logout action. Also, it is a pluggable function, which means can be redefined by plugins. You can miss important stuff, specially when working in combination with other plugins. If … Read more

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