Ticket #1988: 1988.sample.diff
File 1988.sample.diff, 3.0 KB (added by , 10 years ago) |
---|
-
src/includes/common/template.php
2527 2527 <?php endif; 2528 2528 } 2529 2529 2530 /** 2531 * Display a notice to the user at the top of the page 2532 */ 2533 2534 function bbp_posting_notices(){ 2535 2536 $query_args = $_GET; 2537 $bbpid = $_GET['bbpid']; 2538 2539 // If the post id has been passed through, get the type if possible otherwise assume 'post' 2540 if( !empty( $bbpid ) ){ 2541 $post_type = ( get_post_type( (int)$bbpid ) ) ? get_post_type( (int)$bbpid ) : '<<em>not a valid post id</em>>'; 2542 } 2543 else{ 2544 $post_type = 'post'; 2545 } 2546 2547 foreach( $query_args as $param => $arg ){ 2548 2549 if( $param =='pending' ){ 2550 $notices[] = __( 'Your ' . $post_type . ' has been submitted successfully and is pending moderator approval.', 'bbpress' ); 2551 } 2552 if( $param == 'test' ){ 2553 $notices[] = __( 'This is a test, this is only a test.', 'bbpress' ); 2554 } 2555 2556 } 2557 2558 $notices = apply_filters( 'bbp_posting_notices', $notices, $post_type ); 2559 2560 if( !empty( $notices ) ){ 2561 2562 $notice_list = '<div class="bbp-template-notice error">'; 2563 $notice_list .= '<ul>'; 2564 2565 foreach( $notices as $notice ){ 2566 2567 $notice_list .= '<li>' . $notice . '</li>'; 2568 } 2569 2570 $notice_list .= '</ul>'; 2571 $notice_list .= '</div>'; 2572 2573 echo $notice_list; 2574 } 2575 2576 } 2577 2530 2578 /** Login/logout/register/lost pass *******************************************/ 2531 2579 2532 2580 /** -
src/includes/core/actions.php
155 155 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_success' ); 156 156 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_is_super_admin', 2 ); 157 157 158 add_action( 'bbp_template_before_single_topic', 'bbp_posting_notices' ); 159 158 160 // Before Delete/Trash/Untrash Forum 159 161 add_action( 'wp_trash_post', 'bbp_trash_forum' ); 160 162 add_action( 'trash_post', 'bbp_trash_forum' ); -
src/templates/default/bbpress-functions.php
85 85 /** Override **********************************************************/ 86 86 87 87 do_action_ref_array( 'bbp_theme_compat_actions', array( &$this ) ); 88 89 /** Test posting notice filter */ 90 add_filter( 'bbp_posting_notices', array( $this, 'mjj_custom_notices' ), 10, 2 ); 88 91 } 89 92 90 93 /** … … 460 463 // Action succeeded 461 464 bbp_ajax_response( true, bbp_get_user_subscribe_link( $attrs, $user_id, false ), 200 ); 462 465 } 466 467 function mjj_custom_notices( $notices, $post_type = '' ){ 468 $notices['filter_test'] = __('This is a test of the filter and if there is valid bbpid in the query string, the post type will be here: ' . $post_type ); 469 return $notices; 470 } 463 471 } 464 472 new BBP_Default(); 465 473 endif;