User Meta Manager
[resolved] Restrict based on multiple meta keys (2 posts)

  1. bengrech
    Posted 2 years ago #

    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?


  2. President McCheese
    Plugin Author

    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • User Meta Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.