Skip to:
Content

BuddyPress.org


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.