• Resolved breynolds

    (@breynolds)


    I have shortcode to display content to logged in users using the is_user_logged_in() function. When a logged in user visits this page they are logged out and not recognized as ever logging in. I disable the plugin to indentitfy this was the plugin causing the error. I also disabled the cookies in the plugin. It seems that this cookie is causing the problem: “wfwaf-authcookie-“. Am I on the right track or is this caused by some other validation check?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @breynolds
    I did a quick test with this code snippet inserted in a page template, and I can see the function is working fine with “wfwaf-authcookie”, so I think you may need to double check your code or it could be other unrelated issue.

    Thanks.

    Thread Starter breynolds

    (@breynolds)

    Understood and I my users show logged in except on this one page with the particular section. The pages acts as expected when Wordfence is disabled. I am using Shortcodes Ultimate and the shortcode for users only. I also tried some other code in the functions file and got the same result. The code base is:

    add_shortcode( 'user', 'user_check_shortcode' );
    
    function user_check_shortcode( $atts, $content = null ) {
    	 if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
    		return $content;
    	return '';
    }
    [user]
    
    This is members-only content.
    
    [/user]
    • This reply was modified 7 years, 10 months ago by breynolds.

    I used the same code snippet you shared and I got it working on a test page I created, this was tested on the default WordPress theme with the latest version of Wordfence installed, I think there is something badly configured on your environment, I would suspect any plugin with login/redirection functions.

    Thanks.

    Thread Starter breynolds

    (@breynolds)

    Thanks for checking. You helped me to check an item off the list.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conflict with is_user_logged_in()’ is closed to new replies.