Support » Plugin: User Meta Manager » Restrict based on multiple meta keys

  • Resolved bengrech


    Would like to restrict content with shortcodes based on mutliple meta keys. Have added some additional fields to the user and would like to AND 3 fields where content would be displayed only if meta value 1 = X and meta value 2 = Y and current date <= meta value 3 (date).

    Any pointers on how this can be done please?

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


    You can find a complete list of short codes by clicking on the contextual help tab (User Meta Manager Help & Settings) in the upper-right corner of the plugin’s main screen.

    Here is an excerpt –

    Restrict access based on multiple meta keys and values:

    [useraccess json='{“access_level”:”gold”,”sub_level”:”silver”}’ message=”You need permission to view this content.”]Restricted content.[/useraccess]

    The json attribute is used to define a list of meta keys and values. The list must be JSON encoded, as seen in the example above. Users with matching meta keys and values will be granted access to restricted content.

    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”}’

    Let me know if you have any problems using it.

Viewing 1 replies (of 1 total)
  • The topic ‘Restrict based on multiple meta keys’ is closed to new replies.