Support » Plugin: Advanced Access Manager » Filtering access to categories is prevented by adding tags to the post

  • Resolved jroumagnac

    (@jroumagnac)


    Hello,

    I purchased the “Plus Package” and I have many troubles to make it work correctly…

    I need to hide / deny access to some categories to certain users.
    AAM is doing the job well as soon as I only have categories assigned to posts : search results, lists by author etc. are filtered correctly.

    When I add one ore more tags to the post, nothing is filtered. The post appears in lists even if its category is denied for the user.
    By adding a simple tag, it is like if I assigned a second category to my post with access open to all users.

    I need to add tags to my posts for searching purposes, but I don’t want them to interfere in access filtering.

    Am I missing something ?

    Thank you for your help

Viewing 15 replies - 1 through 15 (of 15 total)
  • Noel

    (@noelalvarez)

    hi @jroumagnac,

    Can you try to clear your cache and test your site again.

    I have tried to replicate your issue.

    Created a Post and put it under a certain category
    Then restrict a user to that category.
    —> It works

    Then I edti the post and added a Tag
    —> Still works

    Added another tag
    —> Stiill works

    then tried removing a tag
    —> still works.

    If clearing cache does not fix your issue. Try to disable some plugins that might be related to any Post function coz it is possible that a plugin or your Theme itself is using a different structure of term structure (tags and categories) that is not WP standards.

    Let me know the results.

    Thread Starter jroumagnac

    (@jroumagnac)

    <p>Hello Noel,<br />
    <br />
    Thank you for your quick answer.<br />
    <br />
    I just installed a fresh 4.9.8 WordPress on one of my servers this morning to test in a clean context.<br />
    No plugin at all except AAM + Plus Package, default theme … just a raw English WordPress.<br />
    <br />
    Here is what I did :</p>

    1. I created 2 posts categories : <b>Fruits </b>and <b>Vegetables</b>
    2. I created 6 posts : <b>Strawberry</b>, <b>Apple</b>, <b>Orange </b>associated with the<b> Fruits category</b> / <b>Potato</b>, <b>Carrot</b>, <b>Broccoli </b>associated with the <b>Vegetables </b>category
    3. I created 2 new Roles <b>fruits-sub</b> and <b>vegetables-sub</b> based on the subscriber role.
    4. I created 2 users <b>fruituser </b>(linked with <b>fruits-sub </b>role) and <b>vegetableuser </b>(linked with <b>vegetables-sub</b> role)

    <p>So you can see that it is a very basic context.</p>
    <p>My goal is to <b><span style=”color: #cc0000;”>disallow </span></b>(LIST and READ) the <b>Fruits</b> category (and its content) to any user under the <b>vegetables-sub</b> role, and vice-versa, to <b><span style=”color: #cc0000;”>disallow</span></b> the <b>Vegetables</b> category (and its content) to any user under the <b>fruits-sub</b> role.</p>
    <p>To do that, I went into AAM settings :</p>

    1. Manage Role <b>vegetable-sub</b> > <b>Post & Terms</b> > <b>Posts </b>> Manage Access to the <b>Fruits</b> category > <br />
    • Checked : Frontend Access To This Term > BROWSE
    • Checked : Frontend Access To This Term > LIST
    • Checked : Frontend Access To All Child Posts > LIST
    • Checked : Frontend Access To All Child Posts > READ
    • Manage Role <b>fruits-sub</b> > <b>Post & Terms</b> > <b>Posts </b>> Manage Access to the <b>Vegetables</b> category > <br />
    • Checked : Frontend Access To This Term > BROWSE
    • Checked : Frontend Access To This Term > LIST
    • Checked : Frontend Access To All Child Posts > LIST
    • Checked : Frontend Access To All Child Posts > READ

    <p>Finally I tested :</p>

    1. Logged in as <b>fruituser </b>: All seems OK, only posts of the <b>Fruits</b> category are shown in search results , lists, by author or recent posts.
    2. Logged in as <b>vegatableuser </b>: All seems OK too, only posts of the <b>Vegetables</b> category are shown in search results , lists, by author or recent posts.

    <p>Now, here is the weird behavior :</p>

    1. If I add a simple <b>”good” tag </b>on the <b>Potato </b>post and I log-in as the <b>fruituser </b>: “access is denied”, I can’t even see the homepage!
    2. If I remove the <b>”good” tag</b> from the <b>Potato </b>post all is back to normal

    <p>Another one with the other user (the result is strangely different) :</p>

    1. If I add a simple <b>”good” tag</b> on the <b>Strawberry </b>post and I log-in as the <b>vegetableuser </b>: access is not denied! But, I can see the Strawberry post appearing in every lists (search results , lists, by author or recent posts) though It shouldn’t be listed since I denied its category <b>Fruits </b>for any user having the <b>vegetable-sub</b> role
    2. If I remove the <b>”good” tag</b> from the <b>Strawberry</b> post all is back to normal

    <p>So my conclusion is that there is an unwanted impact by adding tags to post.<br />
    Or perhaps did I miss or misunderstood something ?</p>
    <p>Thank you for your help !</p>

    Thread Starter jroumagnac

    (@jroumagnac)

    Oups, sorry for the bad formatting … posting it again

    Thread Starter jroumagnac

    (@jroumagnac)

    Hello Noel,

    Thank you for your quick answer.

    I just installed a fresh 4.9.8 WordPress on one of my servers this morning to test in a clean context.
    No plugin at all except AAM + Plus Package, default theme … just a raw English WordPress.

    Here is what I did :

    1. I created 2 posts categories : Fruits and Vegetables
    2. I created 6 posts : Strawberry, Apple, Orange associated with the Fruits category / Potato, Carrot, Broccoli associated with the Vegetables category
    3. I created 2 new Roles fruits-sub and vegetables-sub based on the subscriber role.
    4. I created 2 users fruituser (linked with fruits-sub role) and vegetableuser (linked with vegetables-sub role)

    So you can see that it is a very basic context.

    My goal is to disallow(LIST and READ) the Fruits category (and its content) to any user under the vegetables-sub role, and vice-versa, to disallow the Vegetables category (and its content) to any user under the fruits-sub role.

    To do that, I went into AAM settings :

    1. Manage Role vegetable-sub > Post & Terms > Posts > Manage Access to the Fruits category >
    • Checked : Frontend Access To This Term > BROWSE
    • Checked : Frontend Access To This Term > LIST
    • Checked : Frontend Access To All Child Posts > LIST
    • Checked : Frontend Access To All Child Posts > READ
    • Manage Role fruits-sub > Post & Terms > Posts > Manage Access to the Vegetables category >
    • Checked : Frontend Access To This Term > BROWSE
    • Checked : Frontend Access To This Term > LIST
    • Checked : Frontend Access To All Child Posts > LIST
    • Checked : Frontend Access To All Child Posts > READ

    Finally I tested :

    1. Logged in as fruituser : All seems OK, only posts of the Fruits category are shown in search results , lists, by author or recent posts.
    2. Logged in as vegatableuser : All seems OK too, only posts of the Vegetables category are shown in search results , lists, by author or recent posts.

    Now, here is the weird behavior :

    1. If I add a simple “good” tag on the Potato post and I log-in as the fruituser : “access is denied”, I can’t even see the homepage!
    2. If I remove the “good” tag from the Potato post all is back to normal

    Another one with the other user (the result is strangely different) :

    1. If I add a simple “good” tag on the Strawberry post and I log-in as the vegetableuser : access is not denied! But, I can see the Strawberry post appearing in every lists (search results , lists, by author or recent posts) though It shouldn’t be listed since I denied its category Fruits for any user having the vegetable-sub role
    2. If I remove the “good” tag from the Strawberry post all is back to normal

    So my conclusion is that there is an unwanted impact by adding tags to post.
    Or perhaps did I miss or misunderstood something ?

    Thank you for your help !

    Noel

    (@noelalvarez)

    that is weird coz I have been trying to replicate your issue on a clean wordpress install using default wordpress theme. And everything is alright no matter how I tried to toggle with tags (add or remove) in 2 or more categories I have created for multiple posts.

    Let me investigate on this further and get back to you asap on this.

    Thread Starter jroumagnac

    (@jroumagnac)

    I can give you access (private message) to my WordPress installation if you want to have a look… maybe it can help

    I tried this on 3 different servers (Windows & Unix) and on differents versions of PHP (5.6 & 7) , the result is always the same…

    Thank you

    Plugin Author Vasyl Martyniuk

    (@vasyltech)

    @jroumagnac,

    That would be super helpful. Please submit your login info here https://aamplugin.com/support. I’m going to look into this case as I also was not able to replicate it on my server.

    Keep us updated.

    Regards,
    Vasyl

    Thread Starter jroumagnac

    (@jroumagnac)

    Hello,

    did you had a chance to look at it ?

    thank you

    Plugin Author Vasyl Martyniuk

    (@vasyltech)

    Hi @jroumagnac,

    I’ll be able to look into your case on Thursday. My time is quite limited this week.

    Regards,
    Vasyl

    Thread Starter jroumagnac

    (@jroumagnac)

    Thank you Vasyl.

    Plugin Author Vasyl Martyniuk

    (@vasyltech)

    Hi @jroumagnac,

    Just want to let you know what I was finally able to replicate the issue. Thank you for sharing credentials with me.

    Currently identifying the root cause and hopefully will come up with some sort of solution.

    I’ll keep you updated.

    Regards,
    Vasyl

    Plugin Author Vasyl Martyniuk

    (@vasyltech)

    Hi @jroumagnac,

    I was able to find the root cause. The main problem is with the way WordPress stores relationship between posts and terms in the database.

    I’m not going to overload you with technical details of the relational database, however would like to emphasize that is quite complex issue. I would have to spend some time to learn more in-depth if there is even a possibility to solve it with SQL query and if not, then I’ll look into a possibility to solve it programmatically.

    I’ll keep you updated.

    Regards,
    Vasyl

    Thread Starter jroumagnac

    (@jroumagnac)

    Thank you Vasyl, that’s appreciated.

    Plugin Author Vasyl Martyniuk

    (@vasyltech)

    Hi @jroumagnac,

    I was able to figure out the solution. The new AAM Plus Package 3.8.2.2 has been released. Please confirm that it worked for you.

    Regards,
    Vasyl

    Thread Starter jroumagnac

    (@jroumagnac)

    Great Job Vasyl, it’s working!
    Very appreciated, thank you for your support.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Filtering access to categories is prevented by adding tags to the post’ is closed to new replies.