Changeset 6197 for trunk/src/includes/admin/metaboxes.php
- Timestamp:
- 12/29/2016 04:25:54 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/admin/metaboxes.php (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/metaboxes.php
r6115 r6197 294 294 * @uses do_action() Calls 'bbp_forum_metabox' 295 295 */ 296 function bbp_forum_metabox( ) {296 function bbp_forum_metabox( $post ) { 297 297 298 298 // Post ID 299 $post_id = get_the_ID();300 299 $post_parent = bbp_get_global_post_field( 'post_parent', 'raw' ); 301 300 $menu_order = bbp_get_global_post_field( 'menu_order', 'edit' ); … … 308 307 <strong class="label"><?php esc_html_e( 'Type:', 'bbpress' ); ?></strong> 309 308 <label class="screen-reader-text" for="bbp_forum_type_select"><?php esc_html_e( 'Type:', 'bbpress' ) ?></label> 310 <?php bbp_form_forum_type_dropdown( array( 'forum_id' => $post _id) ); ?>309 <?php bbp_form_forum_type_dropdown( array( 'forum_id' => $post->ID ) ); ?> 311 310 </p> 312 311 … … 320 319 <strong class="label"><?php esc_html_e( 'Status:', 'bbpress' ); ?></strong> 321 320 <label class="screen-reader-text" for="bbp_forum_status_select"><?php esc_html_e( 'Status:', 'bbpress' ) ?></label> 322 <?php bbp_form_forum_status_dropdown( array( 'forum_id' => $post _id) ); ?>321 <?php bbp_form_forum_status_dropdown( array( 'forum_id' => $post->ID ) ); ?> 323 322 </p> 324 323 … … 332 331 <strong class="label"><?php esc_html_e( 'Visibility:', 'bbpress' ); ?></strong> 333 332 <label class="screen-reader-text" for="bbp_forum_visibility_select"><?php esc_html_e( 'Visibility:', 'bbpress' ) ?></label> 334 <?php bbp_form_forum_visibility_dropdown( array( 'forum_id' => $post _id) ); ?>333 <?php bbp_form_forum_visibility_dropdown( array( 'forum_id' => $post->ID ) ); ?> 335 334 </p> 336 335 … … 353 352 'order' => 'ASC', 354 353 'walker' => '', 355 'exclude' => $post _id,354 'exclude' => $post->ID, 356 355 357 356 // Output-related … … 374 373 <?php 375 374 wp_nonce_field( 'bbp_forum_metabox_save', 'bbp_forum_metabox' ); 376 do_action( 'bbp_forum_metabox', $post _id);375 do_action( 'bbp_forum_metabox', $post ); 377 376 } 378 377 … … 389 388 * @uses do_action() Calls 'bbp_topic_metabox' 390 389 */ 391 function bbp_topic_metabox() { 392 393 // Post ID 394 $post_id = get_the_ID(); 395 $status = get_post_status( $post_id ); 390 function bbp_topic_metabox( $post ) { 396 391 397 392 /** Type ******************************************************************/ … … 402 397 <strong class="label"><?php esc_html_e( 'Type:', 'bbpress' ); ?></strong> 403 398 <label class="screen-reader-text" for="bbp_stick_topic"><?php esc_html_e( 'Topic Type', 'bbpress' ); ?></label> 404 <?php bbp_form_topic_type_dropdown( array( 'topic_id' => $post _id) ); ?>399 <?php bbp_form_topic_type_dropdown( array( 'topic_id' => $post->ID ) ); ?> 405 400 </p> 406 401 … … 413 408 <p> 414 409 <strong class="label"><?php esc_html_e( 'Status:', 'bbpress' ); ?></strong> 415 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $ status ) ? 'draft' : $status ); ?>" />410 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $post->post_status ) ? 'draft' : $post->post_status ); ?>" /> 416 411 <label class="screen-reader-text" for="bbp_open_close_topic"><?php esc_html_e( 'Select whether to open or close the topic.', 'bbpress' ); ?></label> 417 <?php bbp_form_topic_status_dropdown( array( 'select_id' => 'post_status', 'topic_id' => $post _id) ); ?>412 <?php bbp_form_topic_status_dropdown( array( 'select_id' => 'post_status', 'topic_id' => $post->ID ) ); ?> 418 413 </p> 419 414 … … 431 426 <?php bbp_dropdown( array( 432 427 'post_type' => bbp_get_forum_post_type(), 433 'selected' => bbp_get_topic_forum_id( $post _id),428 'selected' => bbp_get_topic_forum_id( $post->ID ), 434 429 'numberposts' => -1, 435 430 'orderby' => 'title', … … 451 446 <?php 452 447 wp_nonce_field( 'bbp_topic_metabox_save', 'bbp_topic_metabox' ); 453 do_action( 'bbp_topic_metabox', $post _id);448 do_action( 'bbp_topic_metabox', $post ); 454 449 } 455 450 … … 466 461 * @uses do_action() Calls 'bbp_reply_metabox' 467 462 */ 468 function bbp_reply_metabox() { 469 470 // Post ID 471 $post_id = get_the_ID(); 472 $status = get_post_status( $post_id ); 463 function bbp_reply_metabox( $post ) { 473 464 474 465 // Get some meta 475 $reply_topic_id = bbp_get_reply_topic_id( $post _id);476 $reply_forum_id = bbp_get_reply_forum_id( $post _id);466 $reply_topic_id = bbp_get_reply_topic_id( $post->ID ); 467 $reply_forum_id = bbp_get_reply_forum_id( $post->ID ); 477 468 $topic_forum_id = bbp_get_topic_forum_id( $reply_topic_id ); 478 469 … … 483 474 <p> 484 475 <strong class="label"><?php esc_html_e( 'Status:', 'bbpress' ); ?></strong> 485 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $ status ) ? 'draft' : $status ); ?>" />476 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $post->post_status ) ? 'draft' : $post->post_status ); ?>" /> 486 477 <label class="screen-reader-text" for="post_status"><?php esc_html_e( 'Select what status to give the reply.', 'bbpress' ); ?></label> 487 <?php bbp_form_reply_status_dropdown( array( 'select_id' => 'post_status', 'reply_id' => $post _id) ); ?>478 <?php bbp_form_reply_status_dropdown( array( 'select_id' => 'post_status', 'reply_id' => $post->ID ) ); ?> 488 479 </p> 489 480 … … 495 486 496 487 // Only allow individual manipulation of reply forum if there is a mismatch 497 if ( ( $reply_forum_id !== $topic_forum_id ) && ( current_user_can( 'edit_others_replies' ) || current_user_can( 'moderate', $post _id) ) ) : ?>488 if ( ( $reply_forum_id !== $topic_forum_id ) && ( current_user_can( 'edit_others_replies' ) || current_user_can( 'moderate', $post->ID ) ) ) : ?> 498 489 499 490 <p> … … 540 531 <strong class="label"><?php esc_html_e( 'Reply To:', 'bbpress' ); ?></strong> 541 532 <label class="screen-reader-text" for="bbp_reply_to"><?php esc_html_e( 'Reply To', 'bbpress' ); ?></label> 542 <?php bbp_reply_to_dropdown( $post _id); ?>533 <?php bbp_reply_to_dropdown( $post->ID ); ?> 543 534 </p> 544 535 … … 553 544 <?php 554 545 wp_nonce_field( 'bbp_reply_metabox_save', 'bbp_reply_metabox' ); 555 do_action( 'bbp_reply_metabox', $post _id);546 do_action( 'bbp_reply_metabox', $post ); 556 547 } 557 548 … … 574 565 // Pull in the list table class 575 566 if ( ! class_exists( 'BBP_Topic_Replies_List_Table' ) ) { 576 include_once bbpress()->admin->admin_dir . '/list-tables/topic-replies.php';567 require_once bbpress()->admin->admin_dir . '/list-tables/topic-replies.php'; 577 568 } 578 569 … … 602 593 * @since 2.0.0 bbPress (r2828) 603 594 * 595 * @param WP_Post $post The current post object 604 596 * @uses bbp_is_reply_anonymous() To check if reply is anonymous 605 597 * @uses bbp_is_topic_anonymous() To check if topic is anonymous 606 * @uses get_the_ID() To get the global post ID607 598 * @uses get_post_meta() To get the author user information 608 599 */ 609 function bbp_author_metabox() { 610 611 // Post ID 612 $post_id = get_the_ID(); 600 function bbp_author_metabox( $post ) { 613 601 614 602 // Show extra bits if topic/reply is anonymous 615 if ( bbp_is_reply_anonymous( $post _id ) || bbp_is_topic_anonymous( $post_id) ) : ?>603 if ( bbp_is_reply_anonymous( $post->ID ) || bbp_is_topic_anonymous( $post->ID ) ) : ?> 616 604 617 605 <p> 618 606 <strong class="label"><?php esc_html_e( 'Name:', 'bbpress' ); ?></strong> 619 607 <label class="screen-reader-text" for="bbp_anonymous_name"><?php esc_html_e( 'Name', 'bbpress' ); ?></label> 620 <input type="text" id="bbp_anonymous_name" name="bbp_anonymous_name" value="<?php echo esc_attr( get_post_meta( $post _id, '_bbp_anonymous_name', true ) ); ?>" />608 <input type="text" id="bbp_anonymous_name" name="bbp_anonymous_name" value="<?php echo esc_attr( get_post_meta( $post->ID, '_bbp_anonymous_name', true ) ); ?>" /> 621 609 </p> 622 610 … … 624 612 <strong class="label"><?php esc_html_e( 'Email:', 'bbpress' ); ?></strong> 625 613 <label class="screen-reader-text" for="bbp_anonymous_email"><?php esc_html_e( 'Email', 'bbpress' ); ?></label> 626 <input type="text" id="bbp_anonymous_email" name="bbp_anonymous_email" value="<?php echo esc_attr( get_post_meta( $post _id, '_bbp_anonymous_email', true ) ); ?>" />614 <input type="text" id="bbp_anonymous_email" name="bbp_anonymous_email" value="<?php echo esc_attr( get_post_meta( $post->ID, '_bbp_anonymous_email', true ) ); ?>" /> 627 615 </p> 628 616 … … 630 618 <strong class="label"><?php esc_html_e( 'Website:', 'bbpress' ); ?></strong> 631 619 <label class="screen-reader-text" for="bbp_anonymous_website"><?php esc_html_e( 'Website', 'bbpress' ); ?></label> 632 <input type="text" id="bbp_anonymous_website" name="bbp_anonymous_website" value="<?php echo esc_attr( get_post_meta( $post _id, '_bbp_anonymous_website', true ) ); ?>" />620 <input type="text" id="bbp_anonymous_website" name="bbp_anonymous_website" value="<?php echo esc_attr( get_post_meta( $post->ID, '_bbp_anonymous_website', true ) ); ?>" /> 633 621 </p> 634 622 … … 646 634 <strong class="label"><?php esc_html_e( 'IP:', 'bbpress' ); ?></strong> 647 635 <label class="screen-reader-text" for="bbp_author_ip_address"><?php esc_html_e( 'IP Address', 'bbpress' ); ?></label> 648 <input type="text" id="bbp_author_ip_address" name="bbp_author_ip_address" value="<?php echo esc_attr( get_post_meta( $post _id, '_bbp_author_ip', true ) ); ?>" disabled="disabled" />649 </p> 650 651 <?php 652 653 do_action( 'bbp_author_metabox', $post _id);636 <input type="text" id="bbp_author_ip_address" name="bbp_author_ip_address" value="<?php echo esc_attr( get_post_meta( $post->ID, '_bbp_author_ip', true ) ); ?>" disabled="disabled" /> 637 </p> 638 639 <?php 640 641 do_action( 'bbp_author_metabox', $post ); 654 642 } 655 643 … … 662 650 * @uses get_post_meta() To get the author user information 663 651 */ 664 function bbp_moderator_assignment_metabox() { 665 666 // Post ID 667 $object_id = get_the_ID(); 668 $user_ids = bbp_get_moderator_ids( $object_id ); 652 function bbp_moderator_assignment_metabox( $post ) { 653 654 // Get nicenames 655 $user_ids = bbp_get_moderator_ids( $post->ID ); 669 656 $user_nicenames = bbp_get_user_nicenames_from_ids( $user_ids ); 670 657 $moderators = ! empty( $user_nicenames ) … … 679 666 <?php 680 667 681 do_action( 'bbp_moderator_assignment_metabox', $object_id ); 682 } 668 do_action( 'bbp_moderator_assignment_metabox', $post ); 669 } 670 671 /** 672 * See who marked a topic as a favorite 673 * 674 * @since 2.6.0 bbPress (r6179) 675 */ 676 function bbp_topic_favorites_metabox( $post ) { 677 678 // Get user IDs 679 $user_ids = bbp_get_topic_favoriters( $post->ID ); 680 681 // Output 682 ?><p><?php 683 684 // Users were found 685 if ( ! empty( $user_ids ) ) : 686 687 foreach ( $user_ids as $user_id ) : 688 echo get_avatar( $user_id, 32 ); 689 endforeach; 690 691 // No users 692 else : 693 esc_html_e( 'No users have favorited this topic.', 'bbpress' ); 694 endif; 695 696 ?></p><?php 697 698 do_action( 'bbp_favorites_metabox', $post ); 699 } 700 701 /** 702 * See who subscribed to a topic 703 * 704 * @since 2.6.0 bbPress (r6179) 705 */ 706 function bbp_topic_subscriptions_metabox( $post ) { 707 708 // Get user IDs 709 $user_ids = bbp_get_topic_subscribers( $post->ID ); 710 711 // Output 712 ?><p><?php 713 714 // Users were found 715 if ( ! empty( $user_ids ) ) : 716 717 foreach ( $user_ids as $user_id ) : 718 echo get_avatar( $user_id, 32 ); 719 endforeach; 720 721 // No users 722 else : 723 esc_html_e( 'No users have subscribed to this topic.', 'bbpress' ); 724 endif; 725 726 ?></p><?php 727 728 do_action( 'bbp_subscriptions_metabox', $post ); 729 } 730 731 /** 732 * See who subscribed to a forum 733 * 734 * @since 2.6.0 bbPress (r6179) 735 */ 736 function bbp_forum_subscriptions_metabox( $post ) { 737 738 // Get user IDs 739 $user_ids = bbp_get_forum_subscribers( $post->ID ); 740 741 // Output 742 ?><p><?php 743 744 // Users were found 745 if ( ! empty( $user_ids ) ) : 746 747 foreach ( $user_ids as $user_id ) : 748 echo get_avatar( $user_id, 32 ); 749 endforeach; 750 751 // No users 752 else : 753 esc_html_e( 'No users have subscribed to this forum.', 'bbpress' ); 754 endif; 755 756 ?></p><?php 757 758 do_action( 'bbp_forum_subscriptions_metabox', $post ); 759 }
Note: See TracChangeset
for help on using the changeset viewer.