Skip to:
Content

BuddyPress.org

Changeset 2761


Ignore:
Timestamp:
02/22/2010 01:25:56 PM (14 years ago)
Author:
apeatling
Message:

Merging 1.2 branch into trunk

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r2737 r2761  
    9494    global $wpdb, $bp;
    9595
    96     if ( $bp->site_options['bp-activity-db-version'] < BP_ACTIVITY_DB_VERSION )
     96    if ( get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_DB_VERSION )
    9797        bp_activity_install();
    9898}
     
    589589        if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) {
    590590            $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden );
    591             wp_cache_set( 'bp_activity_sitewide_front', BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden ), 'bp' );
     591            wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp' );
    592592        }
    593593    } else
     
    10121012    bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
    10131013
     1014    do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id );
     1015
    10141016    return true;
    10151017}
     
    10361038
    10371039    update_usermeta( $user_id, 'bp_favorite_activities', $my_favs );
     1040
     1041    do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id );
    10381042
    10391043    return true;
     
    11101114        return false;
    11111115
    1112     $metas = array_map( 'maybe_unserialize', $metas );
     1116    $metas = array_map( 'maybe_unserialize', (array)$metas );
    11131117
    11141118    if ( 1 == count($metas) )
  • trunk/bp-activity/bp-activity-templatetags.php

    r2730 r2761  
    191191            $display_comments = 'stream';
    192192
    193         $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0;
    194 
    195193        if ( $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id ) {
     194            $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0;
     195
    196196            switch ( $scope ) {
    197197                case 'friends':
     
    225225                    $user_nicename = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename;
    226226                    $user_login = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
    227                     $search_terms = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login );
     227                    $search_terms = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login ) . '<'; // Start search at @ symbol and stop search at closing tag delimiter.
    228228                    $display_comments = 'stream';
    229229                    $user_id = false;
     
    460460    }
    461461
     462    function bp_activity_has_content() {
     463        global $activities_template;
     464
     465        if ( !empty( $activities_template->activity->content ) )
     466            return true;
     467
     468        return false;
     469    }
     470
    462471function bp_activity_content() {
    463472    echo bp_get_activity_content();
     
    574583
    575584                /* Delete link */
    576                 if ( is_site_admin() || $bp->loggedin_user->id == $comment->user_id )
     585                if ( $bp->loggedin_user->is_site_admin || $bp->loggedin_user->id == $comment->user_id )
    577586                    $content .= ' &middot; <a href="' . wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/?cid=' . $comment->id, 'bp_activity_delete_link' ) . '" class="delete acomment-delete">' . __( 'Delete', 'buddypress' ) . '</a>';
    578587
  • trunk/bp-blogs.php

    r2737 r2761  
    11<?php
    22
    3 define ( 'BP_BLOGS_DB_VERSION', '2000' );
     3define ( 'BP_BLOGS_DB_VERSION', '2015' );
    44
    55/* Define the slug for the component */
     
    5353
    5454    $sql[] = "CREATE TABLE {$bp->blogs->table_name_blogmeta} (
    55             id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    56             blog_id bigint(20) NOT NULL,
    57             meta_key varchar(255) DEFAULT NULL,
    58             meta_value longtext DEFAULT NULL,
    59             KEY blog_id (blog_id),
    60             KEY meta_key (meta_key)
    61            ) {$charset_collate};";
     55                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
     56                blog_id bigint(20) NOT NULL,
     57                meta_key varchar(255) DEFAULT NULL,
     58                meta_value longtext DEFAULT NULL,
     59                KEY blog_id (blog_id),
     60                KEY meta_key (meta_key)
     61             ) {$charset_collate};";
    6262
    6363
     
    8181    if ( is_site_admin() && bp_core_is_multisite() ) {
    8282        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    83         if ( $bp->site_options['bp-blogs-db-version'] < BP_BLOGS_DB_VERSION )
     83        if ( get_site_option( 'bp-blogs-db-version' ) < BP_BLOGS_DB_VERSION )
    8484            bp_blogs_install();
    8585    }
     
    333333
    334334function bp_blogs_record_existing_blogs() {
    335     global $wpdb;
    336 
    337     $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE public = 1 AND mature = 0 AND spam = 0 AND deleted = 0" ) );
     335    global $bp, $wpdb;
     336
     337    /* Truncate user blogs table and re-record. */
     338    $wpdb->query( "TRUNCATE TABLE {$bp->blogs->table_name}" );
     339
     340    $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0" ) );
    338341
    339342    if ( $blog_ids ) {
     
    361364    $name = get_blog_option( $blog_id, 'blogname' );
    362365    $description = get_blog_option( $blog_id, 'blogdescription' );
     366
     367    if ( empty( $name ) )
     368        return false;
    363369
    364370    $recorded_blog = new BP_Blogs_Blog;
     
    545551add_action( 'wp_set_comment_status', 'bp_blogs_manage_comment', 10, 2 );
    546552
    547 function bp_blogs_add_user_to_blog( $user_id, $role, $blog_id ) {
    548     if ( $role != 'subscriber' ) {
     553function bp_blogs_add_user_to_blog( $user_id, $role, $blog_id = false ) {
     554    global $current_blog;
     555
     556    if ( empty( $blog_id ) )
     557        $blog_id = $current_blog->blog_id;
     558
     559    if ( $role != 'subscriber' )
    549560        bp_blogs_record_blog( $blog_id, $user_id, true );
    550     }
    551561}
    552562add_action( 'add_user_to_blog', 'bp_blogs_add_user_to_blog', 10, 3 );
    553563
    554 function bp_blogs_remove_user_from_blog( $user_id, $blog_id ) {
     564function bp_blogs_remove_user_from_blog( $user_id, $blog_id = false ) {
     565    global $current_blog;
     566
     567    if ( empty( $blog_id ) )
     568        $blog_id = $current_blog->blog_id;
     569
    555570    bp_blogs_remove_blog_for_user( $user_id, $blog_id );
    556571}
     
    774789    }
    775790
    776     $metas = array_map('maybe_unserialize', $metas);
     791    $metas = array_map('maybe_unserialize', (array)$metas);
    777792
    778793    if ( 1 == count($metas) )
  • trunk/bp-blogs/bp-blogs-classes.php

    r2579 r2761  
    210210
    211211        // If the user is logged in return the blog count including their hidden blogs.
    212         if ( !is_user_logged_in() || $user_id != $bp->loggedin_user->id )
     212        if ( ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) || is_site_admin() )
     213            return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
     214        else
    213215            return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
    214         else
    215             return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
    216216    }
    217217
  • trunk/bp-core.php

    r2737 r2761  
    106106    /* The core userdata of the user who is currently logged in. */
    107107    $bp->loggedin_user->userdata = bp_core_get_core_userdata( $bp->loggedin_user->id );
     108
     109    /* is_site_admin() hits the DB on single WP installs, so we need to get this separately so we can call it in a loop. */
     110    $bp->loggedin_user->is_site_admin = is_site_admin();
    108111
    109112    /* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */
     
    267270
    268271    /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    269     if ( $bp->site_options['bp-core-db-version'] < BP_CORE_DB_VERSION )
     272    if ( get_site_option( 'bp-core-db-version' ) < BP_CORE_DB_VERSION )
    270273        bp_core_install();
    271274}
     
    15601563
    15611564    $options = apply_filters( 'bp_core_site_options', array(
    1562         'bp-core-db-version',
    1563         'bp-activity-db-version',
    1564         'bp-blogs-db-version',
    1565         'bp-friends-db-version',
    1566         'bp-groups-db-version',
    1567         'bp-messages-db-version',
    1568         'bp-xprofile-db-version',
    15691565        'bp-deactivated-components',
    15701566        'bp-blogs-first-install',
     
    20482044        $ct = current_theme_info();
    20492045
    2050         if ( !in_array( 'buddypress', (array)$ct->tags ) ) { ?>
     2046        /* The best way to remove this notice is to add a "buddypress" tag to your active theme's CSS header. */
     2047        if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array)$ct->tags ) ) { ?>
    20512048            <div id="message" class="updated fade">
    2052                 <p style="line-height: 150%"><?php printf( __( "<strong>BuddyPress is ready</strong>. You'll need to <a href='%s'>activate a BuddyPress compatible theme</a> to take advantage of all of the features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a>.", 'buddypress' ), admin_url( 'themes.php' ), admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ) ) ?></p>
     2049                <p style="line-height: 150%"><?php printf( __( "<strong>BuddyPress is ready</strong>. You'll need to <a href='%s'>activate a BuddyPress compatible theme</a> to take advantage of all of the features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>upgrade your existing WordPress theme</a>.", 'buddypress' ), admin_url( 'themes.php' ), admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ), admin_url( 'plugin-install.php?type=term&tab=search&s=bp-template-pack' ) ) ?></p>
    20532050            </div><?php
    20542051        }
  • trunk/bp-core/bp-core-wpabstraction.php

    r2349 r2761  
    9797        $errors = new WP_Error();
    9898
    99         $user_name = preg_replace( "/\s+/", '', sanitize_user( $user_name, true ) );
    10099        $user_email = sanitize_email( $user_email );
    101100
     
    106105        preg_match( "/[a-z0-9]+/", $user_name, $maybe );
    107106
    108         if( $user_name != $maybe[0] ) {
    109             $errors->add('user_name', __("Only lowercase letters and numbers allowed"));
    110         }
    111 
    112107        $illegal_names = get_site_option( "illegal_names" );
    113108        if( is_array( $illegal_names ) == false ) {
     
    115110            add_site_option( "illegal_names", $illegal_names );
    116111        }
    117         if( in_array( $user_name, $illegal_names ) == true ) {
    118             $errors->add('user_name',  __("That username is not allowed"));
     112
     113        if ( !validate_username( $user_name ) || in_array( $user_name, $illegal_names ) == true || $user_name != $maybe[0] ) {
     114            $errors->add('user_name', __("Only lowercase letters and numbers allowed"));
    119115        }
    120116
  • trunk/bp-forums/bp-forums-templatetags.php

    r2695 r2761  
    882882        global $topic_template;
    883883
    884         return apply_filters( 'bp_get_the_topic_post_poster_name', bp_core_get_user_domain( $topic_template->post->poster_id, $topic_template->post->poster_nicename, $topic_template->post->poster_login ) );
     884        return apply_filters( 'bp_the_topic_post_poster_link', bp_core_get_user_domain( $topic_template->post->poster_id, $topic_template->post->poster_nicename, $topic_template->post->poster_login ) );
    885885    }
    886886
  • trunk/bp-friends.php

    r2737 r2761  
    5757
    5858    /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    59     if ( $bp->site_options['bp-friends-db-version'] < BP_FRIENDS_DB_VERSION )
     59    if ( get_site_option( 'bp-friends-db-version' ) < BP_FRIENDS_DB_VERSION )
    6060        friends_install();
    6161}
  • trunk/bp-groups.php

    r2737 r2761  
    109109function groups_check_installed() {
    110110    /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    111     if ( $bp->site_options['bp-groups-db-version'] < BP_GROUPS_DB_VERSION )
     111    if ( get_site_option( 'bp-groups-db-version' ) < BP_GROUPS_DB_VERSION )
    112112        groups_install();
    113113}
     
    12961296
    12971297    $r = wp_parse_args( $args, $defaults );
    1298     extract( $r, EXTR_SKIP );
     1298    extract( $r );
    12991299
    13001300    return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
     
    24512451    }
    24522452
    2453     $metas = array_map('maybe_unserialize', $metas);
     2453    $metas = array_map('maybe_unserialize', (array)$metas);
    24542454
    24552455    if ( 1 == count($metas) )
  • trunk/bp-groups/bp-groups-classes.php

    r2622 r2761  
    11651165
    11661166    /* Register the group extension on the plugins_loaded action so we have access to all plugins */
    1167     add_action( 'plugins_loaded', create_function( '', '$extension = new ' . $group_extension_class . '; add_action( "wp", array( &$extension, "_register" ), 2 );' ) );
     1167    add_action( 'bp_init', create_function( '', '$extension = new ' . $group_extension_class . '; add_action( "wp", array( &$extension, "_register" ), 2 );' ), 11 );
    11681168}
    11691169
  • trunk/bp-messages.php

    r2737 r2761  
    9292
    9393    /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    94     if ( $bp->site_options['bp-messages-db-version'] < BP_MESSAGES_DB_VERSION )
     94    if ( get_site_option( 'bp-messages-db-version' ) < BP_MESSAGES_DB_VERSION )
    9595        messages_install();
    9696}
  • trunk/bp-themes/bp-default/activity/entry.php

    r2692 r2761  
    1616        </div>
    1717
    18         <?php if ( bp_get_activity_content_body() ) : ?>
     18        <?php if ( bp_activity_has_content() ) : ?>
    1919            <div class="activity-inner">
    2020                <?php bp_activity_content_body() ?>
  • trunk/bp-themes/bp-default/functions.php

    r2723 r2761  
    128128/****
    129129 * Custom header image support. You can remove this entirely in a child theme by adding this line
    130  * to your functions.php: remove_action( 'init', 'bp_dtheme_add_custom_header_support' );
     130 * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true );
    131131 */
    132132function bp_dtheme_add_custom_header_support() {
     
    200200    add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
    201201}
    202 add_action( 'init', 'bp_dtheme_add_custom_header_support' );
     202if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) )
     203    add_action( 'init', 'bp_dtheme_add_custom_header_support' );
    203204
    204205/* Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) */
     
    230231add_action( 'wp_footer', 'bp_dtheme_js_terms' );
    231232
    232 //Google Maps Shortcode
    233 function fn_googleMaps($atts, $content = null) {
    234     extract( shortcode_atts( array( "width" => '640', "height" => '480', "src" => '' ), $atts ) );
    235     return '<iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'"></iframe>';
    236 }
    237 add_shortcode( "googlemap", "fn_googleMaps" );
    238 
    239233?>
  • trunk/bp-xprofile.php

    r2737 r2761  
    156156
    157157    /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    158     if ( $bp->site_options['bp-xprofile-db-version'] < BP_XPROFILE_DB_VERSION )
     158    if ( get_site_option( 'bp-xprofile-db-version' ) < BP_XPROFILE_DB_VERSION )
    159159        xprofile_install();
    160160}
Note: See TracChangeset for help on using the changeset viewer.