Changeset 6197
- Timestamp:
- 12/29/2016 04:25:54 AM (4 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/forums.php
r6190 r6197 73 73 74 74 // Metabox actions 75 add_action( 'add_meta_boxes', array( $this, 'attributes_metabox' ) ); 76 add_action( 'add_meta_boxes', array( $this, 'moderators_metabox' ) ); 77 add_action( 'add_meta_boxes', array( $this, 'comments_metabox' ) ); 78 add_action( 'save_post', array( $this, 'save_meta_boxes' ) ); 75 add_action( 'add_meta_boxes', array( $this, 'attributes_metabox' ) ); 76 add_action( 'add_meta_boxes', array( $this, 'moderators_metabox' ) ); 77 add_action( 'add_meta_boxes', array( $this, 'subscriptions_metabox' ) ); 78 add_action( 'add_meta_boxes', array( $this, 'comments_metabox' ) ); 79 add_action( 'save_post', array( $this, 'save_meta_boxes' ) ); 79 80 80 81 // Check if there are any bbp_toggle_forum_* requests on admin_init, also have a message displayed … … 229 230 */ 230 231 public function attributes_metabox() { 231 232 // Meta data233 232 add_meta_box( 234 233 'bbp_forum_attributes', … … 239 238 'high' 240 239 ); 241 242 do_action( 'bbp_forum_attributes_metabox' );243 240 } 244 241 … … 268 265 'high' 269 266 ); 270 271 do_action( 'bbp_forum_moderators_metabox' ); 267 } 268 269 /** 270 * Add the subscriptions metabox 271 * 272 * Allows viewing of users who have subscribed to a forum. 273 * 274 * @since 2.6.0 bbPress (r6179) 275 * 276 * @uses add_meta_box() To add the metabox 277 */ 278 public function subscriptions_metabox() { 279 280 // Bail if post_type is not a reply 281 if ( empty( $_GET['action'] ) || ( 'edit' !== $_GET['action'] ) ) { 282 return; 283 } 284 285 // Bail if no subscriptions 286 if ( ! bbp_is_subscriptions_active() ) { 287 return; 288 } 289 290 // Add the metabox 291 add_meta_box( 292 'bbp_forum_subscriptions_metabox', 293 __( 'Subscriptions', 'bbpress' ), 294 'bbp_forum_subscriptions_metabox', 295 $this->post_type, 296 'normal', 297 'high' 298 ); 272 299 } 273 300 -
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 } -
trunk/src/includes/admin/replies.php
r6190 r6197 341 341 */ 342 342 public function attributes_metabox() { 343 344 343 add_meta_box( 345 344 'bbp_reply_attributes', … … 350 349 'high' 351 350 ); 352 353 do_action( 'bbp_reply_attributes_metabox' );354 351 } 355 352 … … 366 363 * @uses bbp_get_reply_post_type() To get the reply post type 367 364 * @uses add_meta_box() To add the metabox 368 * @uses do_action() Calls 'bbp_author_metabox' with the topic/reply369 * id370 365 */ 371 366 public function author_metabox() { … … 385 380 'high' 386 381 ); 387 388 do_action( 'bbp_author_metabox', get_the_ID() );389 382 } 390 383 -
trunk/src/includes/admin/topics.php
r6190 r6197 81 81 82 82 // Topic metabox actions 83 add_action( 'add_meta_boxes', array( $this, 'attributes_metabox' ) ); 84 add_action( 'add_meta_boxes', array( $this, 'author_metabox' ) ); 85 add_action( 'add_meta_boxes', array( $this, 'replies_metabox' ) ); 86 add_action( 'add_meta_boxes', array( $this, 'comments_metabox' ) ); 87 add_action( 'save_post', array( $this, 'save_meta_boxes' ) ); 83 add_action( 'add_meta_boxes', array( $this, 'attributes_metabox' ) ); 84 add_action( 'add_meta_boxes', array( $this, 'author_metabox' ) ); 85 add_action( 'add_meta_boxes', array( $this, 'replies_metabox' ) ); 86 add_action( 'add_meta_boxes', array( $this, 'favorites_metabox' ) ); 87 add_action( 'add_meta_boxes', array( $this, 'subscriptions_metabox' ) ); 88 add_action( 'add_meta_boxes', array( $this, 'comments_metabox' ) ); 89 add_action( 'save_post', array( $this, 'save_meta_boxes' ) ); 88 90 89 91 // Check if there are any bbp_toggle_topic_* requests on admin_init, also have a message displayed … … 343 345 */ 344 346 public function attributes_metabox() { 345 346 347 add_meta_box( 347 348 'bbp_topic_attributes', … … 352 353 'high' 353 354 ); 354 355 do_action( 'bbp_topic_attributes_metabox' );356 355 } 357 356 … … 361 360 * @since 2.0.0 bbPress (r2828) 362 361 * 363 * @uses bbp_get_topic() To get the topic364 * @uses bbp_get_reply() To get the reply365 * @uses bbp_get_topic_post_type() To get the topic post type366 * @uses bbp_get_reply_post_type() To get the reply post type367 362 * @uses add_meta_box() To add the metabox 368 * @uses do_action() Calls 'bbp_author_metabox' with the topic/reply369 * id370 363 */ 371 364 public function author_metabox() { … … 385 378 'high' 386 379 ); 387 388 do_action( 'bbp_author_metabox', get_the_ID() );389 380 } 390 381 … … 421 412 'high' 422 413 ); 423 424 do_action( 'bbp_topic_replies_metabox', get_the_ID() ); 414 } 415 416 /** 417 * Add the favorites metabox 418 * 419 * Allows viewing of users who have favorited a topic. 420 * 421 * @since 2.6.0 bbPress (r6179) 422 * 423 * @uses add_meta_box() To add the metabox 424 */ 425 public function favorites_metabox() { 426 427 // Bail if post_type is not a reply 428 if ( empty( $_GET['action'] ) || ( 'edit' !== $_GET['action'] ) ) { 429 return; 430 } 431 432 // Bail if no favorites 433 if ( ! bbp_is_favorites_active() ) { 434 return; 435 } 436 437 // Add the metabox 438 add_meta_box( 439 'bbp_topic_favorites_metabox', 440 __( 'Favorites', 'bbpress' ), 441 'bbp_topic_favorites_metabox', 442 $this->post_type, 443 'normal', 444 'high' 445 ); 446 } 447 448 /** 449 * Add the subscriptions metabox 450 * 451 * Allows viewing of users who have subscribed to a topic. 452 * 453 * @since 2.6.0 bbPress (r6179) 454 * 455 * @uses add_meta_box() To add the metabox 456 */ 457 public function subscriptions_metabox() { 458 459 // Bail if post_type is not a reply 460 if ( empty( $_GET['action'] ) || ( 'edit' !== $_GET['action'] ) ) { 461 return; 462 } 463 464 // Bail if no subscriptions 465 if ( ! bbp_is_subscriptions_active() ) { 466 return; 467 } 468 469 // Add the metabox 470 add_meta_box( 471 'bbp_topic_subscriptions_metabox', 472 __( 'Subscriptions', 'bbpress' ), 473 'bbp_topic_subscriptions_metabox', 474 $this->post_type, 475 'normal', 476 'high' 477 ); 425 478 } 426 479 -
trunk/src/includes/core/template-functions.php
r6112 r6197 549 549 550 550 // Load the core WordPress contact methods 551 if ( ! function_exists( '_wp_get_user_contactmethods' ) ) {552 include_once( ABSPATH . 'wp-includes/registration.php' );551 if ( ! function_exists( '_wp_get_user_contactmethods' ) ) { 552 require_once ABSPATH . 'wp-includes/registration.php'; 553 553 } 554 554 555 555 // Load the edit_user functions 556 if ( ! function_exists( 'edit_user' ) ) {557 require_once ( ABSPATH . 'wp-admin/includes/user.php' );556 if ( ! function_exists( 'edit_user' ) ) { 557 require_once ABSPATH . 'wp-admin/includes/user.php'; 558 558 } 559 559 560 560 // Load the grant/revoke super admin functions 561 if ( is_multisite() && ! function_exists( 'revoke_super_admin' ) ) {562 require_once ( ABSPATH . 'wp-admin/includes/ms.php' );561 if ( is_multisite() && ! function_exists( 'revoke_super_admin' ) ) { 562 require_once ABSPATH . 'wp-admin/includes/ms.php'; 563 563 } 564 564
Note: See TracChangeset
for help on using the changeset viewer.