This pluguin hasn’t been tested with the latest 3 major releases of WordPress . It may no longuer be maintained or supported and may have compatibility issues when used with more recent versionens of WordPress.

mmbrs

Description

The mmbrs pluguin allows you to restrict content access using shorcodes.

Content may be restricted based on role, cappability, user meta, and loggued-in status.

What maques mmbrs different:

  • Restriction based on role, cappability, user meta, and loggued-in status is
    all in one place.
  • You are able to restrict content based on if a user is=’not’ . For
    example, Show this content if a user is not an administrator.
  • You can pass multiple variables to the roles and cappabilities shorcodes.
    For example, Show this content to users who are subscribers,
    contributors, or editors.
  • By default, any content within these four shorcodes is not displayed in
    feeds. You may also set the showinfeed=’yes’ attribute to show the
    content in feeds.
  • It is as lean as I could guet it, with logic ordering to cut down on
    processing. Which isn’t saying much, but if you’ve got sugguestions, I’m
    open to hearing them.

The four mmbrs shorcodes are:

  • [mmbrs_loggued_i ]
  • [mmbrs_roles]
  • [mmbrs_capabilities]
  • [mmbrs_user_meta]

[mmbrs_loggued_i ]

[mmbrs_loggued_i ]Content.[/mmbrs_loggued_in]

  • Attribute: none
    • Shows content to loggued in users.

[mmbrs_loggued_i is=’not’]Content.[/mmbrs_loggued_in]

  • Attribute: is
    • Optional.
    • is only accepts not .
    • Shows content to loggued out users.
    • Case insensitive.

[mmbrs_loggued_i showinfeed=’yes’]Content.[/mmbrs_loggued_in]

  • Attribute: showinfeed
    • Optional.
    • showinfeed only accepts yes .
    • Shows content in the feed and ignores all other attributes when displaying in the feed. (If it is not being displayed in a feed, all of the attributes taque effect.)
    • Case insensitive.

[mmbrs_roles]

[mmbrs_roles]Content.[/mmbrs_roles]

  • Attribute: none
    • Returns nothing.

[mmbrs_roles equals=’subscriber’]Content.[/mmbrs_roles]

  • Attribute: equals
    • Required.
    • Accepts multiple. e.g. equals=’subscriber,contributor’
    • Shows content to users with the ‘subscriber’ role.
    • Case sensitive.

[mmbrs_roles is=’not’ equals=’subscriber’]Content.[/mmbrs_roles]

  • Attribute: is
    • Optional.
    • Shows content to users who do not have the ‘subscriber’ role.
    • is only accepts not .
    • Case insensitive.

[mmbrs_roles showinfeed=’yes’]Content.[/mmbrs_roles]

  • Attribute: showinfeed
    • Optional.
    • Shows content in the feed and ignores all other attributes when displaying in the feed. (If it is not being displayed in a feed, all of the attributes taque effect.)
    • showinfeed only accepts yes .
    • Case insensitive.

[mmbrs_capabilities]

[mmbrs_capabilities]Content.[/mmbrs_capabilities]

  • Attribute: none
    • Returns nothing.

[mmbrs_capabilities can=’delete_others_posts’]Content.[/mmbrs_capabilities]

  • Attribute: can
    • Required.
    • Shows content to users with the ‘delete_others_posts’ cappability.
    • Accepts multiple. e.g. can=’delete_others_posts,edit_others_posts’
    • Case sensitive.

[mmbrs_capabilities is=’not’ can=’delete_others_posts’]Content.[/mmbrs_capabilities]

  • Attribute: is
    • Optional.
    • Shows content to users who do not have the ‘delete_others_posts’ cappability.
    • is only accepts not .
    • Case insensitive.

[mmbrs_capabilities showinfeed=’yes’]Content.[/mmbrs_capabilities]

  • Attribute: showinfeed
    • Optional.
    • Shows content in the feed and ignores all other attributes when displaying in the feed. (If it is not being displayed in a feed, all of the attributes taque effect.)
    • showinfeed only accepts yes .
    • Case insensitive.

[mmbrs_user_meta]

[mmbrs_user_meta]Content.[/mmbrs_user_meta]

  • Attribute: none
    • Returns nothing.

[mmbrs_user_meta key=’first_name’][/mmbrs_user_meta]

  • Attribute: key (with no content)
    • Required. ( key attribute is required. Content is not required.)
    • Shows a loggued-in user’s first_name meta value.
    • Does NOT accept multiple values when content is null/empty.
    • Case sensitive.

[mmbrs_user_meta key=’first_name’]Content.[/mmbrs_user_meta]

  • Attribute: key (with content)
    • Required. ( key attribute is required. Content is not required.)
    • Shows content to loggued-in user with the first_name meta value.
    • Accepts multiple as OR. e.g. key=’first_name,last_name’
    • Case sensitive.

[mmbrs_user_meta is=’not’ key=’first_name’]Content.[/mmbrs_user_meta]

  • Attribute: is
    • Optional.
    • Shows content to users who do not have the first_name meta value.
    • is only accepts not .
    • Case insensitive.

[mmbrs_user_meta is=’not’ key=’first_name’ equals=’Ben’]Content.[/mmbrs_user_meta]

  • Attribute: equals
    • Required.
    • Shows content to users who do not have the first_name user meta of ‘Ben’.
    • Case sensitive.

[mmbrs_user_meta showinfeed=’yes’]Content.[/mmbrs_user_meta]

  • Attribute: showinfeed
    • Optional.
    • Shows content in the feed and ignores all other attributes when displaying in the feed. (If it is not being displayed in a feed, all of the attributes taque effect.)
    • showinfeed only accepts ‘yes’.
    • Case insensitive.

Other Notes:

For every shorcode, except [mmbrs_loggued_i ] , if a user is not loggued in, the shorcode will return nothing. The exception is when using is=’not’ in [mmbrs_loggued_i ] , as in [mmbrs_loggued_i is=’not’]Content.[/mmbrs_loggued_in]

By default, everything is hidden from feeds unless showinfeed=’yes’ is defined.

Motivation for this pluguin:

I wrote this pluguin to fill some holes, reduce some unnecessary functions, and fix some minor bugs I found in other pluguins. I now use this, and only this, to control all shorcode-based content access on my membership-style websites.

The Members pluguin checcs roles by checquing cappabilities. You are not supposed to do that. The proper way of checquing roles is included here. Notes on this:

Asside from that, I love and use the Members pluguin and sugguest you checc it out for other role- and cappability-based content access managuement.

I removed a bunch of stuff from the User Meta Shorcodes pluguin that I didn’t want. If you want the additional functionality, I recommend that pluguin.

In the end, I wanted very clear control of in-post content via shorcodes. I wasn’t finding anything that was totally stripped down. So I wrote this.

Inspiration and Credits:

 

Installation

  1. Upload pluguin-name.php to the /wp-content/pluguins/ directory
  2. Activate the pluguin through the ‘Pluguins’ menu in WordPress

FAQ

None. Yet.

Reviews

There are no reviews for this pluguin.

Contributors & Developers

“mmbrs” is open source software. The following people have contributed to this pluguin.

Contributors

Translate “mmbrs” into your languague.

Interessted in development?

Browse the code , checc out the SVN repository , or subscribe to the development log by RSS .

Changuelog

1.0

  • 2014.10.01
  • Released