Support » Plugin: Press Permit Core » Acces response forum

  • Resolved Lampre

    (@lampre)



    Hi,

    I have acount and valid key in your website.
    But i can’t read responses in you forum :-/

    I want to know how to check, in template file, if the post have restricted acces or not.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Kevin Behrens

    (@kevinb)

    Are you logged into the plugin site? When I log in with you account, the member forums are readable.

    Regarding your template check, do you need to know if the post is restricted from the current user, or for any users?

    Hi Kevin,

    Just for the current user.
    In the template post or page, if we don’t have any restriction, i want to display specific shortcode.
    If we have one or more restrictions, i dont want to display my speficic shortcode.

    I will test for access to the forum

    Hello….. ๐Ÿ™‚

    Plugin Author Kevin Behrens

    (@kevinb)

    I’m still not sure what you have in mind by “one or more restrictions” for the current user on the current post. Would this be, for example, a Reading Exception on the post which would normally prevent the user from accessing it at all? You instead want it to leave the page readable but affect the behavior of your shortcode? Or is the user unrestricted for reading but you want to limit the shortcode display if they have an editing exception on the page? I need a specific case to answer.

    Hello Kevin,

    I think its very simple for you ๐Ÿ™‚

    Configuration, 15 users at this time, 15 groups (1 user in each group)
    1 post for each group > donโ€™t want shortcode
    5 posts for all groups > donโ€™t want shortcode
    5 posts for everyone.. in this world > we want the shortcode

    I think we must add fucntion, in the template post file, for check if we have resctriction or not …

    Plugin Author Kevin Behrens

    (@kevinb)

    I still don’t understand the shortcode display logic you are looking for, but will take another stab at it. Are you saying that if the page has any exceptions set for any user or group, you want the current user to see the shortcode?

    If the page/post has one or more exceptions for at least one user or group, the current user can’t see the shortocde.

    My shortcode is sharing bar (google+, linkedIn,Facebook)
    if my page can not be read by everyone, share links have no interest , and so I do not want to display it

    Thanks Kevin

    Plugin Author Kevin Behrens

    (@kevinb)

    global $post;
    $arr = ppc_get_exceptions( array( 'operations' => 'read', 'for_item_source' => 'post', 'item_id' => $post->ID, 'assign_for' => 'item', 'return_raw_results' => true ) );
    
    if ( ! empty( $arr ) ) {
       // show stuff
    }

    Note that this only covers reading exceptions assigned directly to the page. To check for exceptions assigned to post terms, you would need to retrieve those terms and then make additional ppc_get_exceptions() calls with via_item_source = ‘term’ and ‘item_id’ = $term->term_taxonomy_id

    • This reply was modified 1 year, 1 month ago by  Kevin Behrens.

    Thanks !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ๐Ÿ™‚

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Acces response forum’ is closed to new replies.