Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/29/2016 04:25:54 AM (9 years ago)
Author:
johnjamesjacoby
Message:

Metaboxes: Add metaboxes for viewing favorites & subscriptions of topics & replies.

  • New functions for outputting avatars of users who have favved or subbed
  • Use the $post parameter that's passed in, rather than using get_the_ID() again
  • Use require_once as a language construct vs. include_once() as a function
  • Pass $post object through to metabox subsequent filters vs just the ID

See #2959.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/forums.php

    r6190 r6197  
    7373
    7474        // 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'       ) );
    7980
    8081        // Check if there are any bbp_toggle_forum_* requests on admin_init, also have a message displayed
     
    229230     */
    230231    public function attributes_metabox() {
    231 
    232         // Meta data
    233232        add_meta_box(
    234233            'bbp_forum_attributes',
     
    239238            'high'
    240239        );
    241 
    242         do_action( 'bbp_forum_attributes_metabox' );
    243240    }
    244241
     
    268265            'high'
    269266        );
    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        );
    272299    }
    273300
Note: See TracChangeset for help on using the changeset viewer.