- This topic has 12 replies, 2 voices, and was last updated 8 years, 10 months ago by Syam Mohan.
-
AuthorPosts
-
February 16, 2016 at 1:54 am #24546Joseph JordanParticipant
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 #24550Joseph JordanParticipantApologies 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 #24576Syam MohanKeymasterHi 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 #24596Joseph JordanParticipantThis reply has been marked as private.February 17, 2016 at 12:30 pm #24659Syam MohanKeymasterHi 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 #24704Joseph JordanParticipantThis reply has been marked as private.February 19, 2016 at 2:16 am #24777Joseph JordanParticipantI 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 #24781Joseph JordanParticipantI 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 #24814Joseph JordanParticipantFinal 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 #24896Syam MohanKeymasterHi 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 #24900Joseph JordanParticipantHello 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 #24901Joseph JordanParticipantThis reply has been marked as private.February 21, 2016 at 8:54 am #24943Syam MohanKeymasterHi 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
-
AuthorPosts
- The topic ‘Hide hidden/locked pages from custom theme category page’ is closed to new replies.