Groups - Version 1.0.0-beta-3b

Version Description

  • Fixed admin override option not being updated
  • DB tables checked individually to create (motivated by case of all but capability table not being created)
Download this release

Release Info

Developer itthinx
Plugin Icon 128x128 Groups
Version 1.0.0-beta-3b
Comparing to
See all releases

Code changes from version 1.0.0-beta-3 to 1.0.0-beta-3b

groups.php CHANGED
@@ -21,7 +21,7 @@
21
  * Plugin Name: Groups
22
  * Plugin URI: http://www.itthinx.com/plugins/groups
23
  * Description: Groups provides group-based user membership management, group-based capabilities and content access control.
24
- * Version: 1.0.0-beta-3
25
  * Author: itthinx (Karim Rahimpur)
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
21
  * Plugin Name: Groups
22
  * Plugin URI: http://www.itthinx.com/plugins/groups
23
  * Description: Groups provides group-based user membership management, group-based capabilities and content access control.
24
+ * Version: 1.0.0-beta-3b
25
  * Author: itthinx (Karim Rahimpur)
26
  * Author URI: http://www.itthinx.com
27
  * Donate-Link: http://www.itthinx.com
lib/admin/groups-admin-options.php CHANGED
@@ -58,6 +58,7 @@ function groups_admin_options() {
58
  $admin_override = true;
59
  }
60
  // Don't move this to the plugin options, access will be faster
 
61
  update_option( GROUPS_ADMINISTRATOR_ACCESS_OVERRIDE, $admin_override );
62
 
63
  // tree view
58
  $admin_override = true;
59
  }
60
  // Don't move this to the plugin options, access will be faster
61
+ add_option( GROUPS_ADMINISTRATOR_ACCESS_OVERRIDE, $admin_override ); // WP 3.3.1 : update alone wouldn't create the option when value is false
62
  update_option( GROUPS_ADMINISTRATOR_ACCESS_OVERRIDE, $admin_override );
63
 
64
  // tree view
lib/core/class-groups-controller.php CHANGED
@@ -110,53 +110,58 @@ class Groups_Controller {
110
  // create tables
111
  $group_table = _groups_get_tablename( 'group' );
112
  if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $group_table . "'" ) != $group_table ) {
113
- $queries[] = "CREATE TABLE " . $group_table . "(
114
- group_id BIGINT(20) UNSIGNED NOT NULL auto_increment,
115
- parent_id BIGINT(20) DEFAULT NULL,
116
- creator_id BIGINT(20) DEFAULT NULL,
117
- datetime DATETIME DEFAULT NULL,
118
- name VARCHAR(100) NOT NULL,
119
- description LONGTEXT DEFAULT NULL,
120
- PRIMARY KEY (group_id),
121
- UNIQUE INDEX group_n (name)
122
- );";
123
-
124
- $capability_table = _groups_get_tablename( 'capability' );
125
- $queries[] = "CREATE TABLE " . $capability_table . "(
126
- capability_id BIGINT(20) UNSIGNED NOT NULL auto_increment,
127
- capability VARCHAR(255) UNIQUE NOT NULL,
128
- class VARCHAR(255) DEFAULT NULL,
129
- object VARCHAR(255) DEFAULT NULL,
130
- name VARCHAR(100) DEFAULT NULL,
131
- description LONGTEXT DEFAULT NULL,
132
- PRIMARY KEY (capability_id),
133
- INDEX capability_kco (capability,class,object)
134
- );";
135
-
136
- $user_group_table = _groups_get_tablename( 'user_group' );
137
- $queries[] = "CREATE TABLE " . $user_group_table . "(
138
- user_id bigint(20) unsigned NOT NULL,
139
- group_id bigint(20) unsigned NOT NULL,
140
- PRIMARY KEY (user_id, group_id),
141
- INDEX user_group_gu (group_id,user_id)
142
- );";
143
-
144
- $user_capability_table = _groups_get_tablename( 'user_capability' );
145
- $queries[] = "CREATE TABLE " . $user_capability_table . "(
146
- user_id bigint(20) unsigned NOT NULL,
147
- capability_id bigint(20) unsigned NOT NULL,
148
- PRIMARY KEY (user_id, capability_id),
149
- INDEX user_capability_cu (capability_id,user_id)
150
- );";
151
-
152
- $group_capability_table = _groups_get_tablename( 'group_capability' );
153
- $queries[] = "CREATE TABLE " . $group_capability_table . "(
154
- group_id bigint(20) unsigned NOT NULL,
155
- capability_id bigint(20) unsigned NOT NULL,
156
- PRIMARY KEY (group_id, capability_id),
157
- INDEX group_capability_cg (capability_id,group_id)
158
- );";
159
-
 
 
 
 
 
