Support » Plugin: Password Protected » change cookie name

  • Hello. Thanks a milliion for your fantastic plugin first.
    As a heavy user I run multiple wp installations in different subfolders. Now I wonder if it is possible to change cookie Name in order to avoid occuring conflicts. (Login of one page leads to logout of the other… .)
    Sorry for my English and many thanks in advance.

Viewing 1 replies (of 1 total)
  • Plugin Author Ben Huson

    (@husobj)

    Hi

    Each sites cookie name is create is the form “{site_id}_password_protected_auth”.
    The site ID is in the form “bid_{blog_id}”.

    There is a filter password_protected_blog_id to change the blog ID which is used to create the cookie name.

    Using this filter to change the value to something unique for each site ‘may’ work.

    For example, this would append a hashed version of the site home page URL:

    function my_password_protected_blog_id( $blog_id ) {
    $blog_id .= ‘_’ . md5( home_url( ‘/’ ) );
    return $blog_id;
    }
    add_filter( ‘password_protected_blog_id’, ‘my_password_protected_blog_id’ );

    Give it a go and if it doesn’t;t work please let me know.

    Thanks

    Ben

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.