Skip to:
Content

BuddyPress.org

Changeset 1608


Ignore:
Timestamp:
07/15/2009 07:29:57 PM (17 years ago)
Author:
apeatling
Message:

Merging 1.0 branch fixes back into the trunk.

Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-filters.php

    r1504 r1608  
    33/* Apply WordPress defined filters */
    44add_filter( 'bp_get_activity_content', 'wp_filter_kses', 1 );
    5 
     5add_filter( 'bp_get_activity_content', 'force_balance_tags' );
    66add_filter( 'bp_get_activity_content', 'wptexturize' );
    7 
    87add_filter( 'bp_get_activity_content', 'convert_smilies' );
    9 
    108add_filter( 'bp_get_activity_content', 'convert_chars' );
    11 
    129add_filter( 'bp_get_activity_content', 'wpautop' );
    13 
    1410add_filter( 'bp_get_activity_content', 'make_clickable' );
    15 
    1611add_filter( 'bp_get_activity_content', 'stripslashes_deep' );
    1712
  • trunk/bp-activity/bp-activity-widgets.php

    r1588 r1608  
    33/* Register widgets for blogs component */
    44function bp_activity_register_widgets() {
    5     global $current_blog;
    6 
    7     /* Site Wide Activity Widget */
    8     wp_register_sidebar_widget( 'buddypress-activity', __('Site Wide Activity', 'buddypress'), 'bp_activity_widget_sitewide_activity');
    9     wp_register_widget_control( 'buddypress-activity', __('Site Wide Activity', 'buddypress'), 'bp_activity_widget_sitewide_activity_control' );
    10 
    11     if ( is_active_widget( 'bp_activity_widget_sitewide_activity' ) ) {
    12         wp_enqueue_style( 'bp-activity-widget-activity-css', BP_PLUGIN_URL . '/bp-activity/css/widget-activity.css' );     
    13     }
     5    add_action('widgets_init', create_function('', 'return register_widget("BP_Activity_Widget");') );
    146}
    157add_action( 'plugins_loaded', 'bp_activity_register_widgets' );
    168
     9class BP_Activity_Widget extends WP_Widget {
     10    function bp_activity_widget() {
     11        parent::WP_Widget( false, $name = 'Site Wide Activity' );
     12        wp_enqueue_style( 'bp-activity-widget-activity-css', BP_PLUGIN_URL . '/bp-activity/css/widget-activity.css' );     
     13    }
    1714
    18 function bp_activity_widget_sitewide_activity($args) {
    19     global $bp, $current_blog;
     15    function widget($args, $instance) {
     16        global $bp;
     17       
     18        extract( $args );
     19       
     20        echo $before_widget;
     21        echo $before_title
     22           . $widget_name .
     23             ' <a href="' . bp_get_sitewide_activity_feed_link() . '" title="' . __( 'Site Wide Activity RSS Feed', 'buddypress' ) . '"><img src="' . $bp->activity->image_base . '/rss.png" alt="' . __( 'RSS Feed', 'buddypress' ) . '" /></a>'
     24           . $after_title; ?>
    2025   
    21     extract($args);
    22     $options = get_blog_option( $current_blog->blog_id, 'bp_activity_widget_sitewide_activity' );
    23 ?>
    24     <?php echo $before_widget; ?>
    25     <?php echo $before_title
    26         . $widget_name .
    27         ' <a href="' . bp_get_sitewide_activity_feed_link() . '" title="' . __( 'Site Wide Activity RSS Feed', 'buddypress' ) . '"><img src="' . $bp->activity->image_base . '/rss.png" alt="' . __( 'RSS Feed', 'buddypress' ) . '" /></a>'
    28         . $after_title; ?>
    29        
    30     <?php
    31     if ( !$options['per_page'] || empty( $options['per_page'] ) )
    32         $options['per_page'] = 20;
    33 
    34     if ( !$options['max_items'] || empty( $options['max_items'] ) )
    35         $options['max_items'] = 200;
    36     ?>
    37 
    38     <?php if ( bp_has_activities( 'type=sitewide&max=' . $options['max_items'] . '&per_page=' . $options['per_page'] ) ) : ?>
     26    <?php if ( bp_has_activities( 'type=sitewide&max=' . $instance['max_items'] . '&per_page=' . $instance['per_page'] ) ) : ?>
    3927        <div class="pag-count" id="activity-count">
    4028            <?php bp_activity_pagination_count() ?>
     
    6250            <?php _e('There has been no recent site activity.', 'buddypress') ?>
    6351        </div>
    64 
    6552    <?php endif;?>
    66 
     53   
    6754    <?php echo $after_widget; ?>
    68 <?php
    69 }
    70 
    71 function bp_activity_widget_sitewide_activity_control() {
    72     global $current_blog;
    73    
    74     $options = $newoptions = get_blog_option( $current_blog->blog_id, 'bp_activity_widget_sitewide_activity');
    75 
    76     if ( $_POST['bp-activity-widget-sitewide-submit'] ) {
    77         $newoptions['max_items'] = strip_tags( stripslashes( $_POST['bp-activity-widget-sitewide-items-max'] ) );
     55    <?php
    7856    }
    7957
    80     if ( $_POST['bp-activity-widget-sitewide-submit'] ) {
    81         $newoptions['per_page'] = strip_tags( stripslashes( $_POST['bp-activity-widget-sitewide-per-page'] ) );
    82     }
    83    
    84     if ( $options != $newoptions ) {
    85         $options = $newoptions;
    86         update_blog_option( $current_blog->blog_id, 'bp_activity_widget_sitewide_activity', $options );
     58    function update( $new_instance, $old_instance ) {
     59        $instance = $old_instance;
     60        $instance['max_items'] = strip_tags( $new_instance['max_items'] );
     61        $instance['per_page'] = strip_tags( $new_instance['per_page'] );
     62
     63        return $instance;
    8764    }
    8865
     66    function form( $instance ) {
     67        $instance = wp_parse_args( (array) $instance, array( 'max_items' => 30 ) );
     68        $per_page = strip_tags( $instance['per_page'] );
     69        $max_items = strip_tags( $instance['max_items'] );
     70        ?>
     71
     72        <p><label for="bp-activity-widget-sitewide-per-page"><?php _e('Number of Items Per Page:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'per_page' ); ?>" name="<?php echo $this->get_field_name( 'per_page' ); ?>" type="text" value="<?php echo attribute_escape( $per_page ); ?>" style="width: 30%" /></label></p>
     73        <p><label for="bp-core-widget-members-max"><?php _e('Max items to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_items' ); ?>" name="<?php echo $this->get_field_name( 'max_items' ); ?>" type="text" value="<?php echo attribute_escape( $max_items ); ?>" style="width: 30%" /></label></p>
     74    <?php
     75    }
     76}
    8977?>
    90         <p><label for="bp-activity-widget-sitewide-per-page"><?php _e('Number of Items Per Page:', 'buddypress'); ?> <input class="widefat" id="bp-activity-widget-sitewide-per-page" name="bp-activity-widget-sitewide-per-page" type="text" value="<?php echo attribute_escape( $options['per_page'] ); ?>" style="width: 30%" /></label></p>
    91         <p><label for="bp-activity-widget-sitewide-items-max"><?php _e('Max Number of Items:', 'buddypress'); ?> <input class="widefat" id="bp-activity-widget-sitewide-items-max" name="bp-activity-widget-sitewide-items-max" type="text" value="<?php echo attribute_escape( $options['max_items'] ); ?>" style="width: 30%" /></label></p>
    92 
    93         <input type="hidden" id="bp-activity-widget-sitewide-submit" name="bp-activity-widget-sitewide-submit" value="1" />
    94 <?php
    95 }
    96 
    97 ?>
  • trunk/bp-activity/css/widget-activity.css

    r1366 r1608  
    1 .bp_activity_widget_sitewide_activity span.time-since {
     1.widget_bp_activity_widget span.time-since {
    22    font-size: 11px;
    33}
    44
    5 .bp_activity_widget_sitewide_activity ul#site-wide-stream {
     5.widget_bp_activity_widget ul#site-wide-stream {
    66    margin: 0;
    77    padding: 0;
    88    list-style: none;
    99}
     10
     11.widget_bp_core_recently_active_widget div.item-avatar {
     12    display: inline;
     13    margin: 0 5px 5x 0;
     14}
  • trunk/bp-blogs/bp-blogs-widgets.php

    r1520 r1608  
    33/* Register widgets for blogs component */
    44function bp_blogs_register_widgets() {
    5     global $current_blog;
    6 
    7     /* Latest Posts Widget */
    8     wp_register_sidebar_widget( 'buddypress-blogs', __('Recent Blog Posts', 'buddypress'), 'bp_blogs_widget_recent_posts');
    9     wp_register_widget_control( 'buddypress-blogs', __('Recent Blog Posts', 'buddypress'), 'bp_blogs_widget_recent_posts_control' );
    10 
    11     if ( is_active_widget( 'bp_blogs_widget_recent_posts' ) ) {
    12         wp_enqueue_style( 'bp-blogs-widget-posts-css', BP_PLUGIN_URL . '/bp-blogs/css/widget-blogs.css' );     
    13     }
     5    add_action('widgets_init', create_function('', 'return register_widget("BP_Blogs_Recent_Posts_Widget");') );
    146}
    157add_action( 'plugins_loaded', 'bp_blogs_register_widgets' );
    168
    17 
    18 function bp_blogs_widget_recent_posts($args) {
    19     global $current_blog;
    20    
    21     extract($args);
    22     $options = get_blog_option( $current_blog->blog_id, 'bp_blogs_widget_recent_posts' );
    23    
    24     if ( empty( $options['max_posts'] ) || !$options['max_posts'] )
    25         $options['max_posts'] = 5;
    26 ?>
    27     <?php echo $before_widget; ?>
    28     <?php echo $before_title
    29         . $widget_name
    30         . $after_title; ?>
    31 
    32     <?php $posts = bp_blogs_get_latest_posts( null, $options['max_posts'] ) ?>
    33     <?php $counter = 0; ?>
    34        
    35     <?php if ( $posts ) : ?>
    36         <div class="item-options" id="recent-posts-options">
    37             <?php _e("Site Wide", 'buddypress') ?>
    38         </div>
    39         <ul id="recent-posts" class="item-list">
    40             <?php foreach ( $posts as $post ) : ?>
    41                 <li>
    42                     <div class="item-avatar">
    43                         <a href="<?php echo bp_post_get_permalink( $post, $post->blog_id ) ?>" title="<?php echo apply_filters( 'the_title', $post->post_title ) ?>"><?php echo bp_core_get_avatar( $post->post_author, 1 ) ?></a>
    44                     </div>
    45 
    46                     <div class="item">
    47                         <h4 class="item-title"><a href="<?php echo bp_post_get_permalink( $post, $post->blog_id ) ?>" title="<?php echo apply_filters( 'the_title', $post->post_title ) ?>"><?php echo apply_filters( 'the_title', $post->post_title ) ?></a></h4>
    48                         <?php if ( !$counter ) : ?>
    49                             <div class="item-content"><?php echo bp_create_excerpt($post->post_content) ?></div>
    50                         <?php endif; ?>
    51                         <div class="item-meta"><em><?php printf( __( 'by %s from the blog <a href="%s">%s</a>', 'buddypress' ), bp_core_get_userlink( $post->post_author ), get_blog_option( $post->blog_id, 'siteurl' ), get_blog_option( $post->blog_id, 'blogname' ) ) ?></em></div>
    52                     </div>
    53                 </li>
    54                 <?php $counter++; ?>   
    55             <?php endforeach; ?>
    56         </ul>
    57     <?php else: ?>
    58         <div class="widget-error">
    59             <?php _e('There are no recent blog posts, why not write one?', 'buddypress') ?>
    60         </div>
    61     <?php endif; ?>
    62 
    63     <?php echo $after_widget; ?>
    64 <?php
    65 }
    66 
    67 function bp_blogs_widget_recent_posts_control() {
    68     global $current_blog;
    69    
    70     $options = $newoptions = get_blog_option( $current_blog->blog_id, 'bp_blogs_widget_recent_posts');
    71 
    72     if ( $_POST['bp-blogs-widget-recent-posts-submit'] ) {
    73         $newoptions['max_posts'] = strip_tags( stripslashes( $_POST['bp-blogs-widget-recent-posts-max'] ) );
    74     }
    75    
    76     if ( $options != $newoptions ) {
    77         $options = $newoptions;
    78         update_blog_option( $current_blog->blog_id, 'bp_blogs_widget_recent_posts', $options );
     9class BP_Blogs_Recent_Posts_Widget extends WP_Widget {
     10    function bp_blogs_recent_posts_widget() {
     11        parent::WP_Widget( false, $name = 'Recent Site Wide Posts' );
     12        wp_enqueue_style( 'bp-blogs-widget-posts-css', BP_PLUGIN_URL . '/bp-blogs/css/widget-blogs.css' );     
    7913    }
    8014
     15    function widget($args, $instance) {
     16        global $bp;
     17       
     18        extract( $args );
     19       
     20        echo $before_widget;
     21        echo $before_title
     22           . $widget_name
     23           . $after_title; ?>
     24   
     25        <?php
     26        if ( empty( $instance['max_posts'] ) || !$instance['max_posts'] )
     27            $instance['max_posts'] = 10; ?>
     28       
     29        <?php $posts = bp_blogs_get_latest_posts( null, $instance['max_posts'] ) ?>
     30        <?php $counter = 0; ?>
     31       
     32        <?php if ( $posts ) : ?>
     33            <div class="item-options" id="recent-posts-options">
     34                <?php _e("Site Wide", 'buddypress') ?>
     35            </div>
     36            <ul id="recent-posts" class="item-list">
     37                <?php foreach ( $posts as $post ) : ?>
     38                    <li>
     39                        <div class="item-avatar">
     40                            <a href="<?php echo bp_post_get_permalink( $post, $post->blog_id ) ?>" title="<?php echo apply_filters( 'the_title', $post->post_title ) ?>"><?php echo bp_core_get_avatar( $post->post_author, 1 ) ?></a>
     41                        </div>
     42
     43                        <div class="item">
     44                            <h4 class="item-title"><a href="<?php echo bp_post_get_permalink( $post, $post->blog_id ) ?>" title="<?php echo apply_filters( 'the_title', $post->post_title ) ?>"><?php echo apply_filters( 'the_title', $post->post_title ) ?></a></h4>
     45                            <?php if ( !$counter ) : ?>
     46                                <div class="item-content"><?php echo bp_create_excerpt($post->post_content) ?></div>
     47                            <?php endif; ?>
     48                            <div class="item-meta"><em><?php printf( __( 'by %s from the blog <a href="%s">%s</a>', 'buddypress' ), bp_core_get_userlink( $post->post_author ), get_blog_option( $post->blog_id, 'siteurl' ), get_blog_option( $post->blog_id, 'blogname' ) ) ?></em></div>
     49                        </div>
     50                    </li>
     51                    <?php $counter++; ?>   
     52                <?php endforeach; ?>
     53            </ul>
     54        <?php else: ?>
     55            <div class="widget-error">
     56                <?php _e('There are no recent blog posts, why not write one?', 'buddypress') ?>
     57            </div>
     58        <?php endif; ?>
     59           
     60        <?php echo $after_widget; ?>
     61    <?php
     62    }
     63
     64    function update( $new_instance, $old_instance ) {
     65        $instance = $old_instance;
     66        $instance['max_posts'] = strip_tags( $new_instance['max_posts'] );
     67
     68        return $instance;
     69    }
     70
     71    function form( $instance ) {
     72        $instance = wp_parse_args( (array) $instance, array( 'max_posts' => 10 ) );
     73        $max_posts = strip_tags( $instance['max_posts'] );
     74        ?>
     75
     76        <p><label for="bp-blogs-widget-posts-max"><?php _e('Max posts to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_posts' ); ?>" name="<?php echo $this->get_field_name( 'max_posts' ); ?>" type="text" value="<?php echo attribute_escape( $max_posts ); ?>" style="width: 30%" /></label></p>
     77    <?php
     78    }
     79}
    8180?>
    82         <p><label for="bp-blogs-widget-recent-posts-max"><?php _e('Max Number of Posts:', 'buddypress'); ?> <input class="widefat" id="bp-blogs-widget-recent-posts-max" name="bp-blogs-widget-recent-posts-max" type="text" value="<?php echo attribute_escape( $options['max_posts'] ); ?>" style="width: 30%" /></label></p>
    83         <input type="hidden" id="bp-blogs-widget-recent-posts-submit" name="bp-blogs-widget-recent-posts-submit" value="1" />
    84 <?php
    85 }
    86 
    87 ?>
  • trunk/bp-blogs/css/widget-blogs.css

    r1366 r1608  
    1 .bp_blogs_widget_recent_posts ul.item-list {
     1.widget_bp_blogs_recent_posts_widget ul.item-list {
    22    margin: 15px 0 0 0;
    33    padding: 0;
     
    55}
    66   
    7     .bp_blogs_widget_recent_posts ul.item-list li {
     7    .widget_bp_blogs_recent_posts_widget ul.item-list li {
    88        min-height: 60px;
    99    }
    1010   
    11     .bp_blogs_widget_recent_posts ul.item-list li .item-meta {
    12         margin-left: 35px;
     11    .widget_bp_blogs_recent_posts_widget ul.item-list li .item-meta {
     12        margin-left: 10px;
    1313    }
    14         .bp_blogs_widget_recent_posts ul.item-list li .item h4.item-title {
     14        .widget_bp_blogs_recent_posts_widget ul.item-list li .item h4.item-title {
    1515            clear: none !important;
    1616        }
    1717   
    18     .bp_blogs_widget_recent_posts ul.item-list li .item-avatar {
     18    .widget_bp_blogs_recent_posts_widget ul.item-list li .item-avatar {
    1919        float: left;
    2020        margin: 0 10px 0 0;
    2121    }
    22         .bp_blogs_widget_recent_posts ul.item-list li .item-avatar img.avatar {
     22        .widget_bp_blogs_recent_posts_widget ul.item-list li .item-avatar img.avatar {
    2323            width: 25px;
    2424            height: 25px;
    2525        }
    2626   
    27     .bp_blogs_widget_recent_posts ul li em {
     27    .widget_bp_blogs_recent_posts_widget ul li em {
    2828        font-size: 11px;
    2929    }
  • trunk/bp-core.php

    r1599 r1608  
    623623function bp_core_sort_subnav_items() {
    624624    global $bp;
    625    
     625
    626626    if ( empty( $bp->bp_options_nav ) || !is_array( $bp->bp_options_nav ) )
    627627        return false;
     
    963963    }
    964964   
    965     return apply_filters( 'bp_core_get_user_displayname', stripslashes( trim( $fullname ) ) );
     965    return apply_filters( 'bp_core_get_user_displayname', stripslashes( strip_tags( trim( $fullname ) ) ) );
    966966}
    967967    /* DEPRECATED Use: bp_core_get_user_displayname */
  • trunk/bp-core/bp-core-templatetags.php

    r1599 r1608  
    869869        $this->member = $this->next_member();
    870870        $user_id = $this->member->user_id;
     871        $user_registered = $this->member->user_registered;
    871872
    872873        if ( !$this->member = wp_cache_get( 'bp_user_' . $user_id, 'bp' ) ) {
     
    875876        }
    876877       
     878        if ( $user_registered )
     879            $this->member->user_registered = $user_registered;
     880           
    877881        if ( 0 == $this->current_member ) // loop has just started
    878882            do_action('loop_start');
     
    983987
    984988        return apply_filters( 'bp_the_site_member_last_active', $site_members_template->member->last_active );
     989    }
     990
     991function bp_the_site_member_registered() {
     992    echo bp_get_the_site_member_registered();
     993}
     994    function bp_get_the_site_member_registered() {
     995        global $site_members_template;
     996
     997        return apply_filters( 'bp_the_site_member_last_active', strtotime( $site_members_template->member->user_registered ) );
    985998    }
    986999   
  • trunk/bp-core/bp-core-widgets.php

    r1520 r1608  
    33/* Register widgets for the core component */
    44function bp_core_register_widgets() {
    5     global $current_blog;
    6    
    7     /* Site welcome widget */
    8     wp_register_sidebar_widget( 'buddypress-welcome', __( 'Welcome', 'buddypress' ), 'bp_core_widget_welcome' );
    9     wp_register_widget_control( 'buddypress-welcome', __( 'Welcome', 'buddypress' ), 'bp_core_widget_welcome_control' );
    10    
    11     /* Site members widget */
    12     wp_register_sidebar_widget( 'buddypress-members', __( 'Members', 'buddypress' ), 'bp_core_widget_members' );
    13     wp_register_widget_control( 'buddypress-members', __( 'Members', 'buddypress' ), 'bp_core_widget_members_control' );
    14    
    15     /* Include the javascript needed for activated widgets only */
    16     if ( is_active_widget( 'bp_core_widget_members' ) ) {
     5    add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Welcome_Widget");') );
     6    add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Members_Widget");') );
     7    add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Whos_Online_Widget");') );
     8    add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Recently_Active_Widget");') );
     9}
     10add_action( 'plugins_loaded', 'bp_core_register_widgets' );
     11
     12/*** WELCOME WIDGET *****************/
     13
     14class BP_Core_Welcome_Widget extends WP_Widget {
     15    function bp_core_welcome_widget() {
     16        parent::WP_Widget( false, $name = 'Welcome' );
     17    }
     18
     19    function widget($args, $instance) {
     20        extract( $args );
     21    ?>
     22        <?php echo $before_widget; ?>
     23        <?php echo $before_title
     24            . $instance['title']
     25            . $after_title; ?>
     26
     27        <?php if ( $instance['title'] ) : ?><h3><?php echo attribute_escape( $instance['title'] ) ?></h3><?php endif; ?>
     28        <?php if ( $instance['text'] ) : ?><p><?php echo attribute_escape( $instance['text'] ) ?></p><?php endif; ?>
     29
     30        <?php if ( !is_user_logged_in() ) { ?>
     31        <div class="create-account"><div class="visit generic-button"><a href="<?php bp_signup_page() ?>" title="<?php _e('Create Account', 'buddypress') ?>"><?php _e('Create Account', 'buddypress') ?></a></div></div>
     32        <?php } ?>
     33   
     34        <?php echo $after_widget; ?>
     35    <?php
     36    }
     37
     38    function update( $new_instance, $old_instance ) {
     39        $instance = $old_instance;
     40        $instance['title'] = strip_tags( $new_instance['title'] );
     41        $instance['text'] = strip_tags( wp_filter_post_kses( $new_instance['text'] ) );
     42
     43        return $instance;
     44    }
     45
     46    function form( $instance ) {
     47        $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
     48        $title = strip_tags( $instance['title'] );
     49        $text = strip_tags( $instance['text'] );
     50        ?>
     51            <p><label for="bp-widget-welcome-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 attribute_escape( $title ); ?>" /></label></p>
     52            <p>
     53                <label for="bp-widget-welcome-text"><?php _e( 'Welcome Text:' , 'buddypress'); ?>
     54                    <textarea id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>" class="widefat" style="height: 100px"><?php echo attribute_escape( $text ); ?></textarea>
     55                </label>
     56            </p>
     57    <?php
     58    }
     59}
     60
     61/*** MEMBERS WIDGET *****************/
     62
     63class BP_Core_Members_Widget extends WP_Widget {
     64    function bp_core_members_widget() {
     65        parent::WP_Widget( false, $name = 'Members' );
    1766        wp_enqueue_script( 'bp_core_widget_members-js', BP_PLUGIN_URL . '/bp-core/js/widget-members.js', array('jquery', 'jquery-livequery-pack') );       
    1867        wp_enqueue_style( 'bp_core_widget_members-css', BP_PLUGIN_URL . '/bp-core/css/widget-members.css' );
    1968    }
    20    
    21     wp_register_sidebar_widget( 'buddypress-whosonline', __( "Who's Online", 'buddypress' ), 'bp_core_widget_whos_online' );
    22     wp_register_widget_control( 'buddypress-whosonline', __( "Who's Online", 'buddypress' ), 'bp_core_widget_whos_online_control' );   
    23 
    24 }
    25 add_action( 'plugins_loaded', 'bp_core_register_widgets' );
    26 
    27 
    28 /*** WELCOME WIDGET *****************/
    29 
    30 function bp_core_widget_welcome($args) {
    31     global $current_blog;
    32    
    33     extract($args);
    34     $options = get_blog_option( $current_blog->blog_id, 'bp_core_widget_welcome' );
     69
     70    function widget($args, $instance) {
     71        global $bp;
     72       
     73        extract( $args );
     74       
     75        echo $before_widget;
     76        echo $before_title
     77           . $widget_name
     78           . $after_title; ?>
     79   
     80        <?php
     81        if ( empty( $instance['max_members'] ) || !$instance['max_members'] )
     82            $instance['max_members'] = 5; ?>
     83       
     84        <?php if ( bp_has_site_members( 'type=newest&max=' . $instance['max_members'] ) ) : ?>
     85            <div class="item-options" id="members-list-options">
     86                <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( 'Loading', 'buddypress' ) ?>" style="display: none;" />
     87                <a href="<?php echo site_url() . '/' . BP_MEMBERS_SLUG ?>" id="newest-members" class="selected"><?php _e( 'Newest', 'buddypress' ) ?></a> |
     88                <a href="<?php echo site_url() . '/' . BP_MEMBERS_SLUG ?>" id="recently-active-members"><?php _e( 'Active', 'buddypress' ) ?></a> |
     89                <a href="<?php echo site_url() . '/' . BP_MEMBERS_SLUG ?>" id="popular-members"><?php _e( 'Popular', 'buddypress' ) ?></a>
     90            </div>
     91           
     92            <ul id="members-list" class="item-list">
     93                <?php while ( bp_site_members() ) : bp_the_site_member(); ?>
     94                    <li class="vcard">
     95                        <div class="item-avatar">
     96                            <a href="<?php bp_the_site_member_link() ?>"><?php bp_the_site_member_avatar() ?></a>
     97                        </div>
     98
     99                        <div class="item">
     100                            <div class="item-title fn"><a href="<?php bp_the_site_member_name() ?>" title="<?php bp_the_site_member_name() ?>"><?php bp_the_site_member_name() ?></a></div>
     101                            <div class="item-meta"><span class="activity"><?php echo bp_core_get_last_activity( bp_get_the_site_member_registered(), __( 'registered %s ago', 'buddypress' ) ) ?></span></div>
     102                        </div>
     103                    </li>
     104
     105                <?php endwhile; ?>
     106            </ul>       
     107            <?php wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' ); ?>
     108            <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo attribute_escape( $instance['max_members'] ); ?>" />
     109           
     110        <?php else: ?>
     111
     112            <div class="widget-error">
     113                <?php _e('No one has signed up yet!', 'buddypress') ?>
     114            </div>
     115
     116        <?php endif; ?>
     117           
     118        <?php echo $after_widget; ?>
     119    <?php
     120    }
     121
     122    function update( $new_instance, $old_instance ) {
     123        $instance = $old_instance;
     124        $instance['max_members'] = strip_tags( $new_instance['max_members'] );
     125
     126        return $instance;
     127    }
     128
     129    function form( $instance ) {
     130        $instance = wp_parse_args( (array) $instance, array( 'max_members' => 5 ) );
     131        $max_members = strip_tags( $instance['max_members'] );
     132        ?>
     133
     134        <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 attribute_escape( $max_members ); ?>" style="width: 30%" /></label></p>
     135    <?php
     136    }
     137}
     138
     139/*** WHO'S ONLINE WIDGET *****************/
     140
     141class BP_Core_Whos_Online_Widget extends WP_Widget {
     142    function bp_core_whos_online_widget() {
     143        parent::WP_Widget( false, $name = 'Who\'s Online Avatars' );
     144    }
     145
     146    function widget($args, $instance) {
     147        global $bp;
     148       
     149        extract( $args );
     150       
     151        echo $before_widget;
     152        echo $before_title
     153           . $widget_name
     154           . $after_title; ?>
     155   
     156        <?php
     157        if ( empty( $instance['max_members'] ) || !$instance['max_members'] )
     158            $instance['max_members'] = 5; ?>
     159       
     160        <?php if ( bp_has_site_members( 'type=online&max=' . $instance['max_members'] ) ) : ?>         
     161            <div class="avatar-block">
     162                <?php while ( bp_site_members() ) : bp_the_site_member(); ?>
     163                    <div class="item-avatar">
     164                        <a href="<?php bp_the_site_member_link() ?>" title="<?php bp_the_site_member_name() ?>"><?php bp_the_site_member_avatar() ?></a>
     165                    </div>
     166                <?php endwhile; ?>
     167            </div>                 
     168        <?php else: ?>
     169
     170            <div class="widget-error">
     171                <?php _e( 'There are no users currently online', 'buddypress' ) ?>
     172            </div>
     173
     174        <?php endif; ?>
     175           
     176        <?php echo $after_widget; ?>
     177    <?php
     178    }
     179
     180    function update( $new_instance, $old_instance ) {
     181        $instance = $old_instance;
     182        $instance['max_members'] = strip_tags( $new_instance['max_members'] );
     183
     184        return $instance;
     185    }
     186
     187    function form( $instance ) {
     188        $instance = wp_parse_args( (array) $instance, array( 'max_members' => 5 ) );
     189        $max_members = strip_tags( $instance['max_members'] );
     190        ?>
     191
     192        <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 attribute_escape( $max_members ); ?>" style="width: 30%" /></label></p>
     193    <?php
     194    }
     195}
     196
     197/*** RECENTLY ACTIVE WIDGET *****************/
     198
     199class BP_Core_Recently_Active_Widget extends WP_Widget {
     200    function bp_core_recently_active_widget() {
     201        parent::WP_Widget( false, $name = 'Recently Active Member Avatars' );
     202    }
     203
     204    function widget($args, $instance) {
     205        global $bp;
     206       
     207        extract( $args );
     208       
     209        echo $before_widget;
     210        echo $before_title
     211           . $widget_name
     212           . $after_title; ?>
     213   
     214        <?php
     215        if ( empty( $instance['max_members'] ) || !$instance['max_members'] )
     216            $instance['max_members'] = 5; ?>
     217       
     218        <?php if ( bp_has_site_members( 'type=active&max=' . $instance['max_members'] ) ) : ?>         
     219            <div class="avatar-block">
     220                <?php while ( bp_site_members() ) : bp_the_site_member(); ?>
     221                    <div class="item-avatar">
     222                        <a href="<?php bp_the_site_member_link() ?>" title="<?php bp_the_site_member_name() ?>"><?php bp_the_site_member_avatar() ?></a>
     223                    </div>
     224                <?php endwhile; ?>
     225            </div>                 
     226        <?php else: ?>
     227
     228            <div class="widget-error">
     229                <?php _e( 'There are no recently active members', 'buddypress' ) ?>
     230            </div>
     231
     232        <?php endif; ?>
     233           
     234        <?php echo $after_widget; ?>
     235    <?php
     236    }
     237
     238    function update( $new_instance, $old_instance ) {
     239        $instance = $old_instance;
     240        $instance['max_members'] = strip_tags( $new_instance['max_members'] );
     241
     242        return $instance;
     243    }
     244
     245    function form( $instance ) {
     246        $instance = wp_parse_args( (array) $instance, array( 'max_members' => 5 ) );
     247        $max_members = strip_tags( $instance['max_members'] );
     248        ?>
     249
     250        <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 attribute_escape( $max_members ); ?>" style="width: 30%" /></label></p>
     251    <?php
     252    }
     253}
     254
    35255?>
    36     <?php echo $before_widget; ?>
    37     <?php echo $before_title
    38         . $widget_name
    39         . $after_title; ?>
    40 
    41     <?php if ( $options['title'] ) : ?><h3><?php echo attribute_escape( $options['title'] ) ?></h3><?php endif; ?>
    42     <?php if ( $options['text'] ) : ?><p><?php echo attribute_escape( $options['text'] ) ?></p><?php endif; ?>
    43 
    44     <?php if ( !is_user_logged_in() ) { ?>
    45     <div class="create-account"><div class="visit generic-button"><a href="<?php bp_signup_page() ?>" title="<?php _e('Create Account', 'buddypress') ?>"><?php _e('Create Account', 'buddypress') ?></a></div></div>
    46     <?php } ?>
    47    
    48     <?php echo $after_widget; ?>
    49 <?php
    50 }
    51 
    52 function bp_core_widget_welcome_control() {
    53     global $current_blog;
    54    
    55     $options = $newoptions = get_blog_option( $current_blog->blog_id, 'bp_core_widget_welcome' );
    56 
    57     if ( $_POST['bp-widget-welcome-submit'] ) {
    58         $newoptions['title'] = strip_tags( stripslashes( $_POST['bp-widget-welcome-title'] ) );
    59         $newoptions['text'] = stripslashes( wp_filter_post_kses( $_POST['bp-widget-welcome-text'] ) );
    60     }
    61    
    62     if ( $options != $newoptions ) {
    63         $options = $newoptions;
    64         update_blog_option( $current_blog->blog_id, 'bp_core_widget_welcome', $options );
    65     }
    66 
    67 ?>
    68         <p><label for="bp-widget-welcome-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="bp-widget-welcome-title" name="bp-widget-welcome-title" type="text" value="<?php echo attribute_escape( $options['title'] ); ?>" /></label></p>
    69         <p>
    70             <label for="bp-widget-welcome-text"><?php _e( 'Welcome Text:' , 'buddypress'); ?>
    71                 <textarea id="bp-widget-welcome-text" name="bp-widget-welcome-text" class="widefat" style="height: 100px"><?php echo htmlspecialchars( $options['text'] ); ?></textarea>
    72             </label>
    73         </p>
    74         <input type="hidden" id="bp-widget-welcome-submit" name="bp-widget-welcome-submit" value="1" />
    75 <?php
    76 }
    77 
    78 /*** MEMBERS WIDGET *****************/
    79 
    80 function bp_core_widget_members($args) {
    81     global $current_blog, $bp;
    82    
    83     extract($args);
    84     $options = get_blog_option( $current_blog->blog_id, 'bp_core_widget_members' );
    85 ?>
    86     <?php echo $before_widget; ?>
    87     <?php echo $before_title
    88         . $widget_name
    89         . $after_title; ?>
    90    
    91     <?php
    92     if ( empty( $options['max_members'] ) || !$options['max_members'] )
    93         $options['max_members'] = 5;
    94        
    95     if ( !$users = wp_cache_get( 'newest_users', 'bp' ) ) {
    96         $users = BP_Core_User::get_newest_users( $options['max_members'] );
    97         wp_cache_set( 'newest_users', $users, 'bp' );
    98     }
    99     ?>
    100    
    101     <?php if ( $users['users'] ) : ?>
    102         <div class="item-options" id="members-list-options">
    103             <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( 'Loading', 'buddypress' ) ?>" style="display: none;" />
    104             <a href="<?php echo site_url() . '/' . BP_MEMBERS_SLUG ?>" id="newest-members" class="selected"><?php _e( 'Newest', 'buddypress' ) ?></a> |
    105             <a href="<?php echo site_url() . '/' . BP_MEMBERS_SLUG ?>" id="recently-active-members"><?php _e( 'Active', 'buddypress' ) ?></a> |
    106             <a href="<?php echo site_url() . '/' . BP_MEMBERS_SLUG ?>" id="popular-members"><?php _e( 'Popular', 'buddypress' ) ?></a>
    107         </div>
    108         <ul id="members-list" class="item-list">
    109             <?php foreach ( (array) $users['users'] as $user ) : ?>
    110                 <li class="vcard">
    111                     <div class="item-avatar">
    112                         <a href="<?php echo bp_core_get_userlink( $user->user_id, false, true ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?></a>
    113                     </div>
    114 
    115                     <div class="item">
    116                         <div class="item-title fn"><?php echo bp_core_get_userlink( $user->user_id ) ?></div>
    117                         <div class="item-meta"><span class="activity"><?php echo bp_core_get_last_activity( $user->user_registered, __( 'registered %s ago', 'buddypress' ) ) ?></span></div>
    118                     </div>
    119                 </li>
    120                 <?php $counter++; ?>   
    121             <?php endforeach; ?>
    122         </ul>
    123        
    124         <?php
    125         if ( function_exists('wp_nonce_field') )
    126             wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' );
    127         ?>
    128        
    129         <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo attribute_escape( $options['max_members'] ); ?>" />
    130        
    131     <?php else: ?>
    132         <div class="widget-error">
    133             <?php _e('No one has signed up yet!', 'buddypress') ?>
    134         </div>
    135     <?php endif; ?>
    136    
    137     <?php echo $after_widget; ?>
    138 <?php
    139 }
    140 
    141 function bp_core_widget_members_control() {
    142     global $current_blog;
    143    
    144     $options = $newoptions = get_blog_option( $current_blog->blog_id, 'bp_core_widget_members');
    145 
    146     if ( $_POST['bp-core-widget-members-submit'] ) {
    147         $newoptions['max_members'] = strip_tags( stripslashes( $_POST['bp-core-widget-members-max'] ) );
    148     }
    149    
    150     if ( $options != $newoptions ) {
    151         $options = $newoptions;
    152         update_blog_option( $current_blog->blog_id, 'bp_core_widget_members', $options );
    153     }
    154 
    155     $max_members = attribute_escape( $options['max_members'] );
    156 ?>
    157         <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="bp-core-widget-members-max" name="bp-core-widget-members-max" type="text" value="<?php echo attribute_escape( $options['max_members'] ); ?>" style="width: 30%" /></label></p>
    158         <input type="hidden" id="bp-core-widget-members-submit" name="bp-core-widget-members-submit" value="1" />
    159 <?php
    160 }
    161 
    162 /*** WHO'S ONLINE WIDGET *****************/
    163 
    164 function bp_core_widget_whos_online($args) {
    165     global $current_blog;
    166    
    167     extract($args);
    168     $options = get_blog_option( $current_blog->blog_id, 'bp_core_widget_whos_online' );
    169 ?>
    170     <?php echo $before_widget; ?>
    171     <?php echo $before_title
    172         . $widget_name
    173         . $after_title; ?>
    174 
    175     <?php
    176     if ( empty( $options['max_members'] ) || !$options['max_members'] )
    177         $options['max_members'] = 5;
    178        
    179     if ( !$users = wp_cache_get( 'online_users', 'bp' ) ) {
    180         $users = BP_Core_User::get_online_users( $options['max_members'] );
    181         wp_cache_set( 'online_users', $users, 'bp' );
    182     }
    183     ?>
    184 
    185     <?php $users = BP_Core_User::get_online_users($options['max_members']) ?>
    186 
    187     <?php if ( $users['users'] ) : ?>
    188         <div class="avatar-block">
    189         <?php foreach ( (array) $users['users'] as $user ) : ?>
    190             <div class="item-avatar">
    191                 <a href="<?php echo bp_core_get_userurl($user->user_id) ?>" title="<?php echo bp_core_get_user_displayname( $user->user_id ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?></a>
    192             </div>
    193         <?php endforeach; ?>
    194         </div>
    195            
    196         <?php
    197         if ( function_exists('wp_nonce_field') )
    198             wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' );
    199         ?>
    200 
    201         <input type="hidden" name="bp_core_widget_members_max" id="bp_core_widget_members_max" value="<?php echo attribute_escape( $options['max_members'] ); ?>" />
    202 
    203     <?php else: ?>
    204         <div class="widget-error">
    205             <?php _e('There are no users currently online.', 'buddypress') ?>
    206         </div>
    207     <?php endif; ?>
    208 
    209     <?php echo $after_widget; ?>
    210    
    211     <div class="clear" style="margin-bottom: 25px"></div>
    212    
    213 <?php
    214 }
    215 
    216 function bp_core_widget_whos_online_control() {
    217     global $current_blog;
    218    
    219     $options = $newoptions = get_blog_option( $current_blog->blog_id, 'bp_core_widget_whos_online' );
    220 
    221     if ( $_POST['bp-widget-whos-online-submit'] ) {
    222         $newoptions['max_members'] = strip_tags( stripslashes( $_POST['bp-widget-whos-online-max-members'] ) );
    223     }
    224    
    225     if ( $options != $newoptions ) {
    226         $options = $newoptions;
    227         update_blog_option( $current_blog->blog_id, 'bp_core_widget_whos_online', $options );
    228     }
    229 
    230 ?>
    231         <p><label for="bp-widget-whos-online-max-members"><?php _e('Maximum number of members to show:', 'buddypress'); ?><br /><input class="widefat" id="bp-widget-whos-online-max-members" name="bp-widget-whos-online-max-members" type="text" value="<?php echo attribute_escape( $options['max_members'] ); ?>" style="width: 30%" /></label></p>
    232         <input type="hidden" id="bp-widget-whos-online-submit" name="bp-widget-whos-online-submit" value="1" />
    233 <?php
    234 }
  • trunk/bp-core/css/widget-members.css

    r1366 r1608  
    1 .bp_core_widget_members ul#members-list {
     1.widget_bp_core_members_widget ul#members-list {
    22    margin: 15px 0 0 0;
    33    padding: 0;
     
    55}
    66   
    7     .bp_core_widget_members ul#members-list li {
     7    .widget_bp_core_members_widget ul#members-list li {
    88        min-height: 60px;
    99    }
    1010   
    11     .bp_core_widget_members ul#members-list li img.avatar {
     11    .widget_bp_core_members_widget ul#members-list li img.avatar {
    1212        float: left;
    1313        margin: 0 10px 0 0;
    1414    }
    1515   
    16     .bp_core_widget_members ul#members-list li span.activity {
     16    .widget_bp_core_members_widget ul#members-list li span.activity {
    1717        font-size: 11px;
    1818    }
    1919   
    20 .bp_core_widget_members img#ajax-loader-members {
     20.widget_bp_core_members_widget img#ajax-loader-members {
    2121    float: right;
    2222}
  • trunk/bp-forums/bbpress-plugins/buddypress-enable.php

    r1366 r1608  
    2424        $_post['pingback_queued']
    2525    );
    26    
    27     $_post['post_text'] = str_replace( '<', '[', $_post['post_text'] );
    28     $_post['post_text'] = str_replace( '>', ']', $_post['post_text'] );
    29    
     26
    3027    return $_post;
    3128}
     
    5047function for_buddypress_pre_post( $post_text, $post_id, $topic_id ){
    5148    $post_text = stripslashes( stripslashes_deep($post_text) );
    52     $post_text = str_replace( '/amp/', '&', $post_text );
    5349    $post_text = html_entity_decode( $post_text, ENT_COMPAT, "UTF-8" );
    5450
  • trunk/bp-forums/bp-forums-filters.php

    r1408 r1608  
    22
    33/* BuddyPress filters */
    4 add_filter( 'bp_forums_new_post_text', 'bp_forums_filter_encode' );
    5 
    6 add_filter( 'bp_get_the_topic_post_content', 'bp_forums_filter_decode' );
    7 add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_forums_filter_decode' );
    8 
    94add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_create_excerpt' );
    105
     
    3328add_filter( 'bp_get_the_topic_post_content', 'make_clickable' );
    3429
     30add_filter( 'bp_get_activity_content', 'bp_forums_filter_decode' );
     31add_filter( 'bp_forums_new_post_text', 'bp_forums_filter_encode' );
     32
     33add_filter( 'bp_get_the_topic_post_content', 'bp_forums_filter_decode' );
     34add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_forums_filter_decode' );
     35
    3536function bp_forums_add_allowed_tags( $allowedtags ) {
    3637    $allowedtags['p'] = array();
     
    4041}
    4142add_filter( 'edit_allowedtags', 'bp_forums_add_allowed_tags' );
    42 
    4343
    4444function bp_forums_filter_encode( $content ) {
     
    5555    $content = str_replace( ']', '>', $content );
    5656    $content = stripslashes( wp_filter_kses( $content ) );
    57        
     57
    5858    return $content;
    5959}
  • trunk/bp-forums/installation-readme.txt

    r1366 r1608  
    6060        $bb->bb_xmlrpc_allow_user_switching = true;
    6161
    62 12. Log into your WPMU admin interface and head to "Site Admin > Group Forums" fill in the details on that
     6212. Log into your WPMU admin interface and head to "BuddyPress > Forums Setup" fill in the details on that
    6363    page. Make sure you don't leave out the ending slash on your bbPress URL. (http://example.com/bbpress/)
    6464    Enter the username and password for the user that you signed up in step 8.
  • trunk/bp-groups/bp-groups-filters.php

    r1484 r1608  
    4242add_filter( 'bp_get_the_site_group_description', 'wp_filter_kses', 1 );
    4343add_filter( 'bp_get_the_site_group_description_excerpt', 'wp_filter_kses', 1 );
    44 add_filter( 'groups_details_name_pre_save', 'wp_filter_kses', 1 );
    45 add_filter( 'groups_details_description_pre_save', 'wp_filter_kses', 1 );
    46 add_filter( 'groups_details_news_pre_save', 'wp_filter_kses', 1 );
     44add_filter( 'groups_group_name_before_save', 'wp_filter_kses', 1 );
     45add_filter( 'groups_group_description_before_save', 'wp_filter_kses', 1 );
     46add_filter( 'groups_group_news_before_save', 'wp_filter_kses', 1 );
    4747
    4848add_filter( 'bp_get_group_description', 'stripslashes' );
     
    5353add_filter( 'groups_new_group_forum_desc', 'bp_create_excerpt' );
    5454
     55add_filter( 'groups_group_name_before_save', 'force_balance_tags' );
     56add_filter( 'groups_group_description_before_save', 'force_balance_tags' );
     57add_filter( 'groups_group_news_before_save', 'force_balance_tags' );
     58
    5559?>
  • trunk/bp-groups/bp-groups-widgets.php

    r1599 r1608  
    33/* Register widgets for groups component */
    44function groups_register_widgets() {
    5     global $current_blog;
    6    
    7     /* Site welcome widget */
    8     wp_register_sidebar_widget( 'buddypress-groups', __( 'Groups', 'buddypress' ), 'groups_widget_groups_list' );
    9     wp_register_widget_control( 'buddypress-groups', __( 'Groups', 'buddypress' ), 'groups_widget_groups_list_control' );
    10    
    11     /* Include the javascript needed for activated widgets only */
    12     if ( is_active_widget( 'groups_widget_groups_list' ) ) {
    13         wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.js', array('jquery', 'jquery-livequery-pack') );       
    14         wp_enqueue_style( 'groups_widget_members-css', BP_PLUGIN_URL . '/bp-groups/css/widget-groups.css' );       
    15     }
     5    add_action('widgets_init', create_function('', 'return register_widget("BP_Groups_Widget");') );   
    166}
    177add_action( 'plugins_loaded', 'groups_register_widgets' );
     
    199/*** GROUPS WIDGET *****************/
    2010
    21 function groups_widget_groups_list($args) {
    22     global $current_blog, $bp;
    23    
    24     extract($args);
    25     $options = get_blog_option( $current_blog->blog_id, 'groups_widget_groups_list' );
    26 ?>
    27     <?php echo $before_widget; ?>
    28     <?php echo $before_title
    29         . $widget_name
    30         . $after_title; ?>
    31 
    32     <?php
    33     if ( empty( $options['max_groups'] ) || !$options['max_groups'] )
    34         $options['max_groups'] = 5;
    35        
    36     if ( !$groups = wp_cache_get( 'popular_groups', 'bp' ) ) {
    37         $groups = groups_get_popular( $options['max_groups'], 1 );
    38         wp_cache_set( 'popular_groups', $groups, 'bp' );
    39     }
    40     ?>
    41 
    42     <?php if ( $groups['groups'] ) : ?>
    43         <div class="item-options" id="groups-list-options">
    44             <img id="ajax-loader-groups" src="<?php echo $bp->groups->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( 'Loading', 'buddypress' ) ?>" style="display: none;" />
    45             <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="newest-groups"><?php _e("Newest", 'buddypress') ?></a> |
    46             <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="recently-active-groups"><?php _e("Active", 'buddypress') ?></a> |
    47             <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="popular-groups" class="selected"><?php _e("Popular", 'buddypress') ?></a>
    48         </div>
    49         <ul id="groups-list" class="item-list">
    50             <?php foreach ( $groups['groups'] as $group_id ) : ?>
    51                 <?php
    52                 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $group_id->group_id, 'bp' ) ) {
    53                     $group = new BP_Groups_Group( $group_id->group_id, false, false );
    54                     wp_cache_set( 'groups_group_nouserdata_' . $group_id->group_id, $group, 'bp' );
    55                 }   
    56                 ?>
    57                 <li>
    58                     <div class="item-avatar">
    59                         <a href="<?php echo bp_get_group_permalink( $group ) ?>" title="<?php echo bp_get_group_name( $group ) ?>"><?php echo bp_get_group_avatar_thumb( $group ); ?></a>
    60                     </div>
    61 
    62                     <div class="item">
    63                         <div class="item-title"><a href="<?php echo bp_get_group_permalink( $group ) ?>" title="<?php echo bp_get_group_name( $group ) ?>"><?php echo bp_get_group_name( $group ) ?></a></div>
    64                         <div class="item-meta">
    65                         <span class="activity">
    66                             <?php
    67                             if ( 1 == $group->total_member_count )
    68                                 echo $group->total_member_count . __(' member', 'buddypress');
    69                             else
    70                                 echo $group->total_member_count . __(' members', 'buddypress');
    71                             ?>
    72                         </span></div>
    73                     </div>
    74                 </li>
    75                 <?php $counter++; ?>   
    76             <?php endforeach; ?>
    77         </ul>
    78        
    79         <?php
    80         if ( function_exists('wp_nonce_field') )
    81             wp_nonce_field( 'groups_widget_groups_list', '_wpnonce-groups' );
    82         ?>
    83        
    84         <input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo attribute_escape( $options['max_groups'] ); ?>" />
    85        
    86     <?php else: ?>
    87         <div class="widget-error">
    88             <?php _e('There are no groups to display.', 'buddypress') ?>
    89         </div>
    90     <?php endif; ?>
    91    
    92     <?php echo $after_widget; ?>
    93 <?php
    94 }
    95 
    96 function groups_widget_groups_list_control() {
    97     global $current_blog;
    98    
    99     $options = $newoptions = get_blog_option( $current_blog->blog_id, 'groups_widget_groups_list');
    100 
    101     if ( $_POST['groups-widget-groups-list-submit'] ) {
    102         $newoptions['max_groups'] = strip_tags( stripslashes( $_POST['groups-widget-groups-list-max'] ) );
    103     }
    104    
    105     if ( $options != $newoptions ) {
    106         $options = $newoptions;
    107         update_blog_option( $current_blog->blog_id, 'groups_widget_groups_list', $options );
     11class BP_Groups_Widget extends WP_Widget {
     12    function bp_groups_widget() {
     13        parent::WP_Widget( false, $name = 'Groups' );
     14        wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.js', array('jquery', 'jquery-livequery-pack') );       
     15        wp_enqueue_style( 'groups_widget_members-css', BP_PLUGIN_URL . '/bp-groups/css/widget-groups.css' );       
    10816    }
    10917
     18    function widget($args, $instance) {
     19        global $bp;
     20       
     21        extract( $args );
     22       
     23        echo $before_widget;
     24        echo $before_title
     25           . $widget_name
     26           . $after_title; ?>
     27   
     28        <?php
     29        if ( empty( $instance['max_groups'] ) || !$instance['max_groups'] )
     30            $instance['max_groups'] = 5; ?>
     31       
     32        <?php if ( bp_has_site_groups( 'type=popular&max=' . $instance['max_groups'] ) ) : ?>
     33            <div class="item-options" id="groups-list-options">
     34                <img id="ajax-loader-groups" src="<?php echo $bp->groups->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( 'Loading', 'buddypress' ) ?>" style="display: none;" />
     35                <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="newest-groups"><?php _e("Newest", 'buddypress') ?></a> |
     36                <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="recently-active-groups"><?php _e("Active", 'buddypress') ?></a> |
     37                <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="popular-groups" class="selected"><?php _e("Popular", 'buddypress') ?></a>
     38            </div>
     39           
     40            <ul id="groups-list" class="item-list">
     41                <?php while ( bp_site_groups() ) : bp_the_site_group(); ?>
     42                    <li>
     43                        <div class="item-avatar">
     44                            <a href="<?php bp_the_site_group_link() ?>"><?php bp_the_site_group_avatar_thumb() ?></a>
     45                        </div>
     46
     47                        <div class="item">
     48                            <div class="item-title"><a href="<?php bp_the_site_group_link() ?>" title="<?php bp_the_site_group_name() ?>"><?php bp_the_site_group_name() ?></a></div>
     49                            <div class="item-meta"><span class="activity"><?php bp_the_site_group_member_count() ?></span></div>
     50                        </div>
     51                    </li>
     52
     53                <?php endwhile; ?>
     54            </ul>       
     55            <?php wp_nonce_field( 'groups_widget_groups_list', '_wpnonce-groups' ); ?>
     56            <input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo attribute_escape( $instance['max_groups'] ); ?>" />
     57           
     58        <?php else: ?>
     59
     60            <div class="widget-error">
     61                <?php _e('There are no groups to display.', 'buddypress') ?>
     62            </div>
     63
     64        <?php endif; ?>
     65           
     66        <?php echo $after_widget; ?>
     67    <?php
     68    }
     69
     70    function update( $new_instance, $old_instance ) {
     71        $instance = $old_instance;
     72        $instance['max_groups'] = strip_tags( $new_instance['max_groups'] );
     73
     74        return $instance;
     75    }
     76
     77    function form( $instance ) {
     78        $instance = wp_parse_args( (array) $instance, array( 'max_groups' => 5 ) );
     79        $max_groups = strip_tags( $instance['max_groups'] );
     80        ?>
     81
     82        <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 attribute_escape( $max_groups ); ?>" style="width: 30%" /></label></p>
     83    <?php
     84    }
     85}
    11086?>
    111         <p><label for="groups-widget-groups-list-max"><?php _e('Maximum number of groups to show:', 'buddypress'); ?><br /> <input class="widefat" id="groups-widget-groups-list-max" name="groups-widget-groups-list-max" type="text" value="<?php echo attribute_escape( $options['max_groups'] ); ?>" style="width: 30%" /></label></p>
    112         <input type="hidden" id="groups-widget-groups-list-submit" name="groups-widget-groups-list-submit" value="1" />
    113 <?php
    114 }
  • trunk/bp-groups/css/widget-groups.css

    r1366 r1608  
    1 .groups_widget_groups_list ul#groups-list {
     1.widget_bp_groups_widget ul#groups-list {
    22    margin: 15px 0 0 0;
    33    padding: 0;
    44    list-style: none;
    55}
    6    
    7     .groups_widget_groups_list ul#groups-list li {
     6    .widget_bp_groups_widget ul#groups-list li {
    87        min-height: 60px;
    98    }
    109   
    11     .groups_widget_groups_list ul#groups-list li img.avatar {
     10    .widget_bp_groups_widget ul#groups-list li img.avatar {
    1211        float: left;
    1312        margin: 0 10px 0 0;
    1413    }
    1514   
    16     .groups_widget_groups_list ul#groups-list li span.activity {
     15    .widget_bp_groups_widget ul#groups-list li span.activity {
    1716        font-size: 11px;
    1817    }
    1918   
    20 .groups_widget_groups_list img#ajax-loader-groups {
     19.widget_bp_groups_widget img#ajax-loader-groups {
    2120    float: right;
    2221}
  • trunk/bp-loader.php

    r1573 r1608  
    55Description: BuddyPress will add social networking features to a new or existing WordPress MU installation.
    66Author: The BuddyPress Community
     7<<<<<<< .working
    78Version: 1.1-bleeding
     9=======
     10Version: 1.0.2
     11>>>>>>> .merge-right.r1607
    812Author URI: http://buddypress.org/developers/
    913Site Wide Only: true
  • trunk/bp-messages/bp-messages-filters.php

    r1418 r1608  
    1313add_filter( 'messages_notice_message_before_save', 'wp_filter_kses', 1 );
    1414add_filter( 'messages_notice_subject_before_save', 'wp_filter_kses', 1 );
     15
     16add_filter( 'messages_message_content_before_save', 'force_balance_tags' );
     17add_filter( 'messages_message_subject_before_save', 'force_balance_tags' );
     18add_filter( 'messages_notice_message_before_save', 'force_balance_tags' );
     19add_filter( 'messages_notice_subject_before_save', 'force_balance_tags' );
    1520
    1621add_filter( 'bp_get_message_notice_subject', 'wptexturize' );
  • trunk/bp-themes/bphome/css/base.css

    r1592 r1608  
    159159    }
    160160
    161     .bp_core_widget_welcome h2 {
     161    .widget_bp_core_welcome_widget h2 {
    162162        background: url(../images/welcome_header_back.gif) top left no-repeat !important;
    163163        color: #fff !important;
     
    183183    }
    184184   
    185     .bp_blogs_widget_recent_posts img.avatar {
     185    .widget_bp_blogs_widget_recent_posts img.avatar {
    186186        width: 50px !important;
    187187        height: 50px !important;
     
    191191        margin-left: 71px;
    192192    }
    193         .bp_blogs_widget_recent_posts ul.item-list li .item {
    194             margin-left: 31px;
     193        .widget_bp_blogs_recent_posts_widget ul.item-list li .item {
     194            margin-left: 31px !important;
    195195        }
    196196   
     
    206206    }
    207207   
    208     .bp_core_widget_whos_online .item-avatar {
     208    .widget_bp_core_widget_whos_online .item-avatar {
    209209        float: left;
    210210        margin-right: 10px;
     
    277277/** ACTIVITY FEED **********/
    278278
    279 .bp_activity_widget_sitewide_activity {
     279.widget_bp_activity_widget {
    280280    float: left;
    281281    width: 100%;
     
    329329}
    330330
    331 .bp_activity_widget_sitewide_activity ul#activity-filter-links {
     331.widget_bp_activity_widget ul#activity-filter-links {
    332332    background: url(../images/item_list_back.gif) top left repeat-x;
    333333    padding: 15px;
     
    335335}
    336336
    337 .bp_activity_widget_sitewide_activity ul#activity-filter-links li {
     337.widget_bp_activity_widget ul#activity-filter-links li {
    338338    float: left;
    339339}
    340     .bp_activity_widget_sitewide_activity ul#activity-filter-links li a {
     340    .widget_bp_activity_widget ul#activity-filter-links li a {
    341341        display: block;
    342342        padding: 2px 8px 2px 30px;
     
    350350        text-decoration: none;
    351351    }
    352         .bp_activity_widget_sitewide_activity ul#activity-filter-links li a.selected {
     352        .widget_bp_activity_widget ul#activity-filter-links li a.selected {
    353353            border: 1px solid #ccc;
    354354            font-weight: bold;
  • trunk/bp-themes/bphome/style.css

    r1522 r1608  
    33Theme URI: http://buddypress.com/
    44Description: A widget framework theme for the home of a BuddyPress enabled installation. This theme is not required to use BuddyPress.
    5 Version: 1.0.1
     5Version: 1.0.2
    66Author: Andy Peatling
    77Author URI: http://apeatling.wordpress.com
  • trunk/bp-wire/bp-wire-filters.php

    r1408 r1608  
    33/* Apply WordPress defined filters */
    44add_filter( 'bp_get_wire_post_content', 'wp_filter_kses', 1 );
    5 add_filter( 'bp_wire_post_content_before_save', 'wp_filter_kses', 1 );
    6 
    75add_filter( 'bp_get_wire_post_content', 'wptexturize' );
    8 
    96add_filter( 'bp_get_wire_post_content', 'convert_smilies', 2 );
    10 
    117add_filter( 'bp_get_wire_post_content', 'convert_chars' );
    12 
    138add_filter( 'bp_get_wire_post_content', 'wpautop' );
    14 
    159add_filter( 'bp_get_wire_post_content', 'stripslashes_deep' );
    16 
    1710add_filter( 'bp_get_wire_post_content', 'make_clickable' );
    1811
     12add_filter( 'bp_wire_post_content_before_save', 'wp_filter_kses', 1 );
     13add_filter( 'bp_wire_post_content_before_save', 'force_balance_tags' );
     14
    1915?>
  • trunk/bp-xprofile/bp-xprofile-filters.php

    r1408 r1608  
    66add_filter( 'xprofile_field_name_before_save', 'wp_filter_kses', 1 );
    77add_filter( 'xprofile_field_description_before_save', 'wp_filter_kses', 1 );
     8
     9add_filter( 'xprofile_field_name_before_save', 'force_balance_tags' );
     10add_filter( 'xprofile_field_description_before_save', 'force_balance_tags' );
    811
    912add_filter( 'bp_get_the_profile_field_value', 'wptexturize' );
  • trunk/bp-xprofile/bp-xprofile-templatetags.php

    r1536 r1608  
    112112    function has_fields() {
    113113        $has_data = false;
    114 
    115         if ( count($this->group->fields) > 0 ) {
    116             for ( $i = 0; $i < count($this->group->fields); $i++ ) {
    117                 $field = $this->group->fields[$i];
    118 
    119                 if ( $field->data->value != null ) {
    120                     $has_data = true;
    121                 }
     114        $just_name = true;
     115       
     116        for ( $i = 0; $i < count( $this->group->fields ); $i++ ) {
     117            $field = &$this->group->fields[$i];
     118
     119            if ( $field->data->value != null ) {
     120                $has_data = true;
     121               
     122                if ( 1 != $field->id )
     123                    $just_name = false;
    122124            }
    123125        }
    124 
    125         if($has_data)
     126       
     127        if ( 1 == $this->group->id && $just_name )
     128            return false;
     129
     130        if ( $has_data )
    126131            return true;
    127132       
     
    144149
    145150        $field = $this->next_field();
     151       
     152        /* Skip the name field */
     153        if ( 1 == $field->id )
     154            $field = $this->next_field();
     155           
    146156        $this->is_public = $field->is_public;   
    147157        if ( $field->data->value != '' ) {
Note: See TracChangeset for help on using the changeset viewer.