160
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
161
  dbDelta( $queries );
162
  }
110
  // create tables
111
  $group_table = _groups_get_tablename( 'group' );
112
  if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $group_table . "'" ) != $group_table ) {
113
+ $queries[] = "CREATE TABLE " . $group_table . " (
114
+ group_id BIGINT(20) UNSIGNED NOT NULL auto_increment,
115
+ parent_id BIGINT(20) DEFAULT NULL,
116
+ creator_id BIGINT(20) DEFAULT NULL,
117
+ datetime DATETIME DEFAULT NULL,
118
+ name VARCHAR(100) NOT NULL,
119
+ description LONGTEXT DEFAULT NULL,
120
+ PRIMARY KEY (group_id),
121
+ UNIQUE INDEX group_n (name)
122
+ );";
123
+ }
124
+ $capability_table = _groups_get_tablename( 'capability' );
125
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $capability_table . "'" ) != $capability_table ) {
126
+ $queries[] = "CREATE TABLE " . $capability_table . " (
127
+ capability_id BIGINT(20) UNSIGNED NOT NULL auto_increment,
128
+ capability VARCHAR(255) UNIQUE NOT NULL,
129
+ class VARCHAR(255) DEFAULT NULL,
130
+ object VARCHAR(255) DEFAULT NULL,
131
+ name VARCHAR(100) DEFAULT NULL,
132
+ description LONGTEXT DEFAULT NULL,
133
+ PRIMARY KEY (capability_id),
134
+ INDEX capability_kco (capability,class,object)
135
+ );";
136
+ }
137
+ $user_group_table = _groups_get_tablename( 'user_group' );
138
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $user_group_table . "'" ) != $user_group_table ) {
139
+ $queries[] = "CREATE TABLE " . $user_group_table . " (
140
+ user_id bigint(20) unsigned NOT NULL,
141
+ group_id bigint(20) unsigned NOT NULL,
142
+ PRIMARY KEY (user_id, group_id),
143
+ INDEX user_group_gu (group_id,user_id)
144
+ );";
145
+ }
146
+ $user_capability_table = _groups_get_tablename( 'user_capability' );
147
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $user_capability_table . "'" ) != $user_capability_table ) {
148
+ $queries[] = "CREATE TABLE " . $user_capability_table . " (
149
+ user_id bigint(20) unsigned NOT NULL,
150
+ capability_id bigint(20) unsigned NOT NULL,
151
+ PRIMARY KEY (user_id, capability_id),
152
+ INDEX user_capability_cu (capability_id,user_id)
153
+ );";
154
+ }
155
+ $group_capability_table = _groups_get_tablename( 'group_capability' );
156
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $group_capability_table . "'" ) != $group_capability_table ) {
157
+ $queries[] = "CREATE TABLE " . $group_capability_table . " (
158
+ group_id bigint(20) unsigned NOT NULL,
159
+ capability_id bigint(20) unsigned NOT NULL,
160
+ PRIMARY KEY (group_id, capability_id),
161
+ INDEX group_capability_cg (capability_id,group_id)
162
+ );";
163
+ }
164
+ if ( !empty( $queries ) ) {
165
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
166
  dbDelta( $queries );
167
  }
lib/core/class-groups-help.php CHANGED
@@ -88,33 +88,23 @@ class Groups_Help {
88
  * Render or return a donation button.
89
  * Thanks for supporting me!
90
  * @param boolean $render
 
91
  */
92
  public static function donate( $render = true, $small = false ) {
93
- if ( !$small ) {
94
- $donate = '
95
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
96
- <input type="hidden" name="cmd" value="_s-xclick">
97
- <input type="hidden" name="hosted_button_id" value="AGZGDNAD9L4YS">
98
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
99
- <img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif" width="1" height="1">
100
- </form>
101
- ';
102
- } else {
103
- $donate = '
104
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
105
- <input type="hidden" name="cmd" value="_donations">
106
- <input type="hidden" name="business" value="itthinx@itthinx.com">
107
- <input type="hidden" name="lc" value="US">
108
- <input type="hidden" name="item_name" value="Support WordPress Plugins from itthinx">
109
- <input type="hidden" name="item_number" value="WordPress Plugins">
110
- <input type="hidden" name="no_note" value="0">
111
- <input type="hidden" name="currency_code" value="EUR">
112
- <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest">
113
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
114
- <img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif" width="1" height="1">
115
- </form>
116
- ';
117
- }
118
  if ( $render ) {
119
  echo $donate;
120
  } else {
88
  * Render or return a donation button.
89
  * Thanks for supporting me!
90
  * @param boolean $render
91
+ * @param boolean $small
92
  */
93
  public static function donate( $render = true, $small = false ) {
94
+ $donate = '
95
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
96
+ <input type="hidden" name="cmd" value="_donations">
97
+ <input type="hidden" name="business" value="itthinx@itthinx.com">
98
+ <input type="hidden" name="lc" value="US">
99
+ <input type="hidden" name="item_name" value="Support WordPress Plugins from itthinx">
100
+ <input type="hidden" name="item_number" value="WordPress Plugins">
101
+ <input type="hidden" name="no_note" value="0">
102
+ <input type="hidden" name="currency_code" value="EUR">
103
+ <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest">
104
+ <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
105
+ <img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif" width="1" height="1">
106
+ </form>
107
+ ';
 
 
 
 
 
 
 
 
 
 
 
108
  if ( $render ) {
109
  echo $donate;
110
  } else {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.itthinx.com/plugins/groups
4
  Tags: access, access control, capability, capabilities, content, group, groups, member, members, membership, permission, permissions
5
  Requires at least: 3.0
6
  Tested up to: 3.3.1
7
- Stable tag: 1.0.0-beta-3
8
 
9
  Groups provides group-based user membership management, group-based capabilities and content access control.
10
 
@@ -232,6 +232,10 @@ See also [Groups](http://www.itthinx.com/plugins/groups/)
232
 
233
  == Changelog ==
234
 
 
 
 
 
235
  = 1.0.0-beta-3 =
236
  * Groups wouldn't activate due to a fatal error on WP <= 3.2.1 : is_user_member_of_blog() is defined in ms-functions.php
237
  * Added [groups_group_info] shortcode
@@ -245,6 +249,9 @@ See also [Groups](http://www.itthinx.com/plugins/groups/)
245
 
246
  == Upgrade Notice ==
247
 
 
 
 
248
  = 1.0.0-beta-3 =
249
  * New shortcode to show group info & WP <= 3.2.1 compatibility fix.
250
 
4
  Tags: access, access control, capability, capabilities, content, group, groups, member, members, membership, permission, permissions
5
  Requires at least: 3.0
6
  Tested up to: 3.3.1
7
+ Stable tag: 1.0.0-beta-3b
8
 
9
  Groups provides group-based user membership management, group-based capabilities and content access control.
10
 
232
 
233
  == Changelog ==
234
 
235
+ = 1.0.0-beta-3b =
236
+ * Fixed admin override option not being updated
237
+ * DB tables checked individually to create (motivated by case of all but capability table not being created)
238
+
239
  = 1.0.0-beta-3 =
240
  * Groups wouldn't activate due to a fatal error on WP <= 3.2.1 : is_user_member_of_blog() is defined in ms-functions.php
241
  * Added [groups_group_info] shortcode
249
 
250
  == Upgrade Notice ==
251
 
252
+ = 1.0.0-beta-3b =
253
+ * Admin override fix and DB tables checked individually to create them.
254
+
255
  = 1.0.0-beta-3 =
256
  * New shortcode to show group info & WP <= 3.2.1 compatibility fix.
257