WPFront
  • Home
  • Plugins
    • Notification Bar Plugin
      • Plugin Ideas
      • Plugin Settings
      • Plugin FAQ
    • Scroll Top Plugin
      • Plugin Settings
      • Plugin FAQ
    • User Role Editor Plugin
      • Plugin Documentation
      • Plugin Settings
      • Plugin FAQ
    • Paddle Gateway Plugin
  • Go Pro
  • Support
    • Documentation
    • FAQ
  • Affiliates
  • Contact
  • Login
  • Cart
  • This topic has 12 replies, 2 voices, and was last updated 9 years, 2 months ago by Syam Mohan.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • February 16, 2016 at 1:54 am #24546
    Joseph Jordan
    Participant

    Hello!

    I just purchased the pro version of this plugin and enabled content permission on custom post types. The plugin is working on articles that I set to a locked roll (it redirects to a 404).

    However, I use a plugin at the moment called Heroic Knowledgebase which stores “articles” instead of documents, among other things. Even though articles are locked, their titles and excerpts are still displaying.

    I’ve used another membership-plugin and was able to get this worked (hiding the displayed articles when viewing the custom category view, or searching) by wrapping these unique template pages with a <php if members_can_current_user_view_post ?> title here </php endif ?> style tag.

    Is there anything like this for this plugin that I can accomplish the same thing? I need to be able to hide post titles from this taxonomy that this theme is using, but I don’t know of a way to accomplish that aside from adding these special “elimination” tags wherever it’s displayed.

    Thank you!

    February 16, 2016 at 2:51 am #24550
    Joseph Jordan
    Participant

    Apologies for the spelling errors above!

    Just to elaborate- we don’t have a paid/public role structure, otherwise something like:
    < ?php echo do_shortcode('[paid_read_more]Read More[/paid_read_more]'); ?>
    would work.

    We have a membership role for each dept. Example: HR dept can view HR pages. IT dept can view IT pages, etc. So it will literally need to check if the “title” as our template stores them is a visible post type based on that user’s permissions.

    Any idea on how to accomplish this? Thank you!

    February 16, 2016 at 10:37 am #24576
    Syam Mohan
    Keymaster

    Hi Joseph,

    I don’t think I really understand the issue. Extended Permissions works on WordPress core wp_posts. As long as the “articles” are posts, it should be working the same.

    Is it possible for you to send me a link to one of those pages so that I can see how it looks?

    Thanks

    Syam

    February 16, 2016 at 9:14 pm #24596
    Joseph Jordan
    Participant
    This reply has been marked as private.
    February 17, 2016 at 12:30 pm #24659
    Syam Mohan
    Keymaster

    Hi Joseph,

    I don’t think we were on the same page earlier. When you mentioned ‘title’ I was thinking about page title, which displays on the browser.

    Now I understand what the actual issue is.

    Do you know how the theme’s hierarchical/category view is created? Is that something you have to manually type/create or does the theme create it from the available posts?

    Does the theme store it every time a post is created then recreate it from the stored information or does it search the posts and create it every time that page is requested?

    Does a shortcode will do any help?

    Thanks

    Syam

    February 18, 2016 at 12:01 am #24704
    Joseph Jordan
    Participant
    This reply has been marked as private.
    February 19, 2016 at 2:16 am #24777
    Joseph Jordan
    Participant

    I may be close to a solution…

    When wrapping the incorrectly displaying locked pages with:

       <?php if (current_user_can('edit_nav_menu_permissions')) : ?>
                <?php hkb_get_template_part('hkb-content-article'); ?>
                <?php the_excerpt(); ?>
    
    <?php else :?>
    Denied.
    <?php endif; ?>

    The menu shows “Denied” if the user cannot edit nav menu permissions. Obviously we don’t want to deny on this, but we want to deny on whether or not that user’s role is denied within the post.

    Am I on the right track? If so, what should I be using instead of “Edit nav menu permissions”?

    Thank you!

    February 19, 2016 at 3:05 am #24781
    Joseph Jordan
    Participant

    I was wrong – I just noticed that “current_user_can” is a function of WordPress, not of User Role Editor.

    Hopefully that will explain what I need though –

    Basically I need a check of “IF “current user can” -> “view posts as defined by the role permission of each post” THEN “View hkb-content-article” ELSE “hide the post”.

    February 19, 2016 at 4:11 am #24814
    Joseph Jordan
    Participant

    Final followup question – if it’s not a good idea to add this tag into the template, is there a way I can add this custom post type to the roles plugin so it will correctly block the title?

    February 20, 2016 at 1:26 pm #24896
    Syam Mohan
    Keymaster

    Hi Joseph,

    User Role Editor works using the built-in action/filter hooks available in WordPress core. Extended Permissions works based on the where clause available in the query class.

    So if the plugin doesn’t call these filters while getting these posts from DB, then the extended permissions won’t work.

    Its not possible to modify the behavior of their code through this plugin. So if you can edit the template that will be better.

    If you are modifying the template then you don’t have to worry about the extended permission setting. Instead you can code everything right there.

    For example you will be able to check whether a user belongs to the ‘Editor’ role like this.

    if(current_user_can('editor')) {
    
    }
    

    I hope this helps.

    Thanks

    Syam

    February 20, 2016 at 2:16 pm #24900
    Joseph Jordan
    Participant

    Hello Syam,

    We would specifically want to take the current check:

    if(current_user_can('editor')) {
    
    }

    and make it something like “if current user has permission by how the permissions were selected in the article, then they can see the post”.

    something like (if(current_user_can(‘read’)). But this meaning that the current user can only see those posts and article titles and article excerpts that were given permission.

    Thank you,

    February 20, 2016 at 2:18 pm #24901
    Joseph Jordan
    Participant
    This reply has been marked as private.
    February 21, 2016 at 8:54 am #24943
    Syam Mohan
    Keymaster

    Hi Joseph,

    I totally understand the issue. But there isn’t an easy way to consume the permission data. You could try to read it directly from the DB. That won’t be a full proof method through.

    Thanks

    Syam

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Hide hidden/locked pages from custom theme category page’ is closed to new replies.
Log In
Lost Password

Search Topics

Documentation

FAQ
Roles List Add Role Edit Role Delete Role Restore Role Add or Remove Capability Assign/Migrate Users Posts/Pages Extended Permissions Custom Post Type Permissions Navigation Menu Permissions Widget Permissions Admin Menu Editor Media/Attachment File Permissions User Level Permissions Content Restriction Shortcodes Login Redirect Export Roles Import Roles Bulk Edit Settings Multisite Roles List Multisite Add New Role Multisite Edit Role Multisite Delete Role Multisite Restore Role Multisite Sync Roles Multisite Settings WordPress Capabilities Actions and Filters Installation Instructions