Changeset 4390
- Timestamp:
- 11/11/2012 07:14:21 PM (14 years ago)
- Location:
- trunk/includes
- Files:
-
- 4 edited
-
admin/actions.php (modified) (2 diffs)
-
admin/functions.php (modified) (1 diff)
-
core/actions.php (modified) (1 diff)
-
core/update.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/actions.php
r4347 r4390 55 55 add_action( 'bbp_admin_init', 'bbp_register_admin_style' ); 56 56 add_action( 'bbp_admin_init', 'bbp_register_admin_settings' ); 57 add_action( 'bbp_admin_init', 'bbp_do_activation_redirect', 1 ); 57 58 58 59 // Initialize the admin area … … 63 64 64 65 // Activation 65 add_action( 'bbp_activation', 'bbp_delete_rewrite_rules' );66 add_action( 'bbp_activation', 'bbp_delete_rewrite_rules' ); 66 67 67 68 // Deactivation 68 69 add_action( 'bbp_deactivation', 'bbp_remove_caps' ); 69 70 add_action( 'bbp_deactivation', 'bbp_delete_rewrite_rules' ); 70 add_action( 'bbp_deactivation', 'bbp_deactivated' );71 71 72 72 // New Site -
trunk/includes/admin/functions.php
r4347 r4390 144 144 145 145 /** 146 * We are activating bbPress 147 * 148 * @since bbPress (r4152) 149 */ 150 function bbp_activating() { 151 update_option( '_bbp_activated', '0' ); 152 } 153 154 /** 155 * bbPress is activated 156 * 157 * @since bbPress (r4152) 158 */ 159 function bbp_activated() { 160 update_option( '_bbp_activated', '1' ); 161 } 162 163 /** 164 * bbPress is deactivated 165 * 166 * @since bbPress (r4152) 167 */ 168 function bbp_deactivated() { 169 delete_option( '_bbp_activated' ); 170 } 171 172 function bbp_activation_redirect() { 173 if ( ! get_option( '_bbp_activated' ) || bbp_is_activation() ) 174 return; 175 176 wp_safe_redirect( admin_url( add_query_arg( array( 'page' => 'bbp-about' ), 'index.php' ) ) ); 177 exit(); 146 * Redirect user to bbPress's What's New page on activation 147 * 148 * @since bbPress (r4389) 149 * 150 * @internal Used internally to redirect bbPress to the about page on activation 151 * 152 * @uses get_transient() To see if transient to redirect exists 153 * @uses delete_transient() To delete the transient if it exists 154 * @uses is_network_admin() To bail if being network activated 155 * @uses wp_safe_redirect() To redirect 156 * @uses add_query_arg() To help build the URL to redirect to 157 * @uses admin_url() To get the admin URL to index.php 158 * 159 * @return If no transient, or in network admin, or is bulk activation 160 */ 161 function bbp_do_activation_redirect() { 162 163 // Bail if no activation redirect 164 if ( ! get_transient( '_bbp_activation_redirect' ) ) 165 return; 166 167 // Delete the redirect transient 168 delete_transient( '_bbp_activation_redirect' ); 169 170 // Bail if activating from network, or bulk 171 if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) 172 return; 173 174 // Redirect to bbPress about page 175 wp_safe_redirect( add_query_arg( array( 'page' => 'bbp-about' ), admin_url( 'index.php' ) ) ); 178 176 } 179 177 -
trunk/includes/core/actions.php
r4375 r4390 293 293 add_action( 'bbp_login_form_login', 'bbp_user_maybe_convert_pass' ); 294 294 295 add_action( 'bbp_activation', 'bbp_add_activation_redirect' ); 296 295 297 /** 296 298 * Requires and creates the BuddyPress extension, and adds component creation -
trunk/includes/core/update.php
r4334 r4390 268 268 bbp_delete_rewrite_rules(); 269 269 } 270 271 /** 272 * Redirect user to bbPress's What's New page on activation 273 * 274 * @since bbPress (r4389) 275 * 276 * @internal Used internally to redirect bbPress to the about page on activation 277 * 278 * @uses is_network_admin() To bail if being network activated 279 * @uses set_transient() To drop the activation transient for 30 seconds 280 * 281 * @return If network admin or bulk activation 282 */ 283 function bbp_add_activation_redirect() { 284 285 // Bail if activating from network, or bulk 286 if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) 287 return; 288 289 // Add the transient to redirect 290 set_transient( '_bbp_activation_redirect', true, 30 ); 291 }
Note: See TracChangeset
for help on using the changeset viewer.