Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter cbonwp

    (@cbonwp)

    hi Umar, i have an init hook on page loads so put a session_start in there – now it all works again! There’s still a session_start within each page but it doesn’t seem to matter – maybe it’s just ignored.
    Don’t quite see at the moment why this glitch appeared.
    thanks, clive

    Thread Starter cbonwp

    (@cbonwp)

    ok, this autoload change is fixed in wordpress 4.9.8
    just original problem of session_start failing so no access to previously stored session variables

    Thread Starter cbonwp

    (@cbonwp)

    thanks for the replies, definitely not calling session_start after any page output. I’ve just re-instated the old wordpress version and the problem is there too. So suspect is host upgrade to php 7.2.
    Got this message in log file
    [22-Nov-2018 10:57:42 UTC] PHP Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /customers/e/8/7/saliannefrenchfocus.com/httpd.www/wordpress/wp-includes/compat.php on line 502

    Will investigate later
    thanks again

    Forum: Hacks
    In reply to: $_SESSION access on logout
    Thread Starter cbonwp

    (@cbonwp)

    sorry – bit late replying

    I’ve decided to bypass the problem for the moment.
    Yes, maybe use a cookie.

    Anyway, it’s a pity the user context has been lost. Surely that should happen in wp_logout not before and it could be possible to hook into the add_action chain to run prior to wp_logout execution to allow final housekeeping.

    Also, I notice that after logging out but not closing the browser window if a user re-visits the website they are welcomed as logged in! Not bothered by this, just amazed.

    cheers,clive

    Forum: Hacks
    In reply to: $_SESSION access on logout
    Thread Starter cbonwp

    (@cbonwp)

    hi both, thanks for the replies

    yes, add_action’s cleaner. I’ve tried it with priority 1 but the get_current_user_id call returns 0. Also re-checked using wp_validate_auth_cookie and it returned 0.

    puzzled,clive

    Forum: Hacks
    In reply to: $_SESSION access on logout
    Thread Starter cbonwp

    (@cbonwp)

    Hi bcworkz, thanks for the info

    I only need the ID of the logging-out user so I tried calling wp_validate_auth_cookie but that fails too.

    I’ve patched into the 1st line of function wp_logout before the wp_clear_auth_cookie! Code is

    $user_id = wp_validate_auth_cookie();
    if( $user_id )
    { //valid user id returned

    doesn’t look wrong or is it?
    thanks, clive

    Thread Starter cbonwp

    (@cbonwp)

    ah, thanks – the joys of a different language!

    in the meantime i gave up on the wp functions and went direct to the db using mysqli queries while making the same mistake. Interestingly, sometimes i got the right data.
    I’ve reverted to the wp functions and it now works.
    thanks, clive

Viewing 7 replies - 1 through 7 (of 7 total)