Changeset 1503 for trunk/bp-core.php
- Timestamp:
- 06/03/2009 10:49:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r1482 r1503 1 1 <?php 2 3 2 /* Define the current version number for checking if DB tables are up to date. */ 4 3 define( 'BP_CORE_VERSION', '1.0' ); … … 171 170 add_action( 'plugins_loaded', 'bp_core_setup_root_components', 1 ); 172 171 173 function bp_core_setup_session() { 174 // Start a session for error/success feedback on redirect and for signup functions. 175 @session_start(); 172 function bp_core_setup_cookies() { 173 global $bp_message, $bp_message_type; 176 174 177 175 // Render any error/success feedback on the template 178 if ( $_SESSION['message'] != '' ) 179 add_action( 'template_notices', 'bp_core_render_notice' ); 180 } 181 add_action( 'wp', 'bp_core_setup_session', 3 ); 176 if ( $_COOKIE['bp-message'] == '' || !isset( $_COOKIE['bp-message'] ) ) 177 return false; 178 179 $bp_message = $_COOKIE['bp-message']; 180 $bp_message_type = $_COOKIE['bp-message-type']; 181 add_action( 'template_notices', 'bp_core_render_notice' ); 182 183 setcookie( 'bp-message', false, time() - 1000, COOKIEPATH ); 184 setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH ); 185 } 186 add_action( 'wp', 'bp_core_setup_cookies', 3 ); 182 187 183 188 function bp_core_install() { … … 847 852 if ( !$type ) 848 853 $type = 'success'; 849 850 $_SESSION['message'] = $message;851 $_SESSION['message_type'] = $type;854 855 setcookie( 'bp-message', $message, time()+60*60*24, COOKIEPATH ); 856 setcookie( 'bp-message-type', $type, time()+60*60*24, COOKIEPATH ); 852 857 } 853 858 … … 862 867 */ 863 868 function bp_core_render_notice() { 864 if ( $_ SESSION['message'] ) {865 $type = ( 'success' == $_ SESSION['message_type'] ) ? 'updated' : 'error';869 if ( $_COOKIE['bp-message'] ) { 870 $type = ( 'success' == $_COOKIE['bp-message-type'] ) ? 'updated' : 'error'; 866 871 ?> 867 872 <div id="message" class="<?php echo $type; ?>"> 868 <p><?php echo $_ SESSION['message']; ?></p>873 <p><?php echo $_COOKIE['bp-message']; ?></p> 869 874 </div> 870 <?php 871 unset( $_SESSION['message'] ); 872 unset( $_SESSION['message_type'] ); 873 875 <?php 874 876 do_action( 'bp_core_render_notice' ); 875 877 }
Note: See TracChangeset
for help on using the changeset viewer.