• Resolved cristoto

    (@cristoto)


    Yesterday, my snippets work without problems. But, today only work if the user is login into wordpress.

    The problem is that I need the snippets work when the user is logout.

    Can anybody help me?

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

Viewing 15 replies - 1 through 15 (of 20 total)
  • Hello.

    Did you change something on the site? Maybe you installed plugins or edited snippets? Can you show the settings of snippets?

    Thread Starter cristoto

    (@cristoto)

    Thank you for your quick answer.

    I didn’t install any new plugin, I only updated some plugins include Woody Snippets.

    I have differents snippets. I show you my login snippet.

    My snippet code

    Nothing has changed in our plugin. Try creating a simple snippet with output to the screen. And check whether it works for unauthorized users?

    Thread Starter cristoto

    (@cristoto)

    In my code some parts work fine.
    I did a echo after header function in my code, and I saw the result on the website correctly. But the header() function and setcookie aren’t working.

    These functions must be called before any output to the screen. You probably have something displayed on the screen before calling one of these functions. You can enable WordPress debugging mode and view PHP error logs

    Thread Starter cristoto

    (@cristoto)

    I haven’t any code error.

    The only change did it was update plugin. If it’s error code, the code not works with an authorized user too.

    I activated the debug mode to show errors but wordpress doesn’t show any error in my code. It’s very strange.

    I’m despereta with this problem, because our customers need it this sections to work.

    You can check into the url: https://atecresa.com/logincliente/
    User: cristo@atecresa.com
    Pass: ArPBtSJQaDdG

    The php works because the api return ok, but some part of the code not work.

    • This reply was modified 5 years, 9 months ago by cristoto.

    Enable debug mode – add these lines to the wp-config.php file:

    define( 'WP_DEBUG', true ); 
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );

    After that, try to login. Error messages will appear in the wp-content/debug.log file. Send them all here

    Thread Starter cristoto

    (@cristoto)

    The log show these messages

    [01-Jul-2020 11:24:07 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘WordPress_secret’ not found or invalid function name in /var/www/html/wp-includes/class-wp-hook.php on line 287
    [01-Jul-2020 11:24:07 UTC] PHP Notice: Undefined index: back in /var/www/html/wp-content/themes/Avada-Child-Theme/functions.php on line 18
    [01-Jul-2020 11:24:44 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘WordPress_secret’ not found or invalid function name in /var/www/html/wp-includes/class-wp-hook.php on line 287
    [01-Jul-2020 11:24:44 UTC] PHP Notice: Undefined index: back in /var/www/html/wp-content/themes/Avada-Child-Theme/functions.php on line 18
    [01-Jul-2020 11:24:44 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/wp-includes/formatting.php:5600) in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()’d code on line 2
    [01-Jul-2020 11:24:44 UTC] PHP Notice: Undefined property: stdClass::$code in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()’d code on line 6
    [01-Jul-2020 11:24:44 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/wp-includes/formatting.php:5600) in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()’d code on line 16
    [01-Jul-2020 11:24:44 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/wp-includes/formatting.php:5600) in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()’d code on line 18

    • This reply was modified 5 years, 9 months ago by cristoto.

    [01-Jul-2020 11:24:44 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-includes/formatting.php:5600) in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()'d code on line 16
    Here it says that it can’t send headers, since they have already been sent.
    Do you run PHP snippets everywhere?

    Thread Starter cristoto

    (@cristoto)

    No, I only run in a page.

    Take a screenshot of the snippet settings

    Thread Starter cristoto

    (@cristoto)

    https://ibb.co/5GtbT6g this is my settings for all snippet.

    https://ibb.co/DgfLQQC this is my plugin settings.

    Everything is clear. The header() and setcookie() functions will not work with the shortcode.
    Use Everywhere for php code in a separate snippet.

    Thread Starter cristoto

    (@cristoto)

    But before the updated the plugin, the script worked fine with this configuration.

    If I put the code eveywhere, I need filter that only run in the page “logincliente” for example. Is it possible?

    Is it possible that the problem is for this notice:
    Notice: Undefined property: stdClass::$code in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()’d code on line 10

    • This reply was modified 5 years, 9 months ago by cristoto.

    Check whether the form has been sent in the code, and only then call header() and setcookie(). The form is sent only on the authorization page.

    Is it possible that the problem is for this notice:
    Notice: Undefined property: stdClass::$code in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()’d code on line 10

    This is an error in your snippet in line 10

Viewing 15 replies - 1 through 15 (of 20 total)

The topic ‘Code not working logout’ is closed to new replies.