{"id":76417,"date":"2018-02-09T20:06:20","date_gmt":"2018-02-09T20:06:20","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/occupied\/"},"modified":"2018-02-09T21:11:19","modified_gmt":"2018-02-09T21:11:19","slug":"occupied","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/occupied\/","author":15733814,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"0.1.0","stable_tag":"0.1.0","tested":"4.8.28","requires":"4.8.1","requires_php":"5.2.4","requires_plugins":"","header_name":"occupied","header_author":"williamtaft","header_description":"custom page locking for WordPress admin pages","assets_banners_color":"feffff","last_updated":"2018-02-09 21:11:19","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/skinnyjames\/occupied","header_author_uri":"https:\/\/github.com\/skinnyjames","rating":0,"author_block_rating":0,"active_installs":0,"downloads":860,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["installation","changelog","description","faq"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":"1819389","resolution":"128x128","location":"assets"},"icon.svg":{"filename":"icon.svg","revision":"1819389","resolution":"","location":"assets"}},"assets_banners":{"banner-772x250.jpg":{"filename":"banner-772x250.jpg","revision":"1819389","resolution":"772x250","location":"assets"}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.1.0","0.1.1"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":"1819389","resolution":"1","location":"assets"}},"screenshots":{"1":"Demonstration"}},"plugin_section":[],"plugin_tags":[527,2085,153013],"plugin_category":[],"plugin_contributors":[153014],"plugin_business_model":[],"class_list":["post-76417","plugin","type-plugin","status-closed","hentry","plugin_tags-custom","plugin_tags-lock","plugin_tags-occupied","plugin_contributors-williamtaft","plugin_committers-williamtaft"],"banners":[],"icons":{"svg":"https:\/\/ps.w.org\/occupied\/assets\/icon.svg?rev=1819389","icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/occupied_feffff.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/occupied\/assets\/screenshot-1.png?rev=1819389","caption":"Demonstration"}],"raw_content":"<!--section=installation-->\n<p>put this plugin in the plugins directory of your wordpress installation<\/p>\n\n<p>or<\/p>\n\n<p>include the plugin in the root folder of your own plugin and require it with<\/p>\n\n<pre><code>require_once('occupied-installation-folder\/occupied.php');\n<\/code><\/pre>\n\n<!--section=changelog-->\n<ul>\n<li>Initial upload<\/li>\n<\/ul>\n\n<!--section=description-->\n<p>custom page locking for WordPress admin screens<\/p>\n\n<h3>usage<\/h3>\n\n<p>In the function for your custom page, just use <code>Occupied::protect()<\/code> to enable locking on that page.<\/p>\n\n<pre><code>&lt;?php \nadd_action('admin_menu', 'register_my_plugin_menu');\n\nfunction register_my_plugin_menu(){\n  add_menu_page(\"My Cool Plugin\", \"cool-plugin\", \"manage_options\", \"my_cool_plugin_page\", \"render_my_cool_plugin\", \"dashicons-heart\", 7);\n}\n\nfunction render_my_cool_plugin(){\n  \/\/ Occupied::protect enables locking on this page\n  \/\/ and returns a lock array\n  \/\/ optional: pass a message to the protect method to appear on the lock modal.\n  $lock = Occupied::protect(\"Cool Plugin Occupied!\");\n\n  echo \"&lt;h1&gt;My Cool Plugin!&lt;\/h1&gt;\";\n}\n?&gt;\n<\/code><\/pre>\n\n<p>In another action, you can check whether a screen is occupied by the current user<\/p>\n\n<pre><code>&lt;?php\nfunction some_other_action(){\n  if(Occupied::is_authorized('toplevel_page_my_cool_plugin_page')){\n    \/\/ business logic, save to database, etc..\n  }else{\n    \/\/ return error\n  }\n}\n?&gt;&lt;h3&gt;todo&lt;\/h3&gt;\n<\/code><\/pre>\n\n<p>* break out styles\n* add locking hooks \n* rethink using vue for a modal and some event handlers<\/p>\n\n<h3>developers<\/h3>\n\n<p>This plugin is developed on <a href=\"https:\/\/github.com\/skinnyjames\/occupied\/\">github<\/a><\/p>\n\n<h3>license<\/h3>\n\n<p>GPLv3<\/p>\n\n<!--section=faq-->\n<dl>\n<dt>Installation Instructions<\/dt>\n<dd><p>put this plugin in the plugins directory of your wordpress installation<\/p>\n\n<p>or<\/p>\n\n<p>include the plugin in the root folder of your own plugin and require it with<\/p>\n\n<pre><code>require_once('occupied-installation-folder\/occupied.php');\n<\/code><\/pre><\/dd>\n\n<\/dl>","raw_excerpt":"custom page locking for WordPress admin screens","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/76417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=76417"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/williamtaft"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=76417"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=76417"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=76417"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=76417"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=76417"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=76417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}