Skip to:
Content

BuddyPress.org

Changeset 3402


Ignore:
Timestamp:
11/12/2010 09:38:13 PM (14 years ago)
Author:
boonebgorges
Message:

Adds editable title to core and group widgets. Other miscellaneous widget improvements. Fixes #1928

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-widgets.php

    r3336 r3402  
    1313class BP_Core_Members_Widget extends WP_Widget {
    1414    function bp_core_members_widget() {
    15         parent::WP_Widget( false, $name = __( 'Members', 'buddypress' ) );
     15        $widget_ops = array( 'description' => __( 'A dynamic list of recently active, popular, and newest members', 'buddypress' ) );
     16        parent::WP_Widget( false, $name = __( 'Members', 'buddypress' ), $widget_ops );
    1617
    1718        if ( is_active_widget( false, false, $this->id_base ) )
     
    2930        echo $before_widget;
    3031        echo $before_title
    31            . $widget_name
     32           . $instance['title']
    3233           . $after_title; ?>
    3334
     
    8990    function update( $new_instance, $old_instance ) {
    9091        $instance = $old_instance;
     92        $instance['title'] = strip_tags( $new_instance['title'] );
    9193        $instance['max_members'] = strip_tags( $new_instance['max_members'] );
    9294        $instance['member_default'] = strip_tags( $new_instance['member_default'] );
     
    9698
    9799    function form( $instance ) {
    98         $instance = wp_parse_args( (array) $instance, array( 'max_members' => 5, 'member_default' => 'active' ) );
     100        $defaults = array(
     101            'title' => __( 'Members', 'buddypress' ),
     102            'max_members' => 5,
     103            'member_default' => 'active'
     104        );
     105        $instance = wp_parse_args( (array) $instance, $defaults );
     106       
     107        $title = strip_tags( $instance['title'] );
    99108        $max_members = strip_tags( $instance['max_members'] );
    100109        $member_default = strip_tags( $instance['member_default'] );
    101110        ?>
     111
     112        <p><label for="bp-core-widget-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%" /></label></p>
    102113
    103114        <p><label for="bp-core-widget-members-max"><?php _e('Max members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
     
    121132class BP_Core_Whos_Online_Widget extends WP_Widget {
    122133    function bp_core_whos_online_widget() {
    123         parent::WP_Widget( false, $name = __( "Who's Online Avatars", 'buddypress' ) );
     134        $widget_ops = array( 'description' => __( 'Avatars of users who are currently online', 'buddypress' ) );
     135        parent::WP_Widget( false, $name = __( "Who's Online Avatars", 'buddypress' ), $widget_ops );
    124136    }
    125137
     
    131143        echo $before_widget;
    132144        echo $before_title
    133            . $widget_name
     145           . $instance['title']
    134146           . $after_title; ?>
    135147
     
    156168    function update( $new_instance, $old_instance ) {
    157169        $instance = $old_instance;
     170        $instance['title'] = strip_tags( $new_instance['title'] );
    158171        $instance['max_members'] = strip_tags( $new_instance['max_members'] );
    159172
     
    162175
    163176    function form( $instance ) {
    164         $instance = wp_parse_args( (array) $instance, array( 'max_members' => 15 ) );
     177        $defaults = array(
     178            'title' => __( "Who's Online", 'buddypress' ),
     179            'max_members' => 15
     180        );
     181        $instance = wp_parse_args( (array) $instance, $defaults );
     182       
     183        $title = strip_tags( $instance['title'] );
    165184        $max_members = strip_tags( $instance['max_members'] );
    166185        ?>
    167186
     187        <p><label for="bp-core-widget-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%" /></label></p>
     188
    168189        <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
    169190    <?php
     
    175196class BP_Core_Recently_Active_Widget extends WP_Widget {
    176197    function bp_core_recently_active_widget() {
    177         parent::WP_Widget( false, $name = __( 'Recently Active Member Avatars', 'buddypress' ) );
     198        $widget_ops = array( 'description' => __( 'Avatars of recently active members', 'buddypress' ) );
     199        parent::WP_Widget( false, $name = __( 'Recently Active Member Avatars', 'buddypress' ), $widget_ops );
    178200    }
    179201
     
    185207        echo $before_widget;
    186208        echo $before_title
    187            . $widget_name
     209           . $instance['title']
    188210           . $after_title; ?>
    189211
     
    210232    function update( $new_instance, $old_instance ) {
    211233        $instance = $old_instance;
     234        $instance['title'] = strip_tags( $new_instance['title'] );
    212235        $instance['max_members'] = strip_tags( $new_instance['max_members'] );
    213236
     
    216239
    217240    function form( $instance ) {
    218         $instance = wp_parse_args( (array) $instance, array( 'max_members' => 15 ) );
     241        $defaults = array(
     242            'title' => 'Recently Active Members',
     243            'max_members' => 15
     244        );
     245        $instance = wp_parse_args( (array) $instance, $defaults );
     246       
     247        $title = strip_tags( $instance['title'] );
    219248        $max_members = strip_tags( $instance['max_members'] );
    220249        ?>
     250
     251        <p><label for="bp-core-widget-members-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%" /></label></p>
    221252
    222253        <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
  • trunk/bp-groups/bp-groups-widgets.php

    r3336 r3402  
    1111class BP_Groups_Widget extends WP_Widget {
    1212    function bp_groups_widget() {
    13         parent::WP_Widget( false, $name = __( 'Groups', 'buddypress' ) );
     13        $widget_ops = array( 'description' => __( 'A dynamic list of recently active, popular, and newest groups', 'buddypress' ) );
     14        parent::WP_Widget( false, $name = __( 'Groups', 'buddypress' ), $widget_ops );
    1415
    1516        if ( is_active_widget( false, false, $this->id_base ) )
     
    2728        echo $before_widget;
    2829        echo $before_title
    29            . $widget_name
     30           . $instance['title']
    3031           . $after_title; ?>
    3132
     
    8182    function update( $new_instance, $old_instance ) {
    8283        $instance = $old_instance;
     84        $instance['title'] = strip_tags( $new_instance['title'] );
    8385        $instance['max_groups'] = strip_tags( $new_instance['max_groups'] );
    8486        $instance['group_default'] = strip_tags( $new_instance['group_default'] );
     
    8890
    8991    function form( $instance ) {
    90         $instance = wp_parse_args( (array) $instance, array( 'max_groups' => 5, 'group_default' => 'active' ) );
     92        $defaults = array(
     93            'title' => __( 'Groups', 'buddypress' ),
     94            'max_members' => 5,
     95            'group_default' => 'active'
     96        ); 
     97        $instance = wp_parse_args( (array) $instance, $defaults );
     98       
     99        $title = strip_tags( $instance['title'] );
    91100        $max_groups = strip_tags( $instance['max_groups'] );
    92101        $group_default = strip_tags( $instance['group_default'] );
    93102        ?>
     103       
     104        <p><label for="bp-groups-widget-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%" /></label></p>
    94105
    95106        <p><label for="bp-groups-widget-groups-max"><?php _e('Max groups to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_groups' ); ?>" name="<?php echo $this->get_field_name( 'max_groups' ); ?>" type="text" value="<?php echo esc_attr( $max_groups ); ?>" style="width: 30%" /></label></p>
Note: See TracChangeset for help on using the changeset viewer.