Skip to:
Content

BuddyPress.org

Changeset 430


Ignore:
Timestamp:
10/23/2008 04:15:30 PM (18 years ago)
Author:
apeatling
Message:

Added load_textdomain() call.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-classes.php

    r387 r430  
    8383           
    8484        $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $bp['blogs']['table_name'] . " WHERE user_id = %d", $user_id) );
    85         $total_blog_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(blog_id) FROM " . $bp['blogs']['table_name'] . " WHERE user_id = %d", $user_id) );
     85        $total_blog_count = BP_Blogs_Blog::total_blog_count( $user_id );
    8686       
    8787        for ( $i = 0; $i < count($blog_ids); $i++ ) {
     
    9696        return array( 'blogs' => $blogs, 'count' => $total_blog_count );
    9797    }
     98   
     99    function total_blog_count( $user_id = null ) {
     100        global $bp, $wpdb;
     101       
     102        if ( !$user_id )
     103            $user_id = $bp['current_userid'];
     104       
     105        return $wpdb->get_var( $wpdb->prepare( "SELECT count(blog_id) FROM " . $bp['blogs']['table_name'] . " WHERE user_id = %d", $user_id) );
     106    }
    98107}
    99108
  • trunk/bp-core.php

    r429 r430  
    22/* Define the current version number for checking if DB tables are up to date. */
    33define( 'BP_CORE_VERSION', '0.2.6.1' );
     4
     5/* Load the language file */
     6if ( file_exists(ABSPATH . 'wp-content/mu-plugins/bp-languages/buddypress-' . get_locale() . '.mo') )
     7    load_textdomain( 'buddypress', ABSPATH . 'wp-content/mu-plugins/bp-languages/buddypress-' . get_locale() . '.mo' );
    48
    59/* These components are accessed via the root, and not under a blog name or home base.
  • trunk/bp-core/bp-core-catchuri.php

    r394 r430  
    1515 *
    1616 * The URI's are broken down as follows:
    17  *   - VHOST: http:// andy.domain.com / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
    18  *   - NO VHOST: http:// domain.com / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
    19  *   - OUTSIDE ROOT: http:// domain.com / sites / buddypress / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
     17 *   - http:// domain.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
     18 *   - OUTSIDE ROOT: http:// domain.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
    2019 *
    2120 *  Example:
    22  *    - http://andy.domain.com/profile/edit/group/5/
     21 *    - http://domain.com/members/andy/profile/edit/group/5/
    2322 *    - $current_component: string 'profile'
    2423 *    - $current_action: string 'edit'
  • trunk/bp-core/bp-core-classes.php

    r394 r430  
    3030    var $status_last_updated;
    3131   
    32     var $content_last_updated;
     32    /* Extras */
     33    var $total_friends;
     34    var $total_blogs;
     35    var $total_groups;
    3336   
    34     function bp_core_user( $user_id ) {
     37    function bp_core_user( $user_id, $populate_extras = false ) {
    3538        if ( $user_id ) {
    3639            $this->id = $user_id;
    37             $this->populate( $this->id );
     40            $this->populate();
     41           
     42            if ( $populate_extras )
     43                $this->populate_extras();
    3844        }
    3945    }
     
    5460     */
    5561    function populate() {
    56         global $userdata;
    57 
    5862        $this->user_url = bp_core_get_userurl( $this->id );
    5963        $this->user_link = bp_core_get_userlink( $this->id );
     
    7276            $this->status = null; // TODO: Fetch status updates.
    7377            $this->status_last_updated = null;
     78        }
     79    }
     80   
     81    function populate_extras() {
     82        $this->total_friends = BP_Friends_Friendship::total_friend_count( $this->id );
     83
     84        if ( $this->total_friends ) {
     85            if ( $this->total_friends == 1 )
     86                $this->total_friends .= ' ' . __( 'friend', 'buddypress' );
     87            else
     88                $this->total_friends .= ' ' . __( 'friends', 'buddypress' );
     89        }
     90       
     91        if ( $this->total_blogs ) {
     92            if ( $this->total_blogs == 1 )
     93                $this->total_blogs .= ' ' . __( 'blog', 'buddypress' );
     94            else
     95                $this->total_blogs .= ' ' . __( 'blogs', 'buddypress' );           
     96        }
     97   
     98        if ( function_exists('groups_install') ) {
     99            $this->total_groups = BP_Groups_Member::total_group_count( $this->id );
     100           
     101            if ( $this->total_groups ) {
     102                if ( $this->total_groups == 1 )
     103                    $this->total_groups .= ' ' . __( 'group', 'buddypress' );
     104                else
     105                    $this->total_groups .= ' ' . __( 'groups', 'buddypress' );
     106            }
    74107        }
    75108    }
Note: See TracChangeset for help on using the changeset viewer.