Changeset 949694
- Timestamp:
- 07/16/2014 03:13:49 PM (12 years ago)
- Location:
- simple-permissions
- Files:
-
- 2 edited
- 3 copied
-
tags/1.1.1 (copied) (copied from simple-permissions/trunk)
-
tags/1.1.1/readme.txt (copied) (copied from simple-permissions/trunk/readme.txt) (3 diffs)
-
tags/1.1.1/simple-permissions.php (copied) (copied from simple-permissions/trunk/simple-permissions.php) (4 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/simple-permissions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-permissions/tags/1.1.1/readme.txt
r949008 r949694 5 5 Requires at least: 3.5.2 6 6 Tested up to: 3.9.1 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 35 35 == Changelog == 36 36 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 37 40 = 1.1.0 = 38 41 * Added option to limit changing permissions to certain WP roles. … … 52 55 == Upgrade Notice == 53 56 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 54 60 = 1.1.0 = 55 61 * New features and options based on feedback. Upgrade optional. -
simple-permissions/tags/1.1.1/simple-permissions.php
r949008 r949694 2 2 /** 3 3 * @package Simple-Permissions 4 * @version 1.1. 04 * @version 1.1.1 5 5 */ 6 6 /* … … 9 9 Description: Create simple permission groups for reading or editing posts. 10 10 Author: Michael George 11 Version: 1.1. 011 Version: 1.1.1 12 12 13 13 This program is free software; you can redistribute it and/or modify … … 663 663 global $svvsd_simplePermissions; 664 664 $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; 667 688 } 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"; 686 691 add_meta_box( 687 692 'simplepermissions_meta_box' … … 692 697 ,'high' 693 698 ); 699 } else { 700 echo "<!-- not adding meta box -->\r"; 694 701 } 695 702 } -
simple-permissions/trunk/readme.txt
r949008 r949694 5 5 Requires at least: 3.5.2 6 6 Tested up to: 3.9.1 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 35 35 == Changelog == 36 36 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 37 40 = 1.1.0 = 38 41 * Added option to limit changing permissions to certain WP roles. … … 52 55 == Upgrade Notice == 53 56 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 54 60 = 1.1.0 = 55 61 * New features and options based on feedback. Upgrade optional. -
simple-permissions/trunk/simple-permissions.php
r949008 r949694 2 2 /** 3 3 * @package Simple-Permissions 4 * @version 1.1. 04 * @version 1.1.1 5 5 */ 6 6 /* … … 9 9 Description: Create simple permission groups for reading or editing posts. 10 10 Author: Michael George 11 Version: 1.1. 011 Version: 1.1.1 12 12 13 13 This program is free software; you can redistribute it and/or modify … … 663 663 global $svvsd_simplePermissions; 664 664 $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; 667 688 } 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"; 686 691 add_meta_box( 687 692 'simplepermissions_meta_box' … … 692 697 ,'high' 693 698 ); 699 } else { 700 echo "<!-- not adding meta box -->\r"; 694 701 } 695 702 }
Note: See TracChangeset
for help on using the changeset viewer.