WordPress.org

Support

Support » Plugins and Hacks » User Meta Manager » [Resolved] [Plugin: User Meta Manager] Multiple Meta Values for Restriction

[Resolved] [Plugin: User Meta Manager] Multiple Meta Values for Restriction

  • I am invisioning using this plugin for a group of users. Let’ say those users all have a custom user meta key of ‘company’ with various companies that can be added.

    If I was to restrict access to content based on the company key -> value pair, how would I set it up so multiple companies could access the same content. Can you pass multiple values into the shortcode?

    Thanks in advance for your help, would love to see if this approach may work.

    http://wordpress.org/extend/plugins/user-meta-manager/

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

    @jason-lau

    Hi,

    Currently, you can only use multiple user ids.
    [useraccess users="1 22 301" message="You do not have permission to view this content."]Restricted content.[/useraccess]

    I will change this in the next version so you can add multiple meta values.

    In the meantime, if you group the companies based upon their level of access, you would not need multiple values.

    For example:

    • access_levels
      • gold
        • Company 1
        • Company 2
        • Company 3
      • silver
        • Company 4
        • Company 5
        • Company 6
      • bronze
        • Company 7
        • Company 8
        • Company 9

    [useraccess key="access_levels" value="gold" message="You do not have permission to view this content."]Content for gold companies.[/useraccess]

    Plugin Author President McCheese

    @jason-lau

    Hi,

    Version 1.5.3 allows you to list multiple meta keys and values in the json attribute. The list must be properly JSON encoded as seen below.

    [useraccess json='{"access_level":"gold","sub_level":"silver"}' message="You do not have permission to view this content."]Restricted content goes here.[/useraccess]

    The new json attribute –
    json='{"access_level":"gold", "sub_level":"silver"}'

    JSON formatting –
    {"meta_key":"meta_value", "meta_key":"meta_value", "meta_key":"meta_value"}

    Additionally, you could repeat the same meta key multiple times.
    json='{"access_level":"gold", "sub_level":"silver", "sub_level":"bronze", "sub_level":"aluminum-foil"}'

    Hope that helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] [Plugin: User Meta Manager] Multiple Meta Values for Restriction’ is closed to new replies.
Skip to toolbar