Plugin Directory

Changeset 949694


Ignore:
Timestamp:
07/16/2014 03:13:49 PM (12 years ago)
Author:
george_michael
Message:

tagged 1.1.1

Location:
simple-permissions
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • simple-permissions/tags/1.1.1/readme.txt

    r949008 r949694  
    55Requires at least: 3.5.2
    66Tested up to: 3.9.1
    7 Stable tag: 1.1.0
     7Stable tag: 1.1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3535== Changelog ==
    3636
     37= 1.1.1 =
     38* Quick bug fix for major oops in last version. The meta box wasn't rendering if a user had a higher role than necessary.
     39
    3740= 1.1.0 =
    3841* Added option to limit changing permissions to certain WP roles.
     
    5255== Upgrade Notice ==
    5356
     57= 1.1.1 =
     58* Bug fix for 1.1.0, so if you had 1.1.0, you need to upgrade. If on 1.0.2, upgrade is optional.
     59
    5460= 1.1.0 =
    5561* New features and options based on feedback. Upgrade optional.
  • simple-permissions/tags/1.1.1/simple-permissions.php

    r949008 r949694  
    22/**
    33 * @package Simple-Permissions
    4  * @version 1.1.0
     4 * @version 1.1.1
    55 */
    66/*
     
    99Description: Create simple permission groups for reading or editing posts.
    1010Author: Michael George
    11 Version: 1.1.0
     11Version: 1.1.1
    1212
    1313    This program is free software; you can redistribute it and/or modify
     
    663663    global $svvsd_simplePermissions;
    664664    $devOptions = $svvsd_simplePermissions->spGetAdminOptions();
    665     if ( ! isset( $devOptions['allowedRole'] ) ) {
    666         return;
     665    if ( isset( $devOptions['allowedRole'] ) ) {
     666        $user = wp_get_current_user();
     667        if ( current_user_can( 'activate_plugins' ) ) {
     668            $user->roles[] = 'administrator';
     669        }
     670        if ( in_array( 'administrator', $user->roles ) ) {
     671            if ( ! in_array( 'editor', $user->roles ) ) $user->roles[] = 'editor';
     672            if ( ! in_array( 'author', $user->roles ) ) $user->roles[] = 'author';
     673            if ( ! in_array( 'contributor', $user->roles ) ) $user->roles[] = 'contributor';
     674        } else if ( in_array( 'editor', $user->roles ) ) {
     675            if ( ! in_array( 'author', $user->roles ) ) $user->roles[] = 'author';
     676            if ( ! in_array( 'contributor', $user->roles ) ) $user->roles[] = 'contributor';
     677        } else if ( in_array( 'author', $user->roles ) ) {
     678            if ( ! in_array( 'contributor', $user->roles ) ) $user->roles[] = 'contributor';
     679        }
     680        echo "<!-- " . print_r( $user->roles, true ) . " -->\r";
     681        if ( in_array( $devOptions['allowedRole'], (array) $user->roles ) ) {
     682            $add = true;
     683        } else {
     684            $add = false;
     685        }
     686    } else {
     687        $add = true;
    667688    }
    668     $user = wp_get_current_user();
    669     if ( current_user_can( 'activate_plugins' ) ) {
    670         $user->roles[] = 'administrator';
    671     }
    672     if ( count( $user->roles ) == 1 ) {
    673         switch ( $user->roles[0] ) {
    674             case 'administrator':
    675             case 'editor':
    676                 $user->roles[] = 'editor';
    677             case 'author':
    678                 $user->roles[] = 'author';
    679             case 'contributor':
    680                 $user->roles[] = 'contributor';
    681                 break;
    682         }
    683     }
    684     //echo "<!-- " . print_r( $user->roles, true ) . " -->\r";
    685     if ( in_array( $devOptions['allowedRole'], (array) $user->roles ) ) {
     689    if ( $add ) {
     690        echo "<!-- adding meta box -->\r";
    686691        add_meta_box(
    687692                'simplepermissions_meta_box'
     
    692697                ,'high'
    693698            );
     699    } else {
     700        echo "<!-- not adding meta box -->\r";
    694701    }
    695702}
  • simple-permissions/trunk/readme.txt

    r949008 r949694  
    55Requires at least: 3.5.2
    66Tested up to: 3.9.1
    7 Stable tag: 1.1.0
     7Stable tag: 1.1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3535== Changelog ==
    3636
     37= 1.1.1 =
     38* Quick bug fix for major oops in last version. The meta box wasn't rendering if a user had a higher role than necessary.
     39
    3740= 1.1.0 =
    3841* Added option to limit changing permissions to certain WP roles.
     
    5255== Upgrade Notice ==
    5356
     57= 1.1.1 =
     58* Bug fix for 1.1.0, so if you had 1.1.0, you need to upgrade. If on 1.0.2, upgrade is optional.
     59
    5460= 1.1.0 =
    5561* New features and options based on feedback. Upgrade optional.
  • simple-permissions/trunk/simple-permissions.php

    r949008 r949694  
    22/**
    33 * @package Simple-Permissions
    4  * @version 1.1.0
     4 * @version 1.1.1
    55 */
    66/*
     
    99Description: Create simple permission groups for reading or editing posts.
    1010Author: Michael George
    11 Version: 1.1.0
     11Version: 1.1.1
    1212
    1313    This program is free software; you can redistribute it and/or modify
     
    663663    global $svvsd_simplePermissions;
    664664    $devOptions = $svvsd_simplePermissions->spGetAdminOptions();
    665     if ( ! isset( $devOptions['allowedRole'] ) ) {
    666         return;
     665    if ( isset( $devOptions['allowedRole'] ) ) {
     666        $user = wp_get_current_user();
     667        if ( current_user_can( 'activate_plugins' ) ) {
     668            $user->roles[] = 'administrator';
     669        }
     670        if ( in_array( 'administrator', $user->roles ) ) {
     671            if ( ! in_array( 'editor', $user->roles ) ) $user->roles[] = 'editor';
     672            if ( ! in_array( 'author', $user->roles ) ) $user->roles[] = 'author';
     673            if ( ! in_array( 'contributor', $user->roles ) ) $user->roles[] = 'contributor';
     674        } else if ( in_array( 'editor', $user->roles ) ) {
     675            if ( ! in_array( 'author', $user->roles ) ) $user->roles[] = 'author';
     676            if ( ! in_array( 'contributor', $user->roles ) ) $user->roles[] = 'contributor';
     677        } else if ( in_array( 'author', $user->roles ) ) {
     678            if ( ! in_array( 'contributor', $user->roles ) ) $user->roles[] = 'contributor';
     679        }
     680        echo "<!-- " . print_r( $user->roles, true ) . " -->\r";
     681        if ( in_array( $devOptions['allowedRole'], (array) $user->roles ) ) {
     682            $add = true;
     683        } else {
     684            $add = false;
     685        }
     686    } else {
     687        $add = true;
    667688    }
    668     $user = wp_get_current_user();
    669     if ( current_user_can( 'activate_plugins' ) ) {
    670         $user->roles[] = 'administrator';
    671     }
    672     if ( count( $user->roles ) == 1 ) {
    673         switch ( $user->roles[0] ) {
    674             case 'administrator':
    675             case 'editor':
    676                 $user->roles[] = 'editor';
    677             case 'author':
    678                 $user->roles[] = 'author';
    679             case 'contributor':
    680                 $user->roles[] = 'contributor';
    681                 break;
    682         }
    683     }
    684     //echo "<!-- " . print_r( $user->roles, true ) . " -->\r";
    685     if ( in_array( $devOptions['allowedRole'], (array) $user->roles ) ) {
     689    if ( $add ) {
     690        echo "<!-- adding meta box -->\r";
    686691        add_meta_box(
    687692                'simplepermissions_meta_box'
     
    692697                ,'high'
    693698            );
     699    } else {
     700        echo "<!-- not adding meta box -->\r";
    694701    }
    695702}
Note: See TracChangeset for help on using the changeset viewer.