• Resolved ritchiehosein

    (@ritchiehosein)


    A notice is thrown on the top of the page…

    Notice: Undefined index: wp-postpass_4a5ad001f6dce197cb93782aa9259f50 in /home/rithos/chemonline.info/wp-content/plugins/protect-the-children/index.php on line 57

    not sure what I did wrong or is it a cookie problem.

    Ritchie

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Matt Miller

    (@millermedianow)

    Did the site URL recently change on your site? If so, you will need to clear your cache. This encoded string at the end of wp-postpass_ is actually the COOKIEHASH constant so by clearing the cache/cookies on either your personal session or the website, it should clear up the problem. Are you running any sort of hard caching on the site?

    Natacha

    (@chickwithbob)

    Hello,

    I am getting this issue as well. It is not an issue with clearing cookies.

    Here are the steps to reproduce:
    1. Set up a parent page
    2. Set up a child page
    3. Set the Visibility option on the parent, tick the checkbox to mark all children protected
    4. Now visit the child page, but ensure you have debug mode set to on:

    define('WP_DEBUG', true);

    If no cookie has been set, the error gets thrown.

    Looking at your code @ line 57

    
    $hash = wp_unslash( $_COOKIE['wp-postpass_' . COOKIEHASH] );

    The issue lies with checking for the value of $_COOKIE

    $_COOKIE['wp-postpass_'.COOKIEHASH]

    without first checking if it has been set.

    ie. something like

    $cookie_val = (isset($_COOKIE['wp-postpass_'.COOKIEHASH])) ? $_COOKIE['wp-postpass_'.COOKIEHASH] : '';

    This is untested, but you get my drift.
    Would be awesome to see this fixed as it is throwing errors on all sites that have debug errors set to visible.

    Perfect little plugin other than this issue.

    • This reply was modified 4 years, 4 months ago by Natacha.
    Plugin Author Matt Miller

    (@millermedianow)

    @chickwithbob Thanks for the detailed breakdown. Will definitely look into this and get a fix out with the next version.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Undefined index Notice’ is closed to new replies.