Skip to:
Content

BuddyPress.org

Changeset 373


Ignore:
Timestamp:
10/07/2008 07:16:51 AM (18 years ago)
Author:
apeatling
Message:

Bug fixes:

  • Fixed group avatar upload issues
  • Fixed validation on group name/desc/news
  • Fixed support for https://
  • Base support for upcoming home theme and widgets
  • Re-factored JS and CSS inclusion with wp_enqueue_script/styles
Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r356 r373  
    33
    44define ( 'BP_ACTIVITY_IS_INSTALLED', 1 );
    5 define ( 'BP_ACTIVITY_VERSION', '0.1.7' );
     5define ( 'BP_ACTIVITY_VERSION', '0.1.8' );
    66
    77/* Use english formatted times - e.g. 6 hours / 8 hours / 1 day / 15 minutes */
     
    9090                'table_name_loggedin_user_friends_cached' => $wpdb->base_prefix . $bp['loggedin_homebase_id'] . '_friends_activity_cached',
    9191               
    92                 'image_base' => get_option('siteurl') . '/wp-content/mu-plugins/bp-activity/images',
     92                'image_base' => site_url() . '/wp-content/mu-plugins/bp-activity/images',
    9393                'slug'           => 'activity'
    9494        );
  • trunk/bp-blogs.php

    r371 r373  
    33
    44define ( 'BP_BLOGS_IS_INSTALLED', 1 );
    5 define ( 'BP_BLOGS_VERSION', '0.1.1' );
     5define ( 'BP_BLOGS_VERSION', '0.1.2' );
    66
    77/* These will be moved into admin configurable settings */
     
    1010
    1111include_once( 'bp-blogs/bp-blogs-classes.php' );
     12include_once( 'bp-blogs/bp-blogs-cssjs.php' );
     13include_once( 'bp-blogs/bp-blogs-templatetags.php' );
     14include_once( 'bp-blogs/bp-blogs-widgets.php' );
    1215//include_once( 'bp-blogs/bp-blogs-ajax.php' );
    13 include_once( 'bp-blogs/bp-blogs-cssjs.php' );
    14 /*include_once( 'bp-blogs/bp-blogs-admin.php' );*/
    15 include_once( 'bp-blogs/bp-blogs-templatetags.php' );
    16 
     16//include_once( 'bp-blogs/bp-blogs-admin.php' );
    1717
    1818/**************************************************************************
     
    105105                'table_name_blog_comments' => $wpdb->base_prefix . 'bp_user_blogs_comments',
    106106                'format_activity_function' => 'bp_blogs_format_activity',
    107                 'image_base' => get_option('siteurl') . '/wp-content/mu-plugins/bp-groups/images',
     107                'image_base' => site_url() . '/wp-content/mu-plugins/bp-groups/images',
    108108                'slug'           => 'blogs'
    109109        );
     
    455455
    456456function bp_blogs_register_existing_content( $blog_id ) {
    457         global $wpdb, $bp;
     457        global $bp, $current_blog;
    458458       
    459459        if ( !$bp ) {
     
    470470                                bp_blogs_record_blog( (int)$blog->userblog_id, (int)$user_id );
    471471
    472                                 $wpdb->set_blog_id( $blog->userblog_id );
     472                                switch_to_blog( $blog->userblog_id );
    473473                                $posts_for_blog = bp_core_get_all_posts_for_user( $user_id );
    474474                       
     
    479479                }
    480480        }       
     481       
     482        switch_to_blog( $current_blog->blog_id );
    481483}
    482484add_action( 'bp_homebase_signup_completed', 'bp_blogs_register_existing_content', 10 );
    483485
     486function bp_blogs_get_latest_posts( $blog_id = null, $limit = 5 ) {
     487        global $bp;
     488       
     489        if ( !is_numeric( $limit ) )
     490                $limit = 5;
     491       
     492        return BP_Blogs_Post::get_latest_posts( $blog_id, $limit );
     493}
     494
    484495
    485496?>
  • trunk/bp-blogs/bp-blogs-classes.php

    r371 r373  
    8484                $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $bp['blogs']['table_name'] . " WHERE user_id = %d", $user_id) );
    8585                $total_blog_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(blog_id) FROM " . $bp['blogs']['table_name'] . " WHERE user_id = %d", $user_id) );
    86        
     86               
    8787                for ( $i = 0; $i < count($blog_ids); $i++ ) {
    8888                        $blogs[] = array(
     
    183183        }
    184184       
     185        function get_latest_posts( $blog_id = null, $limit = 5 ) {
     186                global $wpdb, $bp;
     187               
     188                if ( $blog_id )
     189                        $blog_sql = $wpdb->prepare( " WHERE blog_id = %d", $blog_id );
     190               
     191                $post_ids = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, blog_id FROM " . $bp['blogs']['table_name_blog_posts'] . "$blog_sql ORDER BY date_created DESC LIMIT $limit" ) );
     192
     193                for ( $i = 0; $i < count($post_ids); $i++ ) {
     194                        $posts[$i] = BP_Blogs_Post::fetch_post_content($post_ids[$i]);
     195                }
     196               
     197                return $posts;
     198        }
     199       
    185200        function get_posts_for_user( $user_id = null ) {
    186201                global $bp, $wpdb;
  • trunk/bp-blogs/bp-blogs-cssjs.php

    r359 r373  
    66        if ( $wpdb->blogid == $bp['current_homebase_id'] ) {
    77                if ( strpos( $_GET['page'], 'bp-blogs' ) !== false ) {
    8                         wp_enqueue_style('bp-blogs-admin-css', get_option('siteurl') . '/wp-content/mu-plugins/bp-blogs/admin-tabs/admin.css');
     8                        wp_enqueue_style('bp-blogs-admin-css', site_url() . '/wp-content/mu-plugins/bp-blogs/admin-tabs/admin.css');
    99                }
    1010        }
  • trunk/bp-core.php

    r371 r373  
    11<?php
    2 
    3 /* Define the protocol to be used, change to https:// if on secure server. */
    4 define( 'PROTOCOL', 'http://' );
    5 
    62/* Define the current version number for checking if DB tables are up to date. */
    7 define( 'BP_CORE_VERSION', '0.2.4' );
     3define( 'BP_CORE_VERSION', '0.2.5' );
    84
    95/* Require all needed files */
    10 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-catchuri.php' );
    11 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-classes.php' );
    12 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-cssjs.php' );
    13 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-avatars.php' );
    14 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-templatetags.php' );
    15 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-adminbar.php' );
    16 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/admin-mods/bp-core-remove-blogtabs.php' );
    17 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/admin-mods/bp-core-admin-styles.php' );
    18 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/homebase-creation/bp-core-homebase-functions.php' );
     6require_once( 'bp-core/bp-core-catchuri.php' );
     7require_once( 'bp-core/bp-core-classes.php' );
     8require_once( 'bp-core/bp-core-cssjs.php' );
     9require_once( 'bp-core/bp-core-avatars.php' );
     10require_once( 'bp-core/bp-core-templatetags.php' );
     11require_once( 'bp-core/bp-core-adminbar.php' );
     12require_once( 'bp-core/bp-core-widgets.php' );
     13require_once( 'bp-core/bp-core-ajax.php' );
     14require_once( 'bp-core/admin-mods/bp-core-remove-blogtabs.php' );
     15require_once( 'bp-core/admin-mods/bp-core-admin-styles.php' );
     16require_once( 'bp-core/homebase-creation/bp-core-homebase-functions.php' );
     17
    1918
    2019/**
     
    102101        $bp['is_item_admin'] = bp_is_home();
    103102
     103        $bp['core'] = array(
     104                'image_base' => site_url() . '/wp-content/mu-plugins/bp-core/images',
     105        );
     106
     107
    104108        if ( !$bp['current_component'] )
    105109                $bp['current_component'] = $bp['default_component'];
     
    194198        global $current_blog;
    195199       
    196         if ( VHOST == 'yes' ) {
    197                 $current_domain = PROTOCOL . $current_blog->domain . '/';
    198         } else {
    199                 $current_domain = get_bloginfo('wpurl') . '/';
    200         }
    201        
    202         return $current_domain;
     200        return get_blog_option( $current_blog->blog_id, 'siteurl' ) . '/';
    203201}
    204202
     
    273271 * @return false if no, or true if yes.
    274272 */
    275 function bp_core_user_has_home() {
     273function bp_core_user_has_home( $user_id = false ) {
    276274        global $bp;
    277275
    278         if ( $bp['loggedin_homebase_id'] == '' )
    279                 return false;
    280        
    281         return true;
     276        if ( !$user_id ) {
     277                if ( $bp['loggedin_homebase_id'] == '' )
     278                        return false;
     279
     280                return $bp['loggedin_homebase_id'];
     281        } else {
     282                return get_usermeta( $user_id, 'home_base' );
     283        }
    282284}
    283285
     
    964966        // array of time period chunks
    965967        $chunks = array(
    966         array( 60 * 60 * 24 * 365 , 'year' ),
    967         array( 60 * 60 * 24 * 30 , 'month' ),
    968         array( 60 * 60 * 24 * 7, 'week' ),
    969         array( 60 * 60 * 24 , 'day' ),
    970         array( 60 * 60 , 'hour' ),
    971         array( 60 , 'minute' ),
     968        array( 60 * 60 * 24 * 365 , __('year') ),
     969        array( 60 * 60 * 24 * 30 , __('month') ),
     970        array( 60 * 60 * 24 * 7, __('week') ),
     971        array( 60 * 60 * 24 , __('day') ),
     972        array( 60 * 60 , __('hour') ),
     973        array( 60 , __('minute') ),
     974        array( 1, __('second') )
    972975        );
    973976
     
    10031006                $seconds2 = $chunks[$i + 1][0];
    10041007                $name2 = $chunks[$i + 1][1];
     1008               
     1009                if ( $name2 == __('second') ) return $output;
    10051010       
    10061011                if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) {
     
    10181023 * Record user activity to the database. Many functions use a "last active" feature to
    10191024 * show the length of time since the user was last active.
    1020  * This function will update that time as a usermeta setting for the user.
     1025 * This function will update that time as a usermeta setting for the user every 5 minutes.
    10211026 *
    10221027 * @package BuddyPress Core
     
    10251030 */
    10261031function bp_core_record_activity() {
    1027         global $userdata;
    1028        
    1029         // Updated last site activity for this user.
    1030         update_usermeta( $userdata->ID, 'last_activity', time() );
    1031 }
    1032 add_action( 'login_head', 'bp_core_record_activity' );
     1032        global $bp;
     1033       
     1034        if ( !is_user_logged_in() )
     1035                return false;
     1036       
     1037        if ( time() >= strtotime('+5 minutes', get_usermeta( $bp['loggedin_userid'], 'last_activity') ) || get_usermeta( $bp['loggedin_userid'], 'last_activity') == '' ) {
     1038                // Updated last site activity for this user.
     1039                update_usermeta( $bp['loggedin_userid'], 'last_activity', time() );
     1040        }
     1041}
     1042add_action( 'wp_head', 'bp_core_record_activity' );
     1043
     1044
     1045/**
     1046 * bp_core_get_last_activity()
     1047 *
     1048 * Formats last activity based on time since date given.
     1049 *
     1050 * @package BuddyPress Core
     1051 * @param last_activity_date The date of last activity.
     1052 * @param $before The text to prepend to the activity time since figure.
     1053 * @param $after The text to append to the activity time since figure.
     1054 * @uses bp_core_time_since() This function will return an English representation of the time elapsed.
     1055 */
     1056function bp_core_get_last_activity( $last_activity_date, $before, $after ) {
     1057        if ( !$last_activity_date || $last_activity_date == '' ) {
     1058                $last_active = __('not recently active');
     1059        } else {
     1060                $last_active = $before;
     1061               
     1062                if ( strstr( $last_activity_date, '-' ) ) {
     1063                        $last_active .= bp_core_time_since( strtotime( $last_activity_date ) );
     1064                } else {
     1065                        $last_active .= bp_core_time_since( $last_activity_date );
     1066                }
     1067               
     1068                $last_active .= $after;
     1069        }
     1070       
     1071        return $last_active;
     1072}
    10331073
    10341074/**
     
    11301170        return $new_nav;
    11311171}
     1172
     1173function bp_core_remove_data( $user_id ) {
     1174        /* When the user is deleted, we must automatically delete their home base blog */
     1175        if ( $home_base_id = bp_core_user_has_home($user_id) )
     1176                wpmu_delete_blog( $home_base_id, true );
     1177       
     1178        /* Remove usermeta */
     1179        delete_usermeta( $user_id, 'home_base' );
     1180        delete_usermeta( $user_id, 'last_activity' );
     1181}
     1182add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 );
     1183add_action( 'delete_user', 'bp_core_remove_data', 1 );
     1184
    11321185?>
  • trunk/bp-core/bp-core-adminbar.php

    r309 r373  
    66        if ( is_user_logged_in() && bp_core_user_has_home() ) {
    77                echo '<div id="wp-admin-bar">';
    8                 echo '<a href="' . get_blog_option( 1, 'siteurl' ) . '"><img id="admin-bar-logo" src="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-core/images/admin_bar_logo.gif" alt="BuddyPress" /></a>';
     8                echo '<a href="' . get_blog_option( 1, 'siteurl' ) . '"><img id="admin-bar-logo" src="' . site_url() . '/wp-content/mu-plugins/bp-core/images/admin_bar_logo.gif" alt="BuddyPress" /></a>';
    99                echo '<ul class="main-nav">';
    1010               
     
    3232                        echo '</li>';
    3333                }
    34                 echo '<li><a id="logout" href="' . get_option('siteurl') . '/wp-login.php?action=logout">' . __('Log Out') . '</a></li>';
     34                echo '<li><a id="logout" href="' . site_url() . '/wp-login.php?action=logout">' . __('Log Out') . '</a></li>';
    3535                echo '</ul>';
    3636                echo '</li>';
  • trunk/bp-core/bp-core-avatars.php

    r372 r373  
    1515define( 'CORE_AVATAR_V2_H', 150 );
    1616define( 'CORE_MAX_FILE_SIZE', get_site_option('fileupload_maxk') * 1024 );
    17 define( 'CORE_DEFAULT_AVATAR', get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/images/none.gif' );
    18 define( 'CORE_DEFAULT_AVATAR_THUMB', get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/images/none-thumbnail.gif' );
     17define( 'CORE_DEFAULT_AVATAR', site_url() . '/wp-content/mu-plugins/bp-xprofile/images/none.gif' );
     18define( 'CORE_DEFAULT_AVATAR_THUMB', site_url() . '/wp-content/mu-plugins/bp-xprofile/images/none-thumbnail.gif' );
    1919
    2020function bp_core_get_avatar( $user, $version = 1, $no_tag = false, $width = null, $height = null ) {
     
    9191                <?php
    9292                if ( !$action )
    93                         $action = get_option('siteurl') . '/wp-admin/admin.php?page=bp-xprofile.php';
     93                        $action = site_url() . '/wp-admin/admin.php?page=bp-xprofile.php';
    9494               
    9595                if ( !$delete_action )
    96                         $delete_action = get_option('siteurl') . '/wp-admin/admin.php?page=bp-xprofile.php&slick_avatars_action=delete';
     96                        $delete_action = site_url() . '/wp-admin/admin.php?page=bp-xprofile.php&slick_avatars_action=delete';
    9797               
    9898                bp_core_render_avatar_upload_form($action);
     
    242242
    243243function bp_core_resize_avatar($file, $size = CORE_CROPPING_CANVAS_MAX) {
    244         $canvas = wp_create_thumbnail( $file, $size);
    245        
    246         if ( bp_core_thumb_error($canvas) )
     244        $canvas = wp_create_thumbnail( $file, $size );
     245       
     246        if ( $canvas->errors )
    247247                return false;
    248248       
     
    302302                echo '</div>';
    303303               
    304                 echo '<div id="avatar_v2">';
     304                echo '<div id="avatar_v2" style="display: none">';
    305305                echo '<h3>' . __('Alternate Avatar') . '</h3>';
    306306                echo '<p>' . __('Please select the area of your photo you would like to use for an alternate version') . '(' . CORE_AVATAR_V2_W . 'px x ' . CORE_AVATAR_V2_H . 'px).</p>';
     
    471471}
    472472
    473 function bp_core_add_cropper_js() {
    474         echo '<script type="text/javascript" src="' . get_option('home') . '/wp-includes/js/prototype.js"></script>';
    475         echo '<script type="text/javascript" src="' . get_option('home') . '/wp-includes/js/scriptaculous/scriptaculous.js"></script>';
    476         echo '<script type="text/javascript" src="' . get_option('home') . '/wp-includes/js/scriptaculous/dragdrop.js"></script>';
    477         echo '<script type="text/javascript" src="' . get_option('home') . '/wp-includes/js/crop/cropper.js"></script>';               
    478473?>
    479         <style type="text/css">
    480                 #avatar_v2 { display: none; }
    481                 .crop-img { float: left; margin: 0 20px 15px 0; }
    482         </style>
    483 
    484         <script type="text/javascript">
    485         function cropAndContinue() {
    486                 jQuery('#avatar_v1').slideUp();
    487                 jQuery('#avatar_v2').slideDown('normal', function(){
    488                         v2Cropper();
    489                 });
    490         }
    491 
    492         function v1Cropper() {
    493                 v1Crop = new Cropper.ImgWithPreview(
    494                         'crop-v1-img',
    495                         {
    496                                 ratioDim: { x: <?php echo round(CORE_AVATAR_V1_W / CORE_AVATAR_V1_H, 5); ?>, y: 1 },
    497                                 minWidth:   <?php echo CORE_AVATAR_V1_W; ?>,
    498                                 minHeight:  <?php echo CORE_AVATAR_V1_H; ?>,
    499                                 prevWidth:  <?php echo CORE_AVATAR_V1_W; ?>,
    500                                 prevHeight: <?php echo CORE_AVATAR_V1_H; ?>,
    501                                 onEndCrop: onEndCropv1,
    502                                 previewWrap: 'crop-preview-v1'
    503                         }
    504                 );
    505         }
    506 
    507         function onEndCropv1(coords, dimensions) {
    508                 jQuery('#v1_x1').val(coords.x1);
    509                 jQuery('#v1_y1').val(coords.y1);
    510                 jQuery('#v1_x2').val(coords.x2);
    511                 jQuery('#v1_y2').val(coords.y2);
    512                 jQuery('#v1_w').val(dimensions.width);
    513                 jQuery('#v1_h').val(dimensions.height);
    514         }
    515 
    516         <?php if (CORE_AVATAR_V2_W !== false && CORE_AVATAR_V2_H !== false) { ?>
    517         function v2Cropper() {
    518                 v1Crop = new Cropper.ImgWithPreview(
    519                         'crop-v2-img',
    520                         {
    521                                 ratioDim: { x: <?php echo round(CORE_AVATAR_V2_W / CORE_AVATAR_V2_H, 5); ?>, y: 1 },
    522                                 minWidth:   <?php echo CORE_AVATAR_V2_W; ?>,
    523                                 minHeight:  <?php echo CORE_AVATAR_V2_H; ?>,
    524                                 prevWidth:  <?php echo CORE_AVATAR_V2_W; ?>,
    525                                 prevHeight: <?php echo CORE_AVATAR_V2_H; ?>,
    526                                 onEndCrop: onEndCropv2,
    527                                 previewWrap: 'crop-preview-v2'
    528                         }
    529                 );
    530         }
    531         <?php } ?>
    532 
    533         function onEndCropv2(coords, dimensions) {
    534                 jQuery('#v2_x1').val(coords.x1);
    535                 jQuery('#v2_y1').val(coords.y1);
    536                 jQuery('#v2_x2').val(coords.x2);
    537                 jQuery('#v2_y2').val(coords.y2);
    538                 jQuery('#v2_w').val(dimensions.width);
    539                 jQuery('#v2_h').val(dimensions.height);
    540         }
    541         </script>
    542         <?php
    543 }
    544 
    545 ?>
  • trunk/bp-core/bp-core-classes.php

    r309 r373  
    6161                $this->fullname = bp_core_get_userlink( $this->id, true );
    6262                $this->email = bp_core_get_user_email( $this->id );
     63                $this->last_active = bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __('active '), __(' ago') );
    6364               
    64                 $last_activity = get_usermeta( $this->id, 'last_activity' );
    65 
    66                 if ( !$last_activity || $last_activity == '' ) {
    67                         $this->last_active = __('not recently active');
    68                 } else {
    69                         $this->last_active = __('active ');
    70                        
    71                         if ( strstr( $last_activity, '-' ) ) {
    72                                 $this->last_active .= bp_core_time_since( strtotime( get_usermeta( $this->id, 'last_activity' ) ) );
    73                         } else {
    74                                 $this->last_active .= bp_core_time_since( get_usermeta( $this->id, 'last_activity' ) );
    75                         }
    76                        
    77                         $this->last_active .= __(' ago');
    78                 }
    79 
    80                 if ( BP_XPROFILE_IS_INSTALLED ) {
     65                if ( function_exists('xprofile_install') ) {
    8166                        $this->avatar = bp_core_get_avatar( $this->id, 2 );
    8267                        $this->avatar_thumb = bp_core_get_avatar( $this->id, 1 );
     
    8671                }
    8772               
    88                 if ( BP_STATUSES_IS_INSTALLED ) {
     73                if ( function_exists('bp_statuses_install') ) {
    8974                        $this->status = null; // TODO: Fetch status updates.
    9075                        $this->status_last_updated = null;
    9176                }
    9277        }
     78       
     79        /* Static Functions */
     80       
     81        function get_newest_users( $limit = 5 ) {
     82                global $wpdb;
     83               
     84                if ( !$limit )
     85                        $limit = 5;
     86                       
     87                return $wpdb->get_results( $wpdb->prepare( "SELECT ID as user_id, user_registered FROM {$wpdb->base_prefix}users WHERE spam = 0 AND deleted = 0 AND user_status = 0 ORDER BY user_registered DESC LIMIT %d", $limit ) );
     88        }
     89       
     90        function get_active_users( $limit = 5 ) {
     91                global $wpdb;
     92               
     93                if ( !$limit )
     94                        $limit = 5;
     95                       
     96                return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$wpdb->base_prefix}usermeta um WHERE meta_key = 'last_activity' ORDER BY meta_value ASC LIMIT %d", $limit ) );
     97        }
     98
     99        function get_popular_users( $limit = 5 ) {
     100                global $wpdb;
     101                               
     102                if ( !function_exists('friends_install') )
     103                        return false;
     104               
     105                if ( !$limit )
     106                        $limit = 5;
     107
     108                return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$wpdb->base_prefix}usermeta um WHERE meta_key = 'total_friend_count' ORDER BY meta_value DESC LIMIT %d", $limit ) );
     109               
     110        }
     111
    93112}
    94113
  • trunk/bp-core/bp-core-cssjs.php

    r309 r373  
    1010 */
    1111function bp_core_add_js() {
    12         echo '<script type="text/javascript">var ajaxurl = "' . get_option('siteurl') . '/wp-admin/admin-ajax.php";</script>';
    13         echo "<script type='text/javascript' src='" . get_option('siteurl') . "/wp-includes/js/jquery/jquery.js?ver=1.2.3'></script>";
    14         echo "
    15                 <script type='text/javascript' src='" . get_option('siteurl') . "/wp-content/mu-plugins/bp-core/js/jquery/jquery.livequery.pack.js'></script>";
     12        wp_enqueue_script( 'jquery' );
     13        wp_enqueue_script( 'jquery-livequery-pack', site_url() . "/wp-content/mu-plugins/bp-core/js/jquery/jquery.livequery.pack.js", 'jquery' );
     14        wp_enqueue_script( 'bp-general-js', site_url() . '/wp-content/mu-plugins/bp-core/js/general.js' );
     15}
     16add_action( 'template_redirect', 'bp_core_add_js' );
    1617
    17         echo '<script src="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-core/js/general.js" type="text/javascript"></script>';
     18/**
     19 * bp_core_add_ajax_js()
     20 *
     21 * Add the reference to ajaxurl used by all ajax functionality in BuddyPress.
     22 *
     23 * @package BuddyPress Core
     24 * @uses get_option() Selects a site setting from the DB.
     25 */
     26function bp_core_add_ajax_js() {
     27        echo '<script type="text/javascript">var ajaxurl = "' . site_url() . '/wp-admin/admin-ajax.php";</script>';
    1828}
    19 add_action( 'wp_head', 'bp_core_add_js' );
     29add_action( 'wp_head', 'bp_core_add_ajax_js' );
    2030
    2131/**
     
    2838 */
    2939function bp_core_add_css() {
    30         if ( bp_core_user_has_home() && is_user_logged_in() )
    31                 echo '<link rel="stylesheet" href="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-core/css/admin-bar.css" type="text/css" />';
     40        if ( is_user_logged_in() ) {
     41                wp_enqueue_style( 'bp-admin-bar', site_url() . '/wp-content/mu-plugins/bp-core/css/admin-bar.css' );
     42                wp_print_styles();
     43        }
    3244}
    3345add_action( 'wp_head', 'bp_core_add_css' );
    3446
     47
     48/**
     49 * bp_core_add_admin_js()
     50 *
     51 * Add the JS needed for all components in the admin area.
     52 *
     53 * @package BuddyPress Core
     54 * @uses get_option() Selects a site setting from the DB.
     55 */
    3556function bp_core_add_admin_js() {
    3657        if ( strpos( $_GET['page'], 'bp-core' ) !== false ) {
    37                 wp_enqueue_script( 'bp-account-admin-js', get_option('siteurl') . '/wp-content/mu-plugins/bp-core/js/account-admin.js' );
     58                wp_enqueue_script( 'bp-account-admin-js', site_url() . '/wp-content/mu-plugins/bp-core/js/account-admin.js' );
    3859        }
    39 }
    40 add_action( 'admin_menu', 'bp_core_add_admin_js' );
    41 
    42 function bp_core_enqueue_admin_js() {
     60       
    4361        if ( strpos( $_GET['page'], 'bp-core/admin-mods' ) !== false ) {
    4462                wp_enqueue_script('password-strength-meter');
     
    4664
    4765        if ( strpos( $_GET['page'], 'bp-core/homebase-creation' ) !== false ) {
     66                wp_enqueue_script('prototype');
     67                wp_enqueue_script('scriptaculous-root');
     68                wp_enqueue_script('cropper');
    4869                add_action( 'admin_head', 'bp_core_add_cropper_js' );
    4970        }
    5071}
    51 add_action( 'admin_menu', 'bp_core_enqueue_admin_js' );
     72add_action( 'admin_menu', 'bp_core_add_admin_js' );
    5273
    53 function bp_core_enqueue_admin_css() {
     74
     75/**
     76 * bp_core_add_admin_css()
     77 *
     78 * Add the CSS needed for all components in the admin area.
     79 *
     80 * @package BuddyPress Core
     81 * @uses get_option() Selects a site setting from the DB.
     82 */
     83function bp_core_add_admin_css() {
    5484        if ( strpos( $_GET['page'], 'bp-core/homebase-creation' ) !== false ) {
    55                 wp_enqueue_style( 'bp-core-home-base-css', get_option('siteurl') . '/wp-content/mu-plugins/bp-core/css/home-base.css' );
     85                wp_enqueue_style( 'bp-core-home-base-css', site_url() . '/wp-content/mu-plugins/bp-core/css/home-base.css' );
    5686        }
    5787}
    58 add_action( 'admin_menu', 'bp_core_enqueue_admin_css' );
     88add_action( 'admin_menu', 'bp_core_add_admin_css' );
     89
     90
     91/**
     92 * bp_core_add_cropper_js()
     93 *
     94 * Adds the JS needed for general avatar cropping.
     95 *
     96 * @package BuddyPress Core
     97 */
     98function bp_core_add_cropper_js() {
     99?>
     100        <script type="text/javascript">
     101                function cropAndContinue() {
     102                        jQuery('#avatar_v1').slideUp();
     103                        jQuery('#avatar_v2').slideDown('normal', function(){
     104                                v2Cropper();
     105                        });
     106                }
     107
     108                function v1Cropper() {
     109                        v1Crop = new Cropper.ImgWithPreview(
     110                                'crop-v1-img',
     111                                {
     112                                        ratioDim: { x: <?php echo round(CORE_AVATAR_V1_W / CORE_AVATAR_V1_H, 5); ?>, y: 1 },
     113                                        minWidth:   <?php echo CORE_AVATAR_V1_W; ?>,
     114                                        minHeight:  <?php echo CORE_AVATAR_V1_H; ?>,
     115                                        prevWidth:  <?php echo CORE_AVATAR_V1_W; ?>,
     116                                        prevHeight: <?php echo CORE_AVATAR_V1_H; ?>,
     117                                        onEndCrop: onEndCropv1,
     118                                        previewWrap: 'crop-preview-v1'
     119                                }
     120                        );
     121                }
     122
     123                function onEndCropv1(coords, dimensions) {
     124                        jQuery('#v1_x1').val(coords.x1);
     125                        jQuery('#v1_y1').val(coords.y1);
     126                        jQuery('#v1_x2').val(coords.x2);
     127                        jQuery('#v1_y2').val(coords.y2);
     128                        jQuery('#v1_w').val(dimensions.width);
     129                        jQuery('#v1_h').val(dimensions.height);
     130                }
     131
     132                <?php if (CORE_AVATAR_V2_W !== false && CORE_AVATAR_V2_H !== false) { ?>
     133                function v2Cropper() {
     134                        v1Crop = new Cropper.ImgWithPreview(
     135                                'crop-v2-img',
     136                                {
     137                                        ratioDim: { x: <?php echo round(CORE_AVATAR_V2_W / CORE_AVATAR_V2_H, 5); ?>, y: 1 },
     138                                        minWidth:   <?php echo CORE_AVATAR_V2_W; ?>,
     139                                        minHeight:  <?php echo CORE_AVATAR_V2_H; ?>,
     140                                        prevWidth:  <?php echo CORE_AVATAR_V2_W; ?>,
     141                                        prevHeight: <?php echo CORE_AVATAR_V2_H; ?>,
     142                                        onEndCrop: onEndCropv2,
     143                                        previewWrap: 'crop-preview-v2'
     144                                }
     145                        );
     146                }
     147                <?php } ?>
     148
     149                function onEndCropv2(coords, dimensions) {
     150                        jQuery('#v2_x1').val(coords.x1);
     151                        jQuery('#v2_y1').val(coords.y1);
     152                        jQuery('#v2_x2').val(coords.x2);
     153                        jQuery('#v2_y2').val(coords.y2);
     154                        jQuery('#v2_w').val(dimensions.width);
     155                        jQuery('#v2_h').val(dimensions.height);
     156                }
     157        </script>
     158<?php
     159}
  • trunk/bp-friends.php

    r359 r373  
    33
    44define ( 'BP_FRIENDS_IS_INSTALLED', 1 );
    5 define ( 'BP_FRIENDS_VERSION', '0.1.3' );
     5define ( 'BP_FRIENDS_VERSION', '0.1.4' );
    66
    77include_once( 'bp-friends/bp-friends-classes.php' );
    88include_once( 'bp-friends/bp-friends-ajax.php' );
    99include_once( 'bp-friends/bp-friends-cssjs.php' );
     10include_once( 'bp-friends/bp-friends-templatetags.php' );
     11include_once( 'bp-friends/bp-friends-widgets.php' );
    1012/*include_once( 'bp-messages/bp-friends-admin.php' );*/
    11 include_once( 'bp-friends/bp-friends-templatetags.php' );
    12 
    1313
    1414
     
    5353        $bp['friends'] = array(
    5454                'table_name' => $wpdb->base_prefix . 'bp_friends',
    55                 'image_base' => get_option('siteurl') . '/wp-content/mu-plugins/bp-friends/images',
     55                'image_base' => site_url() . '/wp-content/mu-plugins/bp-friends/images',
    5656                'format_activity_function' => 'friends_format_activity',
    5757                'slug'           => 'friends'
     
    373373       
    374374        if ( BP_Friends_Friendship::accept( $friendship_id ) ) {
     375                friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id );
     376               
    375377                do_action( 'bp_friends_friendship_accepted', array( 'item_id' => $friendship_id, 'component_name' => 'friends', 'component_action' => 'friendship_accepted', 'is_private' => 0, 'dual_record' => true, 'secondary_user_homebase_id' => $secondary_user_homebase_id ) );
    376378                return true;
     
    389391}
    390392
     393function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) {
     394        if ( $status == 'add' ) {
     395                update_usermeta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count' ) + 1 );
     396                update_usermeta( $friend_user_id, 'total_friend_count', (int)get_usermeta( $friend_user_id, 'total_friend_count' ) + 1 );
     397        } else {
     398                update_usermeta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count' ) - 1 );
     399                update_usermeta( $friend_user_id, 'total_friend_count', (int)get_usermeta( $friend_user_id, 'total_friend_count' ) - 1 );               
     400        }
     401}
     402
     403function friends_remove_data( $user_id ) {
     404        BP_Friends_Friendship::delete_all_for_user($user_id);
     405       
     406        /* Remove usermeta */
     407        delete_usermeta( $user_id, 'total_friend_count' );
     408}
     409add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 );
     410add_action( 'delete_user', 'bp_core_remove_data', 1 );
     411
    391412
    392413?>
  • trunk/bp-friends/bp-friends-ajax.php

    r348 r373  
    136136                        echo "-1[[SPLIT]]" . __("Friendship could not be canceled.");
    137137                } else {
     138                        friends_update_friend_totals( $bp['loggedin_userid'], $bp['current_userid'], 'remove' );
    138139                        echo __('Add Friend');
    139140                }
  • trunk/bp-friends/bp-friends-classes.php

    r359 r373  
    114114                if ( !$user_id )
    115115                        $user_id = $bp['current_userid'];
    116 
    117                 $sql = $wpdb->prepare( "SELECT count(id) FROM " . $bp['friends']['table_name'] . " WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id );
    118 
    119                 if ( !$friend_count = $wpdb->get_var( $sql ) )
    120                         return 0;
    121                
    122                 if ( !$friend_count )
    123                         return 0;
    124                        
     116                       
     117                if ( !$friend_count = get_usermeta( $user_id, 'total_friend_count') ) {
     118                        update_usermeta( $user_id, 'total_friend_count', 0 );
     119                       
     120                        $sql = $wpdb->prepare( "SELECT count(id) FROM " . $bp['friends']['table_name'] . " WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id );
     121
     122                        if ( !$friend_count = $wpdb->get_var( $sql ) )
     123                                return 0;
     124               
     125                        if ( !$friend_count )
     126                                return 0;
     127                       
     128                        update_usermeta( $user_id, 'total_friend_count', $friend_count );
     129                }
     130               
    125131                return $friend_count;
    126132        }
     
    275281                return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM " . $bp['friends']['table_name'] . " WHERE id = %d", $friendship_id ) );
    276282        }
     283       
     284        function delete_all_for_user( $user_id ) {
     285                global $wpdb, $bp;
     286               
     287                return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['friends']['table_name'] . " WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id ) );           
     288        }
    277289}
    278290       
  • trunk/bp-friends/bp-friends-cssjs.php

    r309 r373  
    88function friends_add_js() {
    99        global $bp;
    10        
    11         if ( !isset($_GET['page']) )
    12                 $_GET['page'] = null;
    1310
    14         if ( $bp['current_component'] == $bp['friends']['slug'] ) {
    15                 echo '
    16                         <script src="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-friends/js/general.js" type="text/javascript"></script>';
    17         }
     11        if ( $bp['current_component'] == $bp['friends']['slug'] )
     12                wp_enqueue_script( 'bp-friends-js', site_url() . '/wp-content/mu-plugins/bp-friends/js/general.js' );
    1813}
    19 add_action( 'wp_head', 'friends_add_js' );
     14add_action( 'template_redirect', 'friends_add_js' );
    2015
    2116?>
  • trunk/bp-groups.php

    r359 r373  
    33
    44define ( 'BP_GROUPS_IS_INSTALLED', 1 );
    5 define ( 'BP_GROUPS_VERSION', '0.1.5' );
     5define ( 'BP_GROUPS_VERSION', '0.1.6' );
    66
    77include_once( 'bp-groups/bp-groups-classes.php' );
    88include_once( 'bp-groups/bp-groups-ajax.php' );
    99include_once( 'bp-groups/bp-groups-cssjs.php' );
     10include_once( 'bp-groups/bp-groups-templatetags.php' );
     11include_once( 'bp-groups/bp-groups-widgets.php' );
    1012/*include_once( 'bp-messages/bp-groups-admin.php' );*/
    11 include_once( 'bp-groups/bp-groups-templatetags.php' );
    12 
    1313
    1414/**************************************************************************
     
    9292                'table_name' => $wpdb->base_prefix . 'bp_groups',
    9393                'table_name_members' => $wpdb->base_prefix . 'bp_groups_members',
    94                 'image_base' => get_option('siteurl') . '/wp-content/mu-plugins/bp-groups/images',
     94                'image_base' => site_url() . '/wp-content/mu-plugins/bp-groups/images',
    9595                'format_activity_function' => 'groups_format_activity',
    9696                'slug'           => 'groups'
     
    552552        $avatar_error = false;
    553553
    554         if ( bp_core_check_avatar_upload($file) ) {
    555                 if ( !bp_core_check_avatar_upload($file) ) {
    556                         $avatar_error = true;
    557                         $avatar_error_msg = __('Your group avatar upload failed, please try again.');
    558                 }
    559 
    560                 if ( !bp_core_check_avatar_size($file) ) {
    561                         $avatar_error = true;
    562                         $avatar_size = size_format(1024 * CORE_MAX_FILE_SIZE);
    563                         $avatar_error_msg = sprintf( __('The file you uploaded is too big. Please upload a file under %d'), $avatar_size);
    564                 }
    565 
    566                 if ( !bp_core_check_avatar_type($file) ) {
    567                         $avatar_error = true;
    568                         $avatar_error_msg = __('Please upload only JPG, GIF or PNG photos.');           
    569                 }
    570 
    571                 // "Handle" upload into temporary location
    572                 if ( !$original = bp_core_handle_avatar_upload($file) ) {
    573                         $avatar_error = true;
    574                         $avatar_error_msg = __('Upload Failed! Your photo dimensions are likely too big.');                                             
    575                 }
    576 
    577                 if ( !bp_core_check_avatar_dimensions($original) ) {
    578                         $avatar_error = true;
    579                         $avatar_error_msg = sprintf( __('The image you upload must have dimensions of %d x %d pixels or larger.'), CORE_CROPPING_CANVAS_MAX, CORE_CROPPING_CANVAS_MAX );
    580                 }
    581                
    582                 if ( !$canvas = bp_core_resize_avatar($original) ) {
    583                         $avatar_error = true;
    584                         $avatar_error_msg = __('Could not create thumbnail, try another photo.');
    585                 }
    586                
    587                 if ( $avatar_error ) { ?>
    588                         <div id="message" class="error">
    589                                 <p><?php echo $avatar_error_msg ?></p>
    590                         </div>
    591                         <?php
    592                         bp_core_render_avatar_upload_form( '', true );
    593                 } else {
    594                         bp_core_render_avatar_cropper( $original, $canvas, null, null, false, $bp['loggedin_domain'] );
    595                 }
     554        // Set friendly error feedback.
     555        $uploadErrors = array(
     556                0 => __("There is no error, the file uploaded with success"),
     557                1 => __("The uploaded file exceeds the upload_max_filesize directive in php.ini"),
     558                2 => __("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"),
     559                3 => __("The uploaded file was only partially uploaded"),
     560                4 => __("No file was uploaded"),
     561                6 => __("Missing a temporary folder")
     562        );
     563
     564        if ( !bp_core_check_avatar_upload($file) ) {
     565                $avatar_error = true;
     566                $avatar_error_msg = __('Your group avatar upload failed, please try again. Error was: ' . $uploadErrors[$file['file']['error']] );
     567        }
     568
     569        else if ( !bp_core_check_avatar_size($file) ) {
     570                $avatar_error = true;
     571                $avatar_size = size_format(1024 * CORE_MAX_FILE_SIZE);
     572                $avatar_error_msg = __('The file you uploaded is too big. Please upload a file under') . size_format(1024 * CORE_MAX_FILE_SIZE);
     573        }
     574       
     575        else if ( !bp_core_check_avatar_type($file) ) {
     576                $avatar_error = true;
     577                $avatar_error_msg = __('Please upload only JPG, GIF or PNG photos.');           
     578        }
     579
     580        // "Handle" upload into temporary location
     581        else if ( !$original = bp_core_handle_avatar_upload($file) ) {
     582                $avatar_error = true;
     583                $avatar_error_msg = __('Upload Failed! Your photo dimensions are likely too big.');                                             
     584        }
     585
     586        else if ( !bp_core_check_avatar_dimensions($original) ) {
     587                $avatar_error = true;
     588                $avatar_error_msg = sprintf( __('The image you upload must have dimensions of %d x %d pixels or larger.'), CORE_CROPPING_CANVAS_MAX, CORE_CROPPING_CANVAS_MAX );
     589        }
     590       
     591        if ( !$canvas = bp_core_resize_avatar($original) )
     592                $canvas = $original;
     593       
     594        if ( $avatar_error ) { ?>
     595                <div id="message" class="error">
     596                        <p><?php echo $avatar_error_msg ?></p>
     597                </div>
     598                <?php
     599                bp_core_render_avatar_upload_form( '', true );
     600        } else {
     601                bp_core_render_avatar_cropper( $original, $canvas, null, null, false, $bp['loggedin_domain'] );
    596602        }
    597603}
     
    623629
    624630function groups_manage_group( $step, $group_id ) {
    625         global $bp;
     631        global $bp, $create_group_step;
    626632       
    627633        if ( is_numeric( $step ) && ( $step == '1' || $step == '2' || $step == '3' || $step == '4' ) ) {
    628                 // If this is the group avatar step, load in the JS.
    629                 if ( $create_group_step == '3' )
    630                         add_action( 'wp_head', 'bp_core_add_cropper_js' );
    631                
    632634                $group = new BP_Groups_Group( $group_id );             
    633635               
    634636                switch ( $step ) {
    635637                        case '1':
    636                                 if ( isset($_POST['group-name']) && isset($_POST['group-desc']) ) {
     638                                if ( $_POST['group-name'] != '' && $_POST['group-desc'] != '' && $_POST['group-news'] != '' ) {
    637639                                        $group->creator_id = $bp['loggedin_userid'];
    638640                                        $group->name = stripslashes($_POST['group-name']);
     
    667669                                        return $group->id;
    668670                                }
     671                               
     672                                return false;
    669673                        break;
    670674                       
     
    703707                       
    704708                        case '3':
     709                                                               
    705710                                // Image already cropped and uploaded, lets store a reference in the DB.
    706711                                if ( !wp_verify_nonce($_POST['nonce'], 'slick_avatars') || !$result = bp_core_avatar_cropstore( $_POST['orig'], $_POST['canvas'], $_POST['v1_x1'], $_POST['v1_y1'], $_POST['v1_w'], $_POST['v1_h'], $_POST['v2_x1'], $_POST['v2_y1'], $_POST['v2_w'], $_POST['v2_h'], false, 'groupavatar', $group_id ) )
     
    869874}
    870875
     876function groups_remove_data( $user_id ) {
     877        BP_Groups_Member::delete_all_for_user($user_id);
     878}
     879add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 );
     880add_action( 'delete_user', 'bp_core_remove_data', 1 );
     881
    871882
    872883?>
  • trunk/bp-groups/bp-groups-classes.php

    r351 r373  
    215215        /* Static Functions */
    216216       
     217        function delete( $group_id ) {
     218                global $wpdb, $bp;
     219               
     220                if ( $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name'] . " WHERE id = %d", $group_id ) ) )
     221                        return false;
     222               
     223                return true;
     224        }
     225       
    217226        function group_exists( $slug ) {
    218227                global $wpdb, $bp;
     
    298307        }
    299308       
    300         function delete( $group_id ) {
    301                 global $wpdb, $bp;
    302                
    303                 if ( $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name'] . " WHERE id = %d", $group_id ) ) )
    304                         return false;
    305                
    306                 return true;
    307         }       
     309        function get_newest( $limit = 5 ) {
     310                global $wpdb, $bp;
     311               
     312                if ( !$limit )
     313                        $limit = 5;
     314
     315                return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name'] . " ORDER BY date_created DESC LIMIT %d", $limit ) );
     316        }
    308317}
    309318
     
    442451                return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND is_confirmed = 1 ORDER BY rand() LIMIT $total_groups", $user_id ) );
    443452        }
     453       
     454        function delete_all_for_user( $user_id ) {
     455                global $wpdb, $bp;
     456               
     457                return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d", $user_id ) );               
     458        }
    444459}
    445460
  • trunk/bp-groups/bp-groups-cssjs.php

    r309 r373  
    88function groups_add_js() {
    99        global $bp;
     10
     11        if ( $bp['current_component'] == $bp['groups']['slug'] )
     12                wp_enqueue_script( 'bp-groups-js', site_url() . '/wp-content/mu-plugins/bp-groups/js/general.js' );
     13}
     14add_action( 'template_redirect', 'groups_add_js' );
     15
     16function groups_add_cropper_js() {
     17        global $create_group_step;
    1018       
    11         if ( !isset($_GET['page']) )
    12                 $_GET['page'] = null;
    13 
    14         if ( strpos( $_GET['page'], 'groups' ) !== false || $bp['current_component'] == $bp['groups']['slug'] ) {
    15                 echo '
    16                         <script src="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-groups/js/general.js" type="text/javascript"></script>';
     19        if ( $create_group_step == '3' ) {
     20                wp_enqueue_script('jquery');
     21                wp_enqueue_script('prototype');
     22                wp_enqueue_script('scriptaculous-root');
     23                wp_enqueue_script('cropper');
     24                add_action( 'wp_head', 'bp_core_add_cropper_js' );
    1725        }
    1826}
    19 add_action( 'wp_head', 'groups_add_js' );
    20 add_action( 'admin_head', 'groups_add_js' );
     27add_action( 'template_redirect', 'groups_add_cropper_js' );
    2128
    22 /**************************************************************************
    23  add_css()
    24  
    25  Inserts the CSS needed to style the groups pages.
    26  **************************************************************************/   
    27 
    28 function groups_add_css()
    29 {
    30         ?>
    31        
    32         <?php
    33 }
    3429
    3530?>
  • trunk/bp-groups/bp-groups-templatetags.php

    r367 r373  
    350350                case '1': ?>
    351351                        <label for="group-name">* <?php _e('Group Name') ?></label>
    352                         <input type="text" name="group-name" id="group-name" value="<?php echo $group_obj->name ?>" />
     352                        <input type="text" name="group-name" id="group-name" value="<?php echo ( $group_obj ) ? $group_obj->name : $_POST['group-name']; ?>" />
    353353               
    354354                        <label for="group-desc">* <?php _e('Group Description') ?></label>
    355                         <textarea name="group-desc" id="group-desc"><?php echo $group_obj->description ?></textarea>
     355                        <textarea name="group-desc" id="group-desc"><?php echo ( $group_obj ) ? $group_obj->description : $_POST['group-desc']; ?></textarea>
    356356               
    357357                        <label for="group-news">* <?php _e('Recent News') ?></label>
    358                         <textarea name="group-news" id="group-news"><?php echo $group_obj->news ?></textarea>
     358                        <textarea name="group-news" id="group-news"><?php echo ( $group_obj ) ? $group_obj->news : $_POST['group-news']; ?></textarea>
    359359                       
    360360                        <input type="submit" value="<?php _e('Save and Continue') ?> &raquo;" id="save" name="save" />
  • trunk/bp-messages.php

    r359 r373  
    33
    44define ( 'BP_MESSAGES_IS_INSTALLED', 1 );
    5 define ( 'BP_MESSAGES_VERSION', '0.3.4' );
     5define ( 'BP_MESSAGES_VERSION', '0.3.5' );
    66
    77include_once( 'bp-messages/bp-messages-classes.php' );
     
    100100                'table_name_notices'       => $wpdb->base_prefix . 'bp_messages_notices',
    101101                'format_activity_function' => 'messages_format_activity',
    102                 'image_base'                       => get_option('siteurl') . '/wp-content/mu-plugins/bp-messages/images',
     102                'image_base'                       => site_url() . '/wp-content/mu-plugins/bp-messages/images',
    103103                'slug'                                     => 'messages'
    104104        );
  • trunk/bp-messages/bp-messages-cssjs.php

    r309 r373  
    11<?php
    22
    3 function messages_add_js() {
     3function messages_add_tinymce() {
    44        global $bp;
    55       
    66        if ( ( $bp['current_component'] == $bp['messages']['slug'] && $bp['current_action'] == 'compose' ) || ( $bp['current_component'] == $bp['messages']['slug'] && $bp['current_action'] == 'view' ) ) {
    77                echo '
    8                         <script type="text/javascript" src="' . get_option('siteurl') . '/wp-includes/js/tinymce/tiny_mce.js"></script>
     8                        <script type="text/javascript" src="' . site_url() . '/wp-includes/js/tinymce/tiny_mce.js"></script>
    99                                <script type="text/javascript">
    1010                                        <!--
     
    1919                                        theme_advanced_resize_horizontal : false,
    2020                                        theme_advanced_buttons1:"bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,image,wp_more,|,fullscreen,wp_adv",theme_advanced_buttons2:"formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,media,charmap,|,outdent,indent,|,undo,redo,wp_help",theme_advanced_buttons3:"",
    21                                         content_css : "' . get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css",
     21                                        content_css : "' . site_url() . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css",
    2222                                        mode : "exact",
    2323                                        elements : "message_content",
     
    3030        }
    3131       
    32         if ( strpos( $_GET['page'], 'messages' ) !== false || $bp['current_component'] == $bp['messages']['slug'] ) {
    33                 echo '
    34                         <script src="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-messages/js/general.js" type="text/javascript"></script>';
    35         }
    3632}
    37 add_action( 'wp_head', 'messages_add_js' );
    38 //add_action( 'admin_menu', 'messages_add_js' );
     33add_action( 'wp_head', 'messages_add_tinymce' );
     34
     35function messages_add_js() {
     36        global $bp;
     37       
     38        if ( $bp['current_component'] == $bp['messages']['slug'] )
     39                wp_enqueue_script( 'bp-messages-js', site_url() . '/wp-content/mu-plugins/bp-messages/js/general.js' );
     40}
     41add_action( 'template_redirect', 'messages_add_js' );
    3942
    4043?>
  • trunk/bp-wire.php

    r359 r373  
    33
    44define ( 'BP_WIRE_IS_INSTALLED', 1 );
    5 define ( 'BP_WIRE_VERSION', '0.1' );
     5define ( 'BP_WIRE_VERSION', '0.1.1' );
    66
    77include_once( 'bp-wire/bp-wire-classes.php' );
     
    4242       
    4343        $bp['wire'] = array(
    44                 'image_base' => get_option('siteurl') . '/wp-content/mu-plugins/bp-wire/images',
     44                'image_base' => site_url() . '/wp-content/mu-plugins/bp-wire/images',
    4545                'slug'           => 'wire'
    4646        );
  • trunk/bp-xprofile.php

    r364 r373  
    44
    55define ( 'BP_XPROFILE_IS_INSTALLED', 1 );
    6 define ( 'BP_XPROFILE_VERSION', '0.3.9' );
     6define ( 'BP_XPROFILE_VERSION', '0.3.10' );
    77
    88require_once( 'bp-xprofile/bp-xprofile-classes.php' );
     
    114114                'table_name_data'       => $wpdb->base_prefix . 'bp_xprofile_data',
    115115                'format_activity_function' => 'xprofile_format_activity',
    116                 'image_base'            => get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/images',
     116                'image_base'            => site_url() . '/wp-content/mu-plugins/bp-xprofile/images',
    117117                'slug'                          => 'profile'
    118118        );
  • trunk/bp-xprofile/bp-xprofile-cssjs.php

    r309 r373  
    33function xprofile_add_signup_css() {
    44        if ( $_SERVER['SCRIPT_NAME'] == '/wp-signup.php' )
    5                 echo '<link rel="stylesheet" href="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/css/signup.css" type="text/css" />';
     5                echo '<link rel="stylesheet" href="' . site_url() . '/wp-content/mu-plugins/bp-xprofile/css/signup.css" type="text/css" />';
    66}
    77add_action( 'wp_head', 'xprofile_add_signup_css' );
     
    1010function xprofile_add_admin_css() {
    1111        if ( strpos( $_GET['page'], 'xprofile' ) !== false ) {
    12                 echo '<link rel="stylesheet" href="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/css/admin.css" type="text/css" />';
     12                echo '<link rel="stylesheet" href="' . site_url() . '/wp-content/mu-plugins/bp-xprofile/css/admin.css" type="text/css" />';
    1313        }
    1414}
     
    1818function xprofile_add_admin_js() {
    1919        if ( strpos( $_GET['page'], 'xprofile' ) !== false ) {
    20                 wp_enqueue_script( 'bp-xprofile-admin-js', get_option('siteurl') . "/wp-content/mu-plugins/bp-xprofile/js/admin.js" );
     20                wp_enqueue_script( 'bp-xprofile-admin-js', site_url() . "/wp-content/mu-plugins/bp-xprofile/js/admin.js" );
    2121                add_action( 'admin_head', 'bp_core_add_cropper_js' );
    2222        }
     
    2424add_action( 'admin_menu', 'xprofile_add_admin_js' );
    2525
     26function xprofile_add_cropper_js() {
     27        global $bp;
     28
     29        if ( $_SERVER['SCRIPT_NAME'] == '/wp-activate.php' || $bp['current_action'] == 'change-avatar' || ( isset($_GET['page']) && $_GET['page'] == 'bp-xprofile.php' ) ) {
     30                wp_enqueue_script('jquery');
     31                wp_enqueue_script('prototype');
     32                wp_enqueue_script('scriptaculous-root');
     33                wp_enqueue_script('cropper');
     34                add_action( 'wp_head', 'bp_core_add_cropper_js' );
     35        }
     36       
     37        if ( isset($_GET['page']) && $_GET['page'] == 'bp-xprofile.php' ) {
     38                add_action( 'admin_head', 'bp_core_add_cropper_js' );
     39        }
     40}
     41add_action( 'activate_header', 'xprofile_add_cropper_js' );
     42add_action( 'template_redirect', 'xprofile_add_cropper_js' );
     43add_action( 'admin_menu', 'xprofile_add_cropper_js' );
     44
    2645?>
  • trunk/bp-xprofile/bp-xprofile-signup.php

    r363 r373  
    339339                /* Make this blog the "home base" for the new user */
    340340                update_usermeta( $user_id, 'home_base', $blog_id );
     341                update_usermeta( $user_id, 'last_activity', time() );
    341342               
    342343                /* Set the BuddyPress theme as the theme for this blog */
     
    419420}
    420421
    421 
    422 function xprofile_add_jquery() {
    423         if ( $_SERVER['SCRIPT_NAME'] == '/wp-activate.php' ) {
    424                 echo '<script type="text/javascript" src="' . get_option('home') . '/wp-includes/js/prototype.js"></script>';
    425                 echo '<script type="text/javascript" src="' . get_option('home') . '/wp-includes/js/scriptaculous/scriptaculous.js"></script>';
    426                 echo '<script type="text/javascript" src="' . get_option('home') . '/wp-includes/js/scriptaculous/dragdrop.js"></script>';
    427                 echo '<script type="text/javascript" src="' . get_option('home') . '/wp-includes/js/crop/cropper.js"></script>';
    428                 echo '<script type="text/javascript" src="' . get_option('home') . '/wp-includes/js/jquery/jquery.js"></script>';
    429         }
    430        
    431         bp_core_add_cropper_js();
    432 }
    433 add_action( 'wp_head', 'xprofile_add_jquery' );
    434422
    435423// function xprofile_replace_blog_references() {
  • trunk/buddypress-theme/home/comments-popup.php

    r262 r373  
    5656<p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p>
    5757
    58 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
     58<form action="<?php echo site_url(); ?>/wp-comments-post.php" method="post" id="commentform">
    5959<?php if ( $user_ID ) : ?>
    60         <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
     60        <p>Logged in as <a href="<?php echo site_url(); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo site_url(); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
    6161<?php else : ?>
    6262        <p>
  • trunk/buddypress-theme/home/comments.php

    r262 r373  
    6767
    6868<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    69 <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p>
     69<p>You must be <a href="<?php echo site_url(); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p>
    7070<?php else : ?>
    7171
    72 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
     72<form action="<?php echo site_url(); ?>/wp-comments-post.php" method="post" id="commentform">
    7373
    7474<?php if ( $user_ID ) : ?>
    7575
    76 <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
     76<p>Logged in as <a href="<?php echo site_url(); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo site_url(); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
    7777
    7878<?php else : ?>
Note: See TracChangeset for help on using the changeset viewer.