{"id":31,"date":"2021-08-15T09:05:52","date_gmt":"2021-08-15T09:05:52","guid":{"rendered":"https:\/\/demo.daext.com\/restricted-blocks\/?p=31"},"modified":"2023-10-11T14:03:07","modified_gmt":"2023-10-11T14:03:07","slug":"restriction-based-on-the-user-capability","status":"publish","type":"post","link":"https:\/\/demo.daext.com\/restricted-blocks\/restriction-based-on-the-user-capability\/","title":{"rendered":"Restriction based on the user capability"},"content":{"rendered":"\n<p>This restriction uses the <a href=\"https:\/\/wordpress.org\/support\/article\/roles-and-capabilities\/\">capabilities of the user<\/a> to determine whether to display or not a specific block.<\/p>\n\n\n\n<p>Please note that the plugin allows you to either display additional information on the restriction (as we did in this demo page) or completely remove the block from the layout.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\">Example 1<\/h4>\n\n\n\n<p>This content will be display to user with the &#8220;edit_posts&#8221; capability. (E.g. Contributors, Editors.)<\/p>\n\n\n<div class=\"daextreblp-restricted-block-container\">\n\t\t\t\t\t\t\t<img class=\"daextreblp-restricted-block-icon\"\n\t\t\t\t\tsrc=\"https:\/\/demo.daext.com\/restricted-blocks\/wp-content\/plugins\/restricted-blocks-pro\/shared\/assets\/img\/padlock.png\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"daextreblp-restricted-block-title\">Restricted Content<\/div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"daextreblp-restricted-block-description\">Sorry, this content isn&#039;t available right now.<\/div>\n\t\t\t\n\t\t\t<\/div>\n\n\n<h4 class=\"wp-block-heading\">Example  2<\/h4>\n\n\n\n<p>This content below will be displayed to user with the &#8220;read&#8221; capability. (E.g. Subscribers.)<\/p>\n\n\n<div class=\"daextreblp-restricted-block-container\">\n\t\t\t\t\t\t\t<img class=\"daextreblp-restricted-block-icon\"\n\t\t\t\t\tsrc=\"https:\/\/demo.daext.com\/restricted-blocks\/wp-content\/plugins\/restricted-blocks-pro\/shared\/assets\/img\/padlock.png\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"daextreblp-restricted-block-title\">Restricted Content<\/div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"daextreblp-restricted-block-description\">Sorry, this content isn&#039;t available right now.<\/div>\n\t\t\t\n\t\t\t<\/div>\n\n\n<h4 class=\"wp-block-heading\">Example  3<\/h4>\n\n\n\n<p><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\">This content below will be displayed to user with the &#8220;watch_lessons&#8221; capability. You can use custom capabilities for example to allow access to video lesson to the students of a class.<\/p>\n\n\n<div class=\"daextreblp-restricted-block-container\">\n\t\t\t\t\t\t\t<img class=\"daextreblp-restricted-block-icon\"\n\t\t\t\t\tsrc=\"https:\/\/demo.daext.com\/restricted-blocks\/wp-content\/plugins\/restricted-blocks-pro\/shared\/assets\/img\/padlock.png\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"daextreblp-restricted-block-title\">Restricted Content<\/div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"daextreblp-restricted-block-description\">Sorry, this content isn&#039;t available right now.<\/div>\n\t\t\t\n\t\t\t<\/div>\n\n\n<h4 class=\"wp-block-heading\"> Example  4<\/h4>\n\n\n\n<p><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\"><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\">This content below will be displayed to user with the &#8220;download_premium_content&#8221; capability. You can use custom capabilities for example to allow access to downloadable content only to paid subscribers.<\/p>\n\n\n<div class=\"daextreblp-restricted-block-container\">\n\t\t\t\t\t\t\t<img class=\"daextreblp-restricted-block-icon\"\n\t\t\t\t\tsrc=\"https:\/\/demo.daext.com\/restricted-blocks\/wp-content\/plugins\/restricted-blocks-pro\/shared\/assets\/img\/padlock.png\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"daextreblp-restricted-block-title\">Restricted Content<\/div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"daextreblp-restricted-block-description\">Sorry, this content isn&#039;t available right now.<\/div>\n\t\t\t\n\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>This restriction uses the capabilities of the user to determine whether to display or not a specific block. Please note that the plugin allows you to either display additional information on the restriction (as we did in this demo page) or completely remove the block from the layout. Example 1 This content will be display [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-demo"],"_links":{"self":[{"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":1,"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/posts\/31\/revisions\/168"}],"wp:attachment":[{"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demo.daext.com\/restricted-blocks\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}