Changeset 12990
- Timestamp:
- 07/08/2021 05:23:32 PM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/actions/notices.php
r11925 r12990 93 93 } 94 94 add_action( 'bp_actions', 'bp_messages_action_edit_notice' ); 95 96 /** 97 * Handle user dismissal of sitewide notices. 98 * 99 * @since 9.0.0 100 * 101 * @return bool False on failure. 102 */ 103 function bp_messages_action_dismiss_notice() { 104 105 // Bail if not viewing a notice dismissal URL. 106 if ( ! bp_is_messages_component() || ! bp_is_current_action( 'notices' ) || 'dismiss' !== sanitize_key( bp_action_variable( 0 ) ) ) { 107 return false; 108 } 109 110 // Bail if the current user isn't logged in. 111 if ( ! is_user_logged_in() ) { 112 return false; 113 } 114 115 // Check the nonce. 116 check_admin_referer( 'messages_dismiss_notice' ); 117 118 // Dismiss the notice. 119 $success = bp_messages_dismiss_sitewide_notice(); 120 121 // User feedback. 122 if ( $success ) { 123 $feedback = __( 'Notice has been dismissed.', 'buddypress' ); 124 $type = 'success'; 125 } else { 126 $feedback = __( 'There was a problem dismissing the notice.', 'buddypress'); 127 $type = 'error'; 128 } 129 130 // Add feedback message. 131 bp_core_add_message( $feedback, $type ); 132 133 // Redirect. 134 $redirect_to = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ); 135 136 bp_core_redirect( $redirect_to ); 137 } 138 add_action( 'bp_actions', 'bp_messages_action_dismiss_notice' ); -
trunk/src/bp-messages/bp-messages-template.php
r12592 r12990 1312 1312 1313 1313 /** 1314 * Output the URL for dismissing the current notice for the current user. 1315 * 1316 * @since 9.0.0 1317 * @return string URL for dismissing the current notice for the current user. 1318 */ 1319 function bp_message_notice_dismiss_link() { 1320 echo esc_url( bp_get_message_notice_dismiss_link() ); 1321 } 1322 /** 1323 * Get the URL for dismissing the current notice for the current user. 1324 * 1325 * @since 9.0.0 1326 * @return string URL for dismissing the current notice for the current user. 1327 */ 1328 function bp_get_message_notice_dismiss_link() { 1329 1330 $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/dismiss/' ), 'messages_dismiss_notice' ); 1331 1332 /** 1333 * Filters the URL for dismissing the current notice for the current user. 1334 * 1335 * @since 9.0.0 1336 * 1337 * @param string $link URL for dismissing the current notice. 1338 */ 1339 return apply_filters( 'bp_get_message_notice_dismiss_link', $link ); 1340 } 1341 1342 /** 1314 1343 * Output the messages component slug. 1315 1344 * … … 1360 1389 <div id="message" class="info notice" rel="n-<?php echo esc_attr( $notice->id ); ?>"> 1361 1390 <strong><?php bp_message_notice_subject( $notice ); ?></strong> 1362 < button type="button" id="close-notice" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'Dismiss this notice', 'buddypress' ) ?>"><span class="bp-screen-reader-text"><?php _e( 'Dismiss this notice', 'buddypress' ) ?></span> <span aria-hidden="true">Χ</span></button>1391 <a href="<?php bp_message_notice_dismiss_link(); ?>" id="close-notice" class="bp-tooltip button" data-bp-tooltip="<?php esc_attr_e( 'Dismiss this notice', 'buddypress' ) ?>"><span class="bp-screen-reader-text"><?php _e( 'Dismiss this notice', 'buddypress' ) ?></span> <span aria-hidden="true">Χ</span></a> 1363 1392 <?php bp_message_notice_text( $notice ); ?> 1364 1393 <?php wp_nonce_field( 'bp_messages_close_notice', 'close-notice-nonce' ); ?> -
trunk/src/bp-templates/bp-legacy/css/buddypress-rtl.css
r12734 r12990 1429 1429 1430 1430 .bp-site-wide-message #message button, 1431 .admin-bar-on #message button { 1431 .bp-site-wide-message #message a.button, 1432 .admin-bar-on #message button, 1433 .admin-bar-on #message a.button { 1432 1434 font-size: 0.8em; 1433 1435 padding: 2px 4px; … … 1437 1439 } 1438 1440 1439 .admin-bar-on #message button { 1441 .admin-bar-on #message button, 1442 .admin-bar-on #message a.button { 1440 1443 left: 10px; 1441 1444 top: 7px; -
trunk/src/bp-templates/bp-legacy/css/buddypress.css
r12734 r12990 1429 1429 1430 1430 .bp-site-wide-message #message button, 1431 .admin-bar-on #message button { 1431 .bp-site-wide-message #message a.button, 1432 .admin-bar-on #message button, 1433 .admin-bar-on #message a.button { 1432 1434 font-size: 0.8em; 1433 1435 padding: 2px 4px; … … 1437 1439 } 1438 1440 1439 .admin-bar-on #message button { 1441 .admin-bar-on #message button, 1442 .admin-bar-on #message a.button { 1440 1443 right: 10px; 1441 1444 top: 7px; -
trunk/src/bp-templates/bp-nouveau/buddypress/common/notices/template-notices.php
r12156 r12990 13 13 <?php if ( bp_nouveau_has_dismiss_button() ) : ?> 14 14 15 < button type="button" class="bp-tooltip" data-bp-tooltip="<?php echo esc_attr_x( 'Close', 'button', 'buddypress' ); ?>" aria-label="<?php esc_attr_e( 'Close this notice', 'buddypress' ); ?>" data-bp-close="<?php bp_nouveau_dismiss_button_type(); ?>"><span class="dashicons dashicons-dismiss" aria-hidden="true"></span></button>15 <a href="<?php bp_message_notice_dismiss_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php echo esc_attr_x( 'Close', 'button', 'buddypress' ); ?>" aria-label="<?php esc_attr_e( 'Close this notice', 'buddypress' ); ?>" data-bp-close="<?php bp_nouveau_dismiss_button_type(); ?>"><span class="dashicons dashicons-dismiss" aria-hidden="true"></span></a> 16 16 17 17 <?php endif; ?>
Note: See TracChangeset
for help on using the changeset viewer.