Ticket #2432: 2432.2.patch
File 2432.2.patch, 3.8 KB (added by , 14 years ago) |
---|
-
bp-themes/bp-default/_inc/css/default.css
541 541 margin: 20px 0; 542 542 } 543 543 544 span.activity, div#message p {544 span.activity, div#message p, div.message p { 545 545 display: inline-block; 546 546 font-size: 11px; 547 547 font-weight: normal; … … 610 610 /* > Error / Success Messages 611 611 -------------------------------------------------------------- */ 612 612 613 div#message {613 div#message, div.message { 614 614 margin: 15px 0; 615 615 } 616 div#message.updated { clear: both; }616 div#message.updated, div#template-messages div.updated { clear: both; } 617 617 618 div#message p {618 div#message p, div.message p { 619 619 padding: 10px 15px; 620 620 font-size: 12px; 621 621 display:block; 622 622 } 623 div#message.error p {623 div#message.error p, div#template-messages div.error p { 624 624 background: #e41717; 625 625 color: #fff; 626 626 border-color: #a71a1a; 627 627 clear: left; 628 628 } 629 629 630 div#message.updated p {630 div#message.updated p, div#template-messages div.updated p { 631 631 background: #dffcd9; 632 632 color: #1a9b00; 633 633 border-color: #c4e9bd; -
bp-core.php
1282 1282 */ 1283 1283 function bp_core_add_message( $message, $type = false ) { 1284 1284 global $bp; 1285 1285 1286 1286 if ( !$type ) 1287 1287 $type = 'success'; 1288 1289 if ( empty( $message ) ) 1290 return; 1291 1292 $messages = isset( $bp->template_message ) ? $bp->template_message : array(); 1288 1293 1289 /* Send the values to the cookie for page reload display */ 1290 @setcookie( 'bp-message', $message, time()+60*60*24, COOKIEPATH ); 1291 @setcookie( 'bp-message-type', $type, time()+60*60*24, COOKIEPATH ); 1292 1294 $messages[] = array( 'content' => $message, 'type' => $type ); 1295 1293 1296 /*** 1294 1297 * Send the values to the $bp global so we can still output messages 1295 1298 * without a page reload 1296 1299 */ 1297 $bp->template_message = $message; 1298 $bp->template_message_type = $type; 1300 $bp->template_message = $messages; 1301 1302 /* This is to prevent problems with cookies handling serialized strings */ 1303 $messages = base64_encode( maybe_serialize( $messages ) ); 1304 1305 /* Send the values to the cookie for page reload display */ 1306 @setcookie( 'bp-message', $messages, time()+60*60*24, COOKIEPATH ); 1299 1307 } 1300 1308 1301 1309 /** … … 1315 1323 function bp_core_setup_message() { 1316 1324 global $bp; 1317 1325 1318 if ( empty( $bp->template_message ) && isset( $_COOKIE['bp-message'] ) ) 1319 $bp->template_message = $_COOKIE['bp-message']; 1326 if ( empty( $bp->template_message ) && isset( $_COOKIE['bp-message'] ) ) { 1327 $bp->template_message = maybe_unserialize( imap_base64 ( $_COOKIE['bp-message'] ) ); 1328 } 1320 1329 1321 if ( empty( $bp->template_message_type ) && isset( $_COOKIE['bp-message-type'] ) )1322 $bp->template_message_type = $_COOKIE['bp-message-type'];1323 1324 1330 add_action( 'template_notices', 'bp_core_render_message' ); 1325 1331 1326 1332 @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH ); 1327 @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );1328 1333 } 1329 1334 add_action( 'wp', 'bp_core_setup_message', 2 ); 1330 1335 … … 1341 1346 global $bp; 1342 1347 1343 1348 if ( $bp->template_message ) { 1344 $type = ( 'success' == $bp->template_message_type ) ? 'updated' : 'error'; 1345 ?> 1346 <div id="message" class="<?php echo $type; ?>"> 1347 <p><?php echo stripslashes( esc_attr( $bp->template_message ) ); ?></p> 1349 do_action( 'bp_core_before_render_message' ); 1350 ?> 1351 1352 <div id="template-messages"> 1353 1354 <?php foreach( (array)$bp->template_message as $message ) : ?> 1355 <div class="<?php echo ( 'success' == $message['type'] ) ? 'updated' : 'error'; ?> message"> 1356 <p><?php echo stripslashes( esc_attr( $message['content'] ) ); ?></p> 1357 </div> 1358 <?php endforeach ?> 1359 1348 1360 </div> 1349 <?php 1361 1362 <?php 1350 1363 do_action( 'bp_core_render_message' ); 1351 1364 } 1352 1365 }