Updated a few things.
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 6 Jan 2015 23:09:26 +0000 (18:09 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 6 Jan 2015 23:09:26 +0000 (18:09 -0500)
models/activate.php
models/deactivate.php
readme.txt

index 2141999..320b10f 100644 (file)
@@ -52,8 +52,12 @@ class glmProtoPluginActivate
          * Perform any activation tasks here
          */
 
-        // Add user capabilties
-        $this->addRoleCapability('glm_proto_edit', false);
+        // Add user capabilties using the following list of roles with edit capability
+        $protoEditorRoles = array(
+            'administrator',
+            'author'
+        );
+        $this->addRoleCapability('glm_proto_edit', $protoEditorRoles);
     }
 
     /*
@@ -65,7 +69,7 @@ class glmProtoPluginActivate
      * @return void
      * @access public
      */
-    public function addRoleCapability ($capability, $default)
+    public function addRoleCapability ($capability, $defaults)
     {
         // Get list of role objects
         $roleObjects = $GLOBALS['wp_roles']->role_objects;
@@ -76,14 +80,18 @@ class glmProtoPluginActivate
         // For each role object
         foreach ($roleObjects as $key => $role) {
 
+            // Determine if role should have add/edit capability by default
+            $edit = in_array($role->name, $defaults);
+
             // Check if the role exists in list of editable roles and capability
-            // does not exist
-            if (isset($roles[$key]) && ! isset($role->capabilities[$capability])) {
+            if (isset($roles[$key])) {
+
+                // Add the role with the default edit status
+                $role->add_cap($capability, $edit);
 
-                // Add the role
-                $role->add_cap($capability, $default);
             }
         }
+
     }
 }
 
index 9555394..6126af0 100644 (file)
@@ -46,7 +46,9 @@ class glmProtoPluginDeactivate
         $this->wpdb = $wpdb;
 
         // Add user capabilties
-        $this->removeRoleCapability('glm_proto_edit');
+        // Not doing this now so settings aren't lost if deactivated and re-activated
+        // Note that upon reactivation that both administrator and author have glm_proto_edit re-enabled.
+//        $this->removeRoleCapability('glm_proto_edit');
     }
 
     /*
index fc35003..2a9e926 100644 (file)
@@ -2,90 +2,51 @@
 Contributors: cscott@gaslightmedia.com
 Donate link: http://www.gaslightmedia.com
 Tags: Gaslight Media,Plugin,Prototypes
-Requires at least: 3.0.1
-Tested up to: 3.4
-Stable tag: 4.3
-License: GPLv2 or later
-License URI: http://www.gnu.org/licenses/gpl-2.0.html
+Requires at least: 4.0
+Tested up to: 4.0.1
+Stable tag: 1.0
+License: Commercial
+License URI: http://www.gaslightmedia.com/plugin-license/
 
-This is a plugin that is an example of using MVP development.
+The GLMPrototypes plugin provides a means to post Web prototypes (mostly images) to a WordPress admin area and make them 
+available for display.
 
 == Description ==
 
-More description goes here.
+The GLMPrototypes plugin permits the upload of up to 5 images. 
 
-== Installation ==
+By default the first two images are a background and forground image. The plugin also provides default HTML to be used 
+for display but also permits replacing that with custom HTML for each prototype. Replaceable parameters may be used in 
+the HTML to reference images and other parameters.
 
-This section describes how to install the plugin and get it working.
+Additional parameters that may be specified are a title for the prototype and height and width values for the browser
+window that will be used to display the prototype. 
 
-e.g.
+== Installation ==
 
-1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory
-1. Activate the plugin through the 'Plugins' menu in WordPress
-1. Place `<?php do_action('plugin_name_hook'); ?>` in your templates
+1. Unzip the GLMPrototypes.zip file into the WordPress /wp-content/plugins/ directory. This should create the glm-proto
+plugin directory and contents. 
+2. Change all file ownership and permissions as needed.
+3. Activate the plugin using the WordPress "Plugins" menu.
+4. Select the "glm_proto_edit" capability under "Custom capabilities" for users who you want to be able to add/edit 
+prototypes. All other users with access to wp-admin will be permitted to view prototypes.
 
 == Frequently Asked Questions ==
 
-= A question that someone might have =
-
-An answer to that question.
+= No FAQs at this time =
 
-= What about foo bar? =
-
-Answer to foo bar dilemma.
+n/a
 
 == Screenshots ==
 
-1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from
-the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets 
-directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` 
-(or jpg, jpeg, gif).
-2. This is the second screen shot
+n/a
 
 == Changelog ==
 
 = 1.0 =
-* A change since the previous version.
-* Another change.
-
-= 0.5 =
-* List versions from most recent at top to oldest at bottom.
+* Initial Version
 
 == Upgrade Notice ==
 
 = 1.0 =
-Upgrade notices describe the reason a user should upgrade.  No more than 300 characters.
-
-= 0.5 =
-This version fixes a security related bug.  Upgrade immediately.
-
-== Arbitrary section ==
-
-You may provide arbitrary sections, in the same format as the ones above.  This may be of use for extremely complicated
-plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or
-"installation."  Arbitrary sections will be shown below the built-in sections outlined above.
-
-== A brief Markdown Example ==
-
-Ordered list:
-
-1. Some feature
-1. Another feature
-1. Something else about the plugin
-
-Unordered list:
-
-* something
-* something else
-* third thing
-
-Here's a link to [WordPress](http://wordpress.org/ "Your favorite software") and one to [Markdown's Syntax Documentation][markdown syntax].
-Titles are optional, naturally.
-
-[markdown syntax]: http://daringfireball.net/projects/markdown/syntax
-            "Markdown is what the parser uses to process much of the readme file"
-
-Markdown uses email style notation for blockquotes and I've been told:
-> Asterisks for *emphasis*. Double it up  for **strong**.
-
-`<?php code(); // goes in backticks ?>`
\ No newline at end of file
+No on-line upgrade is currently available for this plugin.