Support » Plugin: User Meta Manager » Page restriction based on user meta

  • Resolved dineshm89

    (@dineshm89)


    I am trying to restrict pages, based on User meta using the following code.

    [useraccess json='{“RoleMeta”:”Admin”, ” RoleMeta”:”Subscriber1″}’ message=”You need permission to view this content.”]Restricted content.[/useraccess]

    If the meta_key (RoleMeta) is either of (Admin or Subscriber1) the page should be displayed or else not.

    “Admin” is able to view the page, but “Subscriber1” is not.

    If I change the code to below, then “Admin” is restricted access:
    [useraccess json='{“RoleMeta”:”Subscriber1″, ” RoleMeta”:”Admin”}’ message=”You need permission to view this content.”]Restricted content.[/useraccess]

    I want to display the content for both of these meta_key values.
    Spent quite a lot of time, trying to figure out a way!!!!

    Help greatly appreciated.
    Thanks,
    Dinesh M

    https://wordpress.org/plugins/user-meta-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author President McCheese

    (@jason-lau)

    Hi,

    This bug should be fixed in version 3.3.8.

    Thanks for posting!

    Upgraded to 3.3.9.

    Still no luck.
    Kindly help.

    Tried below code for user with Admin access, but is not working…
    [useraccess json='{“RoleMeta”:”Subscriber1″,”RoleMeta”:”Admin”}’ message=”You need permission to view this content.”]Restricted[/useraccess]

    But,
    [useraccess json='{“RoleMeta”:”Admin”,”RoleMeta”:”Subscriber1″}’ message=”You need permission to view this content.”]Restricted[/useraccess]
    is working for RoleMeta=>Admin…

    Plugin Author President McCheese

    (@jason-lau)

    Please update to version 3.4.0, then change the format for your json code.

    [useraccess json='{"RoleMeta":"Admin"},{"RoleMeta":"Subscriber1"}' message="You need permission to view this content."]Restricted[/useraccess]

    As you can see I have enclosed each meta key/value pair in {brackets}.
    json='{"RoleMeta":"Admin"},{"RoleMeta":"Subscriber1"}'

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Page restriction based on user meta’ is closed to new replies.