bbPress - Version 2.5.12

Version Description

  • Fix role initialization bug
Download this release

Release Info

Developer johnjamesjacoby
Plugin Icon 128x128 bbPress
Version 2.5.12
Comparing to
See all releases

Code changes from version 2.5.11 to 2.5.12

bbpress.php CHANGED
@@ -5,7 +5,7 @@
5
  *
6
  * bbPress is forum software with a twist from the creators of WordPress.
7
  *
8
- * $Id: bbpress.php 6122 2016-11-09 23:03:53Z johnjamesjacoby $
9
  *
10
  * @package bbPress
11
  * @subpackage Main
@@ -17,7 +17,7 @@
17
  * Description: bbPress is forum software with a twist from the creators of WordPress.
18
  * Author: The bbPress Community
19
  * Author URI: https://bbpress.org
20
- * Version: 2.5.11
21
  * Text Domain: bbpress
22
  * Domain Path: /languages/
23
  */
@@ -190,7 +190,7 @@ final class bbPress {
190
 
191
  /** Versions **********************************************************/
192
 
193
- $this->version = '2.5.11-6121';
194
  $this->db_version = '250';
195
 
196
  /** Paths *************************************************************/
5
  *
6
  * bbPress is forum software with a twist from the creators of WordPress.
7
  *
8
+ * $Id: bbpress.php 6148 2016-12-09 07:37:52Z johnjamesjacoby $
9
  *
10
  * @package bbPress
11
  * @subpackage Main
17
  * Description: bbPress is forum software with a twist from the creators of WordPress.
18
  * Author: The bbPress Community
19
  * Author URI: https://bbpress.org
20
+ * Version: 2.5.12
21
  * Text Domain: bbpress
22
  * Domain Path: /languages/
23
  */
190
 
191
  /** Versions **********************************************************/
192
 
193
+ $this->version = '2.5.12-6148';
194
  $this->db_version = '250';
195
 
196
  /** Paths *************************************************************/
includes/admin/converter.php CHANGED
@@ -552,15 +552,19 @@ class BBP_Converter {
552
 
553
  /** Translator ****************************************************/
554
 
555
- $sql = "CREATE TABLE {$table_name} (
 
 
 
556
  meta_id mediumint(8) unsigned not null auto_increment,
557
  value_type varchar(25) null,
558
  value_id bigint(20) unsigned not null default '0',
559
- meta_key varchar(25) null,
560
- meta_value varchar(25) null,
561
- PRIMARY KEY (meta_id),
562
  KEY value_id (value_id),
563
- KEY meta_join (meta_key, meta_value) ) {$charset_collate};";
 
564
 
565
  dbDelta( $sql );
566
  }
552
 
553
  /** Translator ****************************************************/
554
 
555
+ $sql = array();
556
+ $max_index_length = 191;
557
+
558
+ $sql[] = "CREATE TABLE {$table_name} (
559
  meta_id mediumint(8) unsigned not null auto_increment,
560
  value_type varchar(25) null,
561
  value_id bigint(20) unsigned not null default '0',
562
+ meta_key varchar(255) null,
563
+ meta_value varchar(255) null,
564
+ PRIMARY KEY (meta_id),
565
  KEY value_id (value_id),
566
+ KEY meta_join (meta_key({$max_index_length}), meta_value({$max_index_length}))
567
+ ) {$charset_collate};";
568
 
569
  dbDelta( $sql );
570
  }
includes/core/actions.php CHANGED
@@ -45,6 +45,7 @@ add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 10 );
45
  add_action( 'wp_enqueue_scripts', 'bbp_enqueue_scripts', 10 );
46
  add_action( 'wp_head', 'bbp_head', 10 );
47
  add_action( 'wp_footer', 'bbp_footer', 10 );
 
48
  add_action( 'set_current_user', 'bbp_setup_current_user', 10 );
49
  add_action( 'setup_theme', 'bbp_setup_theme', 10 );
50
  add_action( 'after_setup_theme', 'bbp_after_setup_theme', 10 );
@@ -84,17 +85,9 @@ add_action( 'bbp_init', 'bbp_add_permastructs', 40 );
84
  add_action( 'bbp_init', 'bbp_ready', 999 );
85
 
86
  /**
87
- * There is no action API for roles to use, so hook in immediately after
88
- * everything is included (including the theme's functions.php. This is after
89
- * the $wp_roles global is set but before $wp->init().
90
- *
91
- * If it's hooked in any sooner, role names may not be translated correctly.
92
- *
93
- * @link http://bbpress.trac.wordpress.org/ticket/2219
94
- *
95
- * This is kind of lame, but is all we have for now.
96
  */
97
- add_action( 'bbp_after_setup_theme', 'bbp_add_forums_roles', 1 );
98
 
99
  /**
100
  * When setting up the current user, make sure they have a role for the forums.
45
  add_action( 'wp_enqueue_scripts', 'bbp_enqueue_scripts', 10 );
46
  add_action( 'wp_head', 'bbp_head', 10 );
47
  add_action( 'wp_footer', 'bbp_footer', 10 );
48
+ add_action( 'wp_roles_init', 'bbp_roles_init', 10 );
49
  add_action( 'set_current_user', 'bbp_setup_current_user', 10 );
50
  add_action( 'setup_theme', 'bbp_setup_theme', 10 );
51
  add_action( 'after_setup_theme', 'bbp_after_setup_theme', 10 );
85
  add_action( 'bbp_init', 'bbp_ready', 999 );
86
 
87
  /**
88
+ * bbp_roles_init - Attached to 'wp_roles_init' above
 
 
 
 
 
 
 
 
89
  */
