Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/02/2015 01:58:52 AM (9 years ago)
Author:
tw2113
Message:

More documentation cleanup for the Members component.

See #6402.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-widgets.php

    r10276 r10322  
    3535    public function __construct() {
    3636
    37         // Setup widget name & description
     37        // Setup widget name & description.
    3838        $name        = _x( '(BuddyPress) Members', 'widget name', 'buddypress' );
    3939        $description = __( 'A dynamic list of recently active, popular, and newest members', 'buddypress' );
    4040
    41         // Call WP_Widget constructor
     41        // Call WP_Widget constructor.
    4242        parent::__construct( false, $name, array(
    4343            'description' => $description,
     
    4545        ) );
    4646
    47         // Maybe enqueue JS for widget
     47        // Maybe enqueue JS for widget.
    4848        if ( is_active_widget( false, false, $this->id_base ) && ! is_admin() && ! is_network_admin() ) {
    4949            wp_enqueue_script( 'bp-widget-members' );
     
    6161    public function widget( $args, $instance ) {
    6262
    63         // Get widget settings
     63        // Get widget settings.
    6464        $settings = $this->parse_settings( $instance );
    6565
     
    8686        $separator = apply_filters( 'bp_members_widget_separator', '|' );
    8787
    88         // Output before widget HTMl, title (and maybe content before & after it)
     88        // Output before widget HTMl, title (and maybe content before & after it).
    8989        echo $args['before_widget']
    9090           . $args['before_title']
     
    9292           . $args['after_title'];
    9393
    94         // Setup args for querying members
     94        // Setup args for querying members.
    9595        $members_args = array(
    9696            'user_id'         => 0,
     
    165165     * @param array $new_instance The new instance options.
    166166     * @param array $old_instance The old instance options.
    167      *
    168      * @return array $instance     The parsed options to be saved.
     167     * @return array $instance The parsed options to be saved.
    169168     */
    170169    public function update( $new_instance, $old_instance ) {
     
    184183     * @param array $instance Widget instance settings.
    185184     *
    186      * @return string
     185     * @return void
    187186     */
    188187    public function form( $instance ) {
    189188
    190         // Get widget settings
     189        // Get widget settings.
    191190        $settings       = $this->parse_settings( $instance );
    192191        $title          = strip_tags( $settings['title'] );
     
    233232     * @since 2.3.0
    234233     *
     234     * @uses bp_parse_args() To merge widget settings into defaults.
     235     *
    235236     * @param array $instance Widget instance settings.
    236      *
    237      * @uses bp_parse_args() To merge widget settings into defaults.
    238      *
    239237     * @return array
    240238     */
     
    278276    public function widget( $args, $instance ) {
    279277
    280         // Get widget settings
     278        // Get widget settings.
    281279        $settings = $this->parse_settings( $instance );
    282280
     
    298296           . $args['after_title'];
    299297
    300         // Setup args for querying members
     298        // Setup args for querying members.
    301299        $members_args = array(
    302300            'user_id'         => 0,
     
    338336     * @param array $new_instance The new instance options.
    339337     * @param array $old_instance The old instance options.
    340      *
    341      * @return array $instance     The parsed options to be saved.
     338     * @return array $instance The parsed options to be saved.
    342339     */
    343340    public function update( $new_instance, $old_instance ) {
     
    353350     *
    354351     * @param array $instance Widget instance settings.
    355      *
    356      * @return string
     352     * @return void
    357353     */
    358354    public function form( $instance ) {
    359355
    360         // Get widget settings
     356        // Get widget settings.
    361357        $settings    = $this->parse_settings( $instance );
    362358        $title       = strip_tags( $settings['title'] );
     
    385381     * @since 2.3.0
    386382     *
     383     * @uses bp_parse_args() To merge widget settings into defaults.
     384     *
    387385     * @param array $instance Widget instance settings.
    388      *
    389      * @uses bp_parse_args() To merge widget settings into defaults.
    390      *
    391386     * @return array
    392387     */
     
    428423    public function widget( $args, $instance ) {
    429424
    430         // Get widget settings
     425        // Get widget settings.
    431426        $settings = $this->parse_settings( $instance );
    432427
     
    448443           . $args['after_title'];
    449444
    450         // Setup args for querying members
     445        // Setup args for querying members.
    451446        $members_args = array(
    452447            'user_id'         => 0,
     
    488483     * @param array $new_instance The new instance options.
    489484     * @param array $old_instance The old instance options.
    490      *
    491485     * @return array $instance The parsed options to be saved.
    492486     */
     
    503497     *
    504498     * @param array $instance Widget instance settings.
    505      *
    506      * @return string
     499     * @return void
    507500     */
    508501    public function form( $instance ) {
    509502
    510         // Get widget settings
     503        // Get widget settings.
    511504        $settings    = $this->parse_settings( $instance );
    512505        $title       = strip_tags( $settings['title'] );
     
    535528     * @since 2.3.0
    536529     *
     530     * @uses bp_parse_args() To merge widget settings into defaults.
     531     *
    537532     * @param array $instance Widget instance settings.
    538      *
    539      * @uses bp_parse_args() To merge widget settings into defaults.
    540      *
    541533     * @return array
    542534     */
     
    560552    check_ajax_referer( 'bp_core_widget_members' );
    561553
    562     // Setup some variables to check
     554    // Setup some variables to check.
    563555    $filter      = ! empty( $_POST['filter']      ) ? $_POST['filter']                : 'recently-active-members';
    564556    $max_members = ! empty( $_POST['max-members'] ) ? absint( $_POST['max-members'] ) : 5;
    565557
    566     // Determine the type of members query to perform
     558    // Determine the type of members query to perform.
    567559    switch ( $filter ) {
    568560
    569         // Newest activated
     561        // Newest activated.
    570562        case 'newest-members' :
    571563            $type = 'newest';
    572564            break;
    573565
    574         // Popular by friends
     566        // Popular by friends.
    575567        case 'popular-members' :
    576568            if ( bp_is_active( 'friends' ) ) {
     
    581573            break;
    582574
    583         // Default
     575        // Default.
    584576        case 'recently-active-members' :
    585577        default :
     
    588580    }
    589581
    590     // Setup args for querying members
     582    // Setup args for querying members.
    591583    $members_args = array(
    592584        'user_id'         => 0,
     
    598590    );
    599591
    600     // Query for members
     592    // Query for members.
    601593    if ( bp_has_members( $members_args ) ) : ?>
    602         <?php echo '0[[SPLIT]]'; // return valid result. TODO: remove this. ?>
     594        <?php echo '0[[SPLIT]]'; // Return valid result. TODO: remove this. ?>
    603595        <?php while ( bp_members() ) : bp_the_member(); ?>
    604596            <li class="vcard">
Note: See TracChangeset for help on using the changeset viewer.