{"id":32072,"date":"2014-10-02T00:25:26","date_gmt":"2014-10-02T00:25:26","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/mmbrs\/"},"modified":"2014-10-02T17:24:33","modified_gmt":"2014-10-02T17:24:33","slug":"mmbrs","status":"publish","type":"plugin","link":"https:\/\/pcd.wordpress.org\/plugins\/mmbrs\/","author":12669265,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0","stable_tag":"trunk","tested":"4.0.38","requires":"3.3","requires_php":"","requires_plugins":"","header_name":"mmbrs","header_author":"Ben Wills","header_description":"","assets_banners_color":"","last_updated":"2014-10-02 17:24:33","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/compassionate.co\/","header_plugin_uri":"http:\/\/compassionate.co\/mmbrs","header_author_uri":"http:\/\/compassionate.co\/","rating":5,"author_block_rating":0,"active_installs":10,"downloads":1505,"num_ratings":1,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"":"<p>None.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"1"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1911,1913,4436,43641,81],"plugin_category":[43,58],"plugin_contributors":[96191],"plugin_business_model":[],"class_list":["post-32072","plugin","type-plugin","status-publish","hentry","plugin_tags-access","plugin_tags-capabilities","plugin_tags-capability","plugin_tags-content-access","plugin_tags-member","plugin_category-customization","plugin_category-user-management","plugin_contributors-benwills","plugin_committers-benwills"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/mmbrs.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>The mmbrs plugin allows you to restrict content access using shortcodes.<\/p>\n\n<p>Content may be restricted based on role, capability, user meta, and logged-in status.<\/p>\n\n<h3>What makes mmbrs different:<\/h3>\n\n<ul>\n<li>Restriction based on role, capability, user meta, and logged-in status is\nall in one place.<\/li>\n<li>You are able to restrict content based on if a user <strong>is='not'<\/strong>. For\nexample, <em>Show this content if a user is not an administrator.<\/em><\/li>\n<li>You can pass multiple variables to the roles and capabilities shortcodes.\nFor example, <em>Show this content to users who are subscribers,\ncontributors, or editors.<\/em><\/li>\n<li>By default, any content within these four shortcodes is not displayed in\nfeeds. You may also set the <strong>showinfeed='yes'<\/strong> attribute to show the\ncontent in feeds.<\/li>\n<li>It is as lean as I could get it, with logic ordering to cut down on\nprocessing. Which isn't saying much, but if you've got suggestions, I'm\nopen to hearing them.<\/li>\n<\/ul>\n\n<h3>The four mmbrs shortcodes are:<\/h3>\n\n<ul>\n<li>[mmbrs_logged_in]<\/li>\n<li>[mmbrs_roles]<\/li>\n<li>[mmbrs_capabilities]<\/li>\n<li>[mmbrs_user_meta]<\/li>\n<\/ul>\n\n<h3>[mmbrs_logged_in]<\/h3>\n\n<blockquote>\n  <p>[mmbrs_logged_in]Content.[\/mmbrs_logged_in]<\/p>\n<\/blockquote>\n\n<ul>\n<li><em>Attribute: none<\/em>\n\n<ul>\n<li>Shows content to logged in users.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_logged_in is='not']Content.[\/mmbrs_logged_in]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: is\n\n<ul>\n<li>Optional.<\/li>\n<li><strong>is<\/strong> only accepts <strong>not<\/strong>.<\/li>\n<li>Shows content to logged out users.<\/li>\n<li>Case insensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_logged_in showinfeed='yes']Content.[\/mmbrs_logged_in]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: showinfeed\n\n<ul>\n<li>Optional.<\/li>\n<li><strong>showinfeed<\/strong> only accepts <strong>yes<\/strong>.<\/li>\n<li>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 take effect.)<\/li>\n<li>Case insensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h3>[mmbrs_roles]<\/h3>\n\n<blockquote>\n  <p>[mmbrs_roles]Content.[\/mmbrs_roles]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: none\n\n<ul>\n<li>Returns nothing.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_roles equals='subscriber']Content.[\/mmbrs_roles]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: equals\n\n<ul>\n<li>Required.<\/li>\n<li>Accepts multiple. e.g. equals='subscriber,contributor'<\/li>\n<li>Shows content to users with the 'subscriber' role.<\/li>\n<li>Case sensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_roles is='not' equals='subscriber']Content.[\/mmbrs_roles]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: is\n\n<ul>\n<li>Optional.<\/li>\n<li>Shows content to users who do not have the 'subscriber' role.<\/li>\n<li><strong>is<\/strong> only accepts <strong>not<\/strong>.<\/li>\n<li>Case insensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_roles showinfeed='yes']Content.[\/mmbrs_roles]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: showinfeed\n\n<ul>\n<li>Optional.<\/li>\n<li>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 take effect.)<\/li>\n<li><strong>showinfeed<\/strong> only accepts <strong>yes<\/strong>.<\/li>\n<li>Case insensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h3>[mmbrs_capabilities]<\/h3>\n\n<blockquote>\n  <p>[mmbrs_capabilities]Content.[\/mmbrs_capabilities]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: none\n\n<ul>\n<li>Returns nothing.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_capabilities can='delete_others_posts']Content.[\/mmbrs_capabilities]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: can\n\n<ul>\n<li>Required.<\/li>\n<li>Shows content to users with the 'delete_others_posts' capability.<\/li>\n<li>Accepts multiple. e.g. <strong>can='delete_others_posts,edit_others_posts'<\/strong><\/li>\n<li>Case sensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_capabilities is='not' can='delete_others_posts']Content.[\/mmbrs_capabilities]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: is\n\n<ul>\n<li>Optional.<\/li>\n<li>Shows content to users who do not have the 'delete_others_posts' capability.<\/li>\n<li><strong>is<\/strong> only accepts <strong>not<\/strong>.<\/li>\n<li>Case insensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_capabilities showinfeed='yes']Content.[\/mmbrs_capabilities]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: showinfeed\n\n<ul>\n<li>Optional.<\/li>\n<li>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 take effect.)<\/li>\n<li><strong>showinfeed<\/strong> only accepts <strong>yes<\/strong>.<\/li>\n<li>Case insensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h3>[mmbrs_user_meta]<\/h3>\n\n<blockquote>\n  <p>[mmbrs_user_meta]Content.[\/mmbrs_user_meta]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: none\n\n<ul>\n<li>Returns nothing.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_user_meta key='first_name'][\/mmbrs_user_meta]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: key (with no content)\n\n<ul>\n<li>Required. (<strong>key<\/strong> attribute is required. Content is not required.)<\/li>\n<li>Shows a logged-in user's <strong>first_name<\/strong> meta value.<\/li>\n<li>Does NOT accept multiple values when content is null\/empty.<\/li>\n<li>Case sensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_user_meta key='first_name']Content.[\/mmbrs_user_meta]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: key (with content)\n\n<ul>\n<li>Required. (<strong>key<\/strong> attribute is required. Content is not required.)<\/li>\n<li>Shows content to logged-in user with the <strong>first_name<\/strong> meta value.<\/li>\n<li>Accepts multiple as OR. e.g. <strong>key='first_name,last_name'<\/strong><\/li>\n<li>Case sensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_user_meta is='not' key='first_name']Content.[\/mmbrs_user_meta]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: is\n\n<ul>\n<li>Optional.<\/li>\n<li>Shows content to users who do not have the <strong>first_name<\/strong> meta value.<\/li>\n<li><strong>is<\/strong> only accepts <strong>not<\/strong>.<\/li>\n<li>Case insensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_user_meta is='not' key='first_name' equals='Ben']Content.[\/mmbrs_user_meta]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: equals\n\n<ul>\n<li>Required.<\/li>\n<li>Shows content to users who do not have the <strong>first_name<\/strong> user meta of 'Ben'.<\/li>\n<li>Case sensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<blockquote>\n  <p>[mmbrs_user_meta showinfeed='yes']Content.[\/mmbrs_user_meta]<\/p>\n<\/blockquote>\n\n<ul>\n<li>Attribute: showinfeed\n\n<ul>\n<li>Optional.<\/li>\n<li>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 take effect.)<\/li>\n<li><strong>showinfeed<\/strong> only accepts 'yes'.<\/li>\n<li>Case insensitive.<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h4>Other Notes:<\/h4>\n\n<p>For every shortcode, except <strong>[mmbrs_logged_in]<\/strong>, if a user is not logged in, the shortcode will return nothing. The exception is when using <strong>is='not'<\/strong> in <strong>[mmbrs_logged_in]<\/strong>, as in <strong>[mmbrs_logged_in is='not']Content.[\/mmbrs_logged_in]<\/strong><\/p>\n\n<p>By default, everything is hidden from feeds unless <strong>showinfeed='yes'<\/strong> is defined.<\/p>\n\n<h4>Motivation for this plugin:<\/h4>\n\n<p>I wrote this plugin to fill some holes, reduce some unnecessary functions, and fix some minor bugs I found in other plugins. I now use this, and only this, to control all shortcode-based content access on my membership-style websites.<\/p>\n\n<p>The Members plugin checks roles by checking capabilities. You are not supposed to do that. The proper way of checking roles is included here. Notes on this:<\/p>\n\n<ul>\n<li><a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/current_user_can#Notes\">WordPress current_user_can() Notes<\/a><\/li>\n<\/ul>\n\n<p>Aside from that, I love and use the Members plugin and suggest you check it out for other role- and capability-based content access management.<\/p>\n\n<p>I removed a bunch of stuff from the User Meta Shortcodes plugin that I didn't want. If you want the additional functionality, I recommend that plugin.<\/p>\n\n<p>In the end, I wanted very clear control of in-post content via shortcodes. I wasn't finding anything that was totally stripped down. So I wrote this.<\/p>\n\n<h4>Inspiration and Credits:<\/h4>\n\n<ul>\n<li><a href=\"https:\/\/wordpress.org\/plugins\/members\/\">Members Plugin<\/a><\/li>\n<li><a href=\"https:\/\/wordpress.org\/plugins\/user-meta-shortcodes\/\">User Meta Shortcodes Plugin<\/a><\/li>\n<li><a href=\"http:\/\/docs.appthemes.com\/tutorials\/wordpress-check-user-role-function\/\">AppThemes User Role Function<\/a><\/li>\n<\/ul>\n\n<p>&nbsp;<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload <strong>plugin-name.php<\/strong> to the <strong>\/wp-content\/plugins\/<\/strong> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>\n\n<!--section=faq-->\n<p>None. Yet.<\/p>\n\n<!--section=changelog-->\n<h4>1.0<\/h4>\n\n<ul>\n<li>2014.10.01<\/li>\n<li>Released<\/li>\n<\/ul>","raw_excerpt":"Restrict content access using shortcodes; based on roles, capabilities, user meta, and logged in status.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/32072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=32072"}],"author":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/benwills"}],"wp:attachment":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=32072"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=32072"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=32072"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=32072"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=32072"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=32072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}