90
+ add_action( 'bbp_roles_init', 'bbp_add_forums_roles', 1 );
91
 
92
  /**
93
  * When setting up the current user, make sure they have a role for the forums.
includes/core/capabilities.php CHANGED
@@ -292,19 +292,27 @@ function bbp_get_blog_roles() {
292
  *
293
  * @since bbPress (r4290)
294
  *
 
 
295
  * @uses bbp_get_wp_roles() To load and get the $wp_roles global
296
  * @uses bbp_get_dynamic_roles() To get and add bbPress's roles to $wp_roles
297
  * @return WP_Roles The main $wp_roles global
298
  */
299
- function bbp_add_forums_roles() {
300
- $wp_roles = bbp_get_wp_roles();
 
 
 
 
301
 
 
302
  foreach ( bbp_get_dynamic_roles() as $role_id => $details ) {
303
  $wp_roles->roles[$role_id] = $details;
304
  $wp_roles->role_objects[$role_id] = new WP_Role( $role_id, $details['capabilities'] );
305
  $wp_roles->role_names[$role_id] = $details['name'];
306
  }
307
 
 
308
  return $wp_roles;
309
  }
310
 
292
  *
293
  * @since bbPress (r4290)
294
  *
295
+ * @param WP_Roles $wp_roles The main WordPress roles global
296
+ *
297
  * @uses bbp_get_wp_roles() To load and get the $wp_roles global
298
  * @uses bbp_get_dynamic_roles() To get and add bbPress's roles to $wp_roles
299
  * @return WP_Roles The main $wp_roles global
300
  */
301
+ function bbp_add_forums_roles( $wp_roles = null ) {
302
+
303
+ // Attempt to get global roles if not passed in & not mid-initialization
304
+ if ( ( null === $wp_roles ) && ! doing_action( 'wp_roles_init' ) ) {
305
+ $wp_roles = bbp_get_wp_roles();
306
+ }
307
 
308
+ // Loop through dynamic roles and add them to the $wp_roles array
309
  foreach ( bbp_get_dynamic_roles() as $role_id => $details ) {
310
  $wp_roles->roles[$role_id] = $details;
311
  $wp_roles->role_objects[$role_id] = new WP_Role( $role_id, $details['capabilities'] );
312
  $wp_roles->role_names[$role_id] = $details['name'];
313
  }
314
 
315
+ // Return the modified $wp_roles array
316
  return $wp_roles;
317
  }
318
 
includes/core/sub-actions.php CHANGED
@@ -132,6 +132,19 @@ function bbp_widgets_init() {
132
  do_action( 'bbp_widgets_init' );
133
  }
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  /**
136
  * Setup the currently logged-in user
137
  *
132
  do_action( 'bbp_widgets_init' );
133
  }
134
 
135
+ /**
136
+ * Initialize roles
137
+ *
138
+ * @since bbPress (r6147)
139
+ *
140
+ * @param WP_Roles $wp_roles The main WordPress roles global
141
+ *
142
+ * @uses do_action() Calls 'bbp_roles_init'
143
+ */
144
+ function bbp_roles_init( $wp_roles = null ) {
145
+ do_action( 'bbp_roles_init', $wp_roles );
146
+ }
147
+
148
  /**
149
  * Setup the currently logged-in user
150
  *
languages/bbpress.pot CHANGED
@@ -4959,4 +4959,3 @@ msgstr ""
4959
  #. Author of the plugin/theme
4960
  msgid "The bbPress Community"
4961
  msgstr ""
4962
-
4959
  #. Author of the plugin/theme
4960
  msgid "The bbPress Community"
4961
  msgstr ""
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === bbPress ===
2
  Contributors: matt, johnjamesjacoby, jmdodd, netweb
3
  Tags: forums, discussion, support, theme, akismet, multisite
4
- Requires at least: 4.2
5
  Tested up to: 4.7
6
- Stable tag: 2.5.11
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -38,18 +38,11 @@ We're keeping things as small and light as possible while still allowing for gre
38
  1. Visit 'Settings > Forums' and adjust your configuration.
39
  2. Adjust the CSS of your theme as needed, to make everything pretty.
40
 
41
- == Screenshots ==
42
-
43
- 1. Forums - Admin Interface
44
- 2. Topics - Admin Interface
45
- 3. Replies - Admin Interface
46
- 4. Settings - Admin Interface
47
- 5. Settings 2 - Admin Interface
48
- 6. Themes - Admin Interface
49
- 7. Single Forum - Default Theme
50
-
51
  == Changelog ==
52
 
 
 
 
53
  = 2.5.11 =
54
  * Improved support for WordPress 4.7
55
  * Improved localization of role names
1
  === bbPress ===
2
  Contributors: matt, johnjamesjacoby, jmdodd, netweb
3
  Tags: forums, discussion, support, theme, akismet, multisite
4
+ Requires at least: 4.7
5
  Tested up to: 4.7
6
+ Stable tag: 2.5.12
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
38
  1. Visit 'Settings > Forums' and adjust your configuration.
39
  2. Adjust the CSS of your theme as needed, to make everything pretty.
40
 
 
 
 
 
 
 
 
 
 
 
41
  == Changelog ==
42
 
43
+ = 2.5.12 =
44
+ * Fix role initialization bug
45
+
46
  = 2.5.11 =
47
  * Improved support for WordPress 4.7
48
  * Improved localization of role names