[wp-hackers] wp 2.5+ cookies

Matt Martz matt at sivel.net
Mon Nov 24 16:11:13 GMT 2008


On Mon, Nov 24, 2008 at 10:57 AM, Justen Fox <jrf1039 at gmail.com> wrote:
> Is there yet doucmentation for the new cookie functionality?
>
> I'm running 2.6.3 and it no longer works with the following plugin:
> http://blog.taragana.com/index.php/archive/angsumans-authenticated-wordpress-plugin-password-protection-for-your-wordpress-blog/
>
> The plugin forces user login before viewing any pages.
>
> The plugin writer has a fix for the new cookie, but they charge $30 for it.
> http://blog.taragana.com/index.php/archive/angsumans-authenticated-wordpress-plugin-password-protection-for-your-wordpress-blog/#comment-483858
>
> >From what i can tell, the old version no longer works because the WP
> cookie has changed.
>
> This is the plugin conditional:
> if ( (!empty($_COOKIE[USER_COOKIE]) &&
>                !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) ||
>        (empty($_COOKIE[USER_COOKIE])) ) {
>
>
> But, unfortunately, the codex has not been updated with the new cookie
> information.
> http://codex.wordpress.org/WordPress_Cookies
>
> Thank you.

To check if a user is logged in I usually do this:

global $user_ID;
get_currentuserinfo ();
if ( ! $user_ID ) {
         [do something if user not logged in]
}

could also be

if ( $user_ID ) {
        [do something if user logged in]
}



-- 
Matt Martz
matt at sivel.net


More information about the wp-hackers mailing list