Change WordPress user roles and capabilities Forums How to or FAQ Post Restriction not working unless refresh browser on Pages

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6743
    edering
    Participant

    Hi Vladimir. While working with Oasis Workflow on https://iu13org.kinsta.cloud/, we noticed an issue with the Restrictions. If you switch to the user called “icomm”, you will see the issue. It is a Program Editor, and is set to be able to see only one Page (a page called Demo). using Post ID Restrictions. When I got to Pages, it shows all Pages. If I refresh my browser, it works and I only see Demo. Oasis Workflow is seeing this too. They removed their plugin, but it still does not work so it does not seem to be a conflict with them. The host said there is no caching while logged in. We still have your Admin account setup. Can you help please?

    #6744
    Vladimir
    Keymaster

    Hi Erik,

    I reproduced the described issue. I will try to find a reason.

    #6745
    Vladimir
    Keymaster

    It seems I fixed the issue. Make another test and share the result.

    The reason was at the filtering code from functions.php:

    
    $ag = get_field('analytics_group_name','user_' . $current_user->ID);
    if ( !isset( $ag ) ) {
         return '';
    }
    

    get_field() may return ”, and !isset() check was wrong in the such case. I replaced !isset() with empty():

    
    if ( empty( $ag ) ) {
        return '';
    }
    

    and ‘Pages’ started to open with the single page only.

    #6746
    edering
    Participant

    Thanks, that worked!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.