Changeset 375
- Timestamp:
- 10/09/2008 04:37:49 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r373 r375 3 3 4 4 define ( 'BP_ACTIVITY_IS_INSTALLED', 1 ); 5 define ( 'BP_ACTIVITY_VERSION', '0.1. 8' );6 7 /* Use english formatted times - e.g. 6 hours / 8 hours / 1 day / 15 minutes*/8 define ( 'BP_ACTIVITY_CACHE_LENGTH', '6 hours' );5 define ( 'BP_ACTIVITY_VERSION', '0.1.9' ); 6 7 /* How long before activity items in streams are re-cached? */ 8 define ( 'BP_ACTIVITY_CACHE_LENGTH', '6 HOURS' ); 9 9 10 10 include_once( 'bp-activity/bp-activity-classes.php' ); 11 include_once( 'bp-activity/bp-activity-templatetags.php' ); 12 include_once( 'bp-activity/bp-activity-widgets.php' ); 11 13 //include_once( 'bp-activity/bp-activity-ajax.php' ); 12 14 //include_once( 'bp-activity/bp-activity-cssjs.php' ); 13 /*include_once( 'bp-messages/bp-activity-admin.php' );*/ 14 include_once( 'bp-activity/bp-activity-templatetags.php' ); 15 15 //include_once( 'bp-activity/bp-activity-admin.php' ); 16 16 17 17 /************************************************************************** … … 64 64 KEY component_name (component_name) 65 65 );"; 66 67 $sql[] = "CREATE TABLE ". $bp['activity']['table_name_sitewide'] ." ( 68 id int(11) NOT NULL AUTO_INCREMENT, 69 user_id int(11) NOT NULL, 70 content longtext NOT NULL, 71 component_name varchar(75) NOT NULL, 72 date_cached datetime NOT NULL, 73 date_recorded datetime NOT NULL, 74 PRIMARY KEY id (id), 75 KEY date_cached (date_cached), 76 KEY date_recorded (date_recorded), 77 KEY user_id (user_id), 78 KEY component_name (component_name) 79 );"; 66 80 67 81 require_once(ABSPATH . 'wp-admin/upgrade-functions.php'); … … 89 103 90 104 'table_name_loggedin_user_friends_cached' => $wpdb->base_prefix . $bp['loggedin_homebase_id'] . '_friends_activity_cached', 105 'table_name_sitewide' => $wpdb->base_prefix . 'bp_activity_sitewide', 91 106 92 107 'image_base' => site_url() . '/wp-content/mu-plugins/bp-activity/images', -
trunk/bp-activity/bp-activity-classes.php
r364 r375 67 67 $activity_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $this->table_name_cached . " ( content, component_name, date_cached, date_recorded, is_private ) VALUES ( %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), %d )", $activity_content, $this->component_name, time(), $this->date_recorded, $this->is_private ) ); 68 68 69 // Add the cached version of the activity to the cached activity table. 70 $sitewide_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_sitewide'] . " ( user_id, content, component_name, date_cached, date_recorded ) VALUES ( %d, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d) )", $bp['loggedin_userid'], $activity_content, $this->component_name, time(), $this->date_recorded ) ); 71 69 72 if ( $activity && $activity_cached ) 70 73 return true; … … 104 107 $last_cached = get_usermeta( $bp['current_userid'], 'bp_activity_last_cached' ); 105 108 106 if ( strtotime( BP_ACTIVITY_CACHE_LENGTH, (int)$last_cached ) >= time() ) {109 if ( strtotime( BP_ACTIVITY_CACHE_LENGTH, (int)$last_cached ) <= time() ) { 107 110 108 111 //echo '<small style="color: green">** Debug: Using Cache **</small>'; … … 140 143 unset($activities_formatted[$i]); 141 144 } 142 145 143 146 if ( count($activities_formatted) ) 144 BP_Activity_Activity::cache_activities( $activities_formatted );147 BP_Activity_Activity::cache_activities( $activities_formatted, $user_id ); 145 148 } 146 149 … … 209 212 } 210 213 214 function get_sitewide_activity( $limit = 15 ) { 215 global $wpdb, $bp; 216 217 if ( $limit ) 218 $limit_sql = $wpdb->prepare( " LIMIT %d", $limit ); 219 220 /* Remove entries that are older than 1 week */ 221 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . " WHERE DATE_ADD(date_recorded, INTERVAL 1 WEEK) <= NOW()" ) ); 222 223 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['activity']['table_name_sitewide'] . " ORDER BY date_recorded DESC $limit_sql" ) ); 224 225 for ( $i = 0; $i < count( $activities ); $i++ ) { 226 $activities_formatted[$i]['content'] = $activities[$i]->content; 227 $activities_formatted[$i]['date_recorded'] = $activities[$i]->date_recorded; 228 $activities_formatted[$i]['component_name'] = $activities[$i]->component_name; 229 } 230 231 return $activities_formatted; 232 } 233 211 234 function cache_friends_activities( $activity_array ) { 212 235 global $wpdb, $bp; … … 223 246 } 224 247 225 function cache_activities( $activity_array ) {248 function cache_activities( $activity_array, $user_id ) { 226 249 global $wpdb, $bp; 227 250 … … 229 252 $wpdb->query( "TRUNCATE TABLE " . $bp['activity']['table_name_current_user_cached'] ); 230 253 254 /* Empty user's activities from the sitewide stream */ 255 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . " WHERE user_id = %d", $user_id ) ); 256 231 257 for ( $i = 0; $i < count($activity_array); $i++ ) { 258 if ( $activity_array[$i]['content'] == '' ) continue; 259 232 260 // Cache that sucka... 233 261 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_current_user_cached'] . " ( content, component_name, date_cached, date_recorded, is_private ) VALUES ( %s, %s, FROM_UNIXTIME(%d), %s, %d )", $activity_array[$i]['content'], $activity_array[$i]['component_name'], time(), $activity_array[$i]['date_recorded'], $activity_array[$i]['is_private'] ) ); 262 263 // Add to the sitewide activity stream 264 if ( !$activity_array[$i]['is_private'] ) 265 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_sitewide'] . " ( user_id, content, component_name, date_cached, date_recorded ) VALUES ( %d, %s, %s, FROM_UNIXTIME(%d), %s )", $user_id, $activity_array[$i]['content'], $activity_array[$i]['component_name'], time(), $activity_array[$i]['date_recorded'] ) ); 234 266 } 235 267 -
trunk/bp-activity/bp-activity-templatetags.php
r364 r375 134 134 135 135 function bp_activity_content_filter( $content, $date_recorded, $full_name, $insert_time = true, $is_home = true ) { 136 136 if ( !$content ) 137 return false; 138 137 139 /* Split the content so we don't evaluate and replace text on content we don't want to */ 138 140 $content = explode( '%s', $content ); -
trunk/bp-blogs.php
r373 r375 222 222 $post = BP_Blogs_Post::fetch_post_content($post); 223 223 224 $content = bp_core_get_userlink($post-> user_id) . ' ' . __('wrote a new blog post') . ' <a href="' . bp_post_get_permalink( $post, $post->blog_id ) . '">' . $post->post_title . '</a> <span class="time-since">%s</span>';224 $content = bp_core_get_userlink($post->post_author_id) . ' ' . __('wrote a new blog post') . ' <a href="' . bp_post_get_permalink( $post, $post->blog_id ) . '">' . $post->post_title . '</a> <span class="time-since">%s</span>'; 225 225 $content .= '<blockquote>' . bp_create_excerpt($post->post_content) . '</blockquote>'; 226 226 return $content; -
trunk/bp-blogs/bp-blogs-widgets.php
r374 r375 47 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 48 <?php if ( !$counter ) : ?> 49 <div class="item-content"><?php echo apply_filters( 'the_excerpt', $post->post_content) ?></div>49 <div class="item-content"><?php echo bp_create_excerpt($post->post_content) ?></div> 50 50 <?php endif; ?> 51 51 <div class="item-meta"><em>by <?php echo bp_core_get_userlink($post->post_author) ?> from the blog "<a href="<?php echo get_blog_option($post->blog_id, 'siteurl') ?>"><?php echo get_blog_option($post->blog_id, 'blogname') ?></a>"</em></div> -
trunk/bp-core.php
r373 r375 108 108 if ( !$bp['current_component'] ) 109 109 $bp['current_component'] = $bp['default_component']; 110 111 110 } 112 111 add_action( 'wp', 'bp_core_setup_globals', 1 ); … … 213 212 */ 214 213 function bp_core_get_current_userid() { 215 global $current_blog ;216 217 /* Get the ID of the current blog being viewed. */218 $blog_id = $current_blog->blog_id;219 214 global $current_blog, $current_user; 215 216 if ( $current_blog->blog_id == 1 ) 217 return $current_user->ID; 218 220 219 /* Check to see if this is a user home, and if it is, get the user id */ 221 if ( !$current_userid = bp_core_get_homebase_userid( $ blog_id ) )220 if ( !$current_userid = bp_core_get_homebase_userid( $current_blog->blog_id ) ) 222 221 return false; // return false if this is a normal blog, and not a user home. 223 222 -
trunk/bp-core/bp-core-catchuri.php
r359 r375 110 110 $pages = $bp_path; 111 111 112 if ( $wpdb->blogid == $bp['current_homebase_id'] ) { 113 if ( !file_exists( TEMPLATEPATH . "/header.php" ) || !file_exists( TEMPLATEPATH . "/footer.php" ) ) 114 wp_die( 'Please make sure your BuddyPress enabled theme includes a header.php and footer.php file.'); 112 if ( !file_exists( TEMPLATEPATH . "/header.php" ) || !file_exists( TEMPLATEPATH . "/footer.php" ) ) 113 wp_die( 'Please make sure your BuddyPress enabled theme includes a header.php and footer.php file.'); 115 114 116 do_action( 'get_header' ); 117 load_template( TEMPLATEPATH . "/header.php" ); 118 119 if ( is_array( $pages ) ) { 120 foreach( $pages as $page ) { 121 if ( file_exists( TEMPLATEPATH . "/" . $page . ".php" ) ) { 122 load_template( TEMPLATEPATH . "/" . $page . ".php" ); 123 } 124 } 125 } else { 126 if ( file_exists( TEMPLATEPATH . "/" . $pages . ".php" ) ) { 127 load_template( TEMPLATEPATH . "/" . $pages . ".php" ); 128 } else { 129 load_template( TEMPLATEPATH . "/index.php" ); 115 do_action( 'get_header' ); 116 load_template( TEMPLATEPATH . "/header.php" ); 117 118 if ( is_array( $pages ) ) { 119 foreach( $pages as $page ) { 120 if ( file_exists( TEMPLATEPATH . "/" . $page . ".php" ) ) { 121 load_template( TEMPLATEPATH . "/" . $page . ".php" ); 130 122 } 131 123 } 132 133 do_action( 'get_footer' ); 134 load_template( TEMPLATEPATH . "/footer.php" ); 135 die; 124 } else { 125 if ( file_exists( TEMPLATEPATH . "/" . $pages . ".php" ) ) { 126 load_template( TEMPLATEPATH . "/" . $pages . ".php" ); 127 } else { 128 if ( file_exists( TEMPLATEPATH . "/home.php" ) ) 129 load_template( TEMPLATEPATH . "/home.php" ); 130 else 131 load_template( TEMPLATEPATH . "/index.php" ); 132 } 136 133 } 134 135 do_action( 'get_footer' ); 136 load_template( TEMPLATEPATH . "/footer.php" ); 137 die; 137 138 } 138 139 ?> -
trunk/bp-core/bp-core-classes.php
r373 r375 94 94 $limit = 5; 95 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 ) );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 DESC LIMIT %d", $limit ) ); 97 97 } 98 98 … … 107 107 108 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 function get_online_users( $limit = 5 ) { 112 global $wpdb; 109 113 114 if ( !$limit ) 115 $limit = 5; 116 117 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$wpdb->base_prefix}usermeta um WHERE meta_key = 'last_activity' AND DATE_ADD( FROM_UNIXTIME(meta_value), INTERVAL 5 MINUTE ) >= NOW() ORDER BY meta_value DESC LIMIT %d", $limit ) ); 110 118 } 111 112 119 } 113 120 -
trunk/bp-core/bp-core-cssjs.php
r373 r375 25 25 */ 26 26 function bp_core_add_ajax_js() { 27 echo '<script type="text/javascript">var ajaxurl = "' . site_url() . '/wp- admin/admin-ajax.php";</script>';27 echo '<script type="text/javascript">var ajaxurl = "' . site_url() . '/wp-content/mu-plugins/bp-core/bp-core-ajax-handler.php";</script>'; 28 28 } 29 29 add_action( 'wp_head', 'bp_core_add_ajax_js' ); -
trunk/bp-core/bp-core-templatetags.php
r359 r375 22 22 */ 23 23 function bp_get_nav() { 24 global $bp ;24 global $bp, $current_blog; 25 25 26 26 /* Sort the nav by key as the array has been put together in different locations */ … … 30 30 foreach( (array) $bp['bp_nav'] as $nav_item ) { 31 31 /* If the current component matches the nav item id, then add a highlight CSS class. */ 32 if ( $bp['current_component'] == $nav_item['css_id'] && $bp['current_userid'] == $bp['loggedin_userid']) {32 if ( $bp['current_component'] == $nav_item['css_id'] && bp_is_home() ) { 33 33 $selected = ' class="current"'; 34 34 } else { … … 39 39 then check to see if the two users are friends. if they are, add a highligh CSS class 40 40 to the friends nav item if it exists. */ 41 if ( $bp['current_userid'] != $bp['loggedin_userid']) {41 if ( !bp_is_home() ) { 42 42 if ( function_exists('friends_check_friendship') ) { 43 43 if ( friends_check_friendship( $bp['current_userid'] ) == 'is_friend' && $nav_item['css_id'] == $bp['friends']['slug'] ) { … … 54 54 55 55 /* Always add a log out list item to the end of the navigation */ 56 echo '<li><a id="wp-logout" href="' . get_option('home') . '/wp-login.php?action=logout">Log Out</a><li>';56 echo '<li><a id="wp-logout" href="' . site_url() . '/wp-login.php?action=logout">Log Out</a><li>'; 57 57 } 58 58 … … 301 301 } 302 302 303 function bp_loggedinuser_link() { 304 global $bp; 305 echo bp_core_get_userlink( $bp['loggedin_userid'] ); 306 } 307 303 308 /* Template functions for fetching globals, without querying the DB again 304 309 also means we dont have to use the $bp variable in the template (looks messy) */ -
trunk/bp-core/bp-core-widgets.php
r374 r375 19 19 if ( is_active_widget( 'bp_core_widget_members' ) ) 20 20 wp_enqueue_script( 'bp_core_widget_members-js', site_url() . '/wp-content/mu-plugins/bp-core/js/widget-members.js', array('jquery', 'jquery-livequery-pack') ); 21 } 21 } else { 22 23 /* Widgets we specifically only want on member home bases, or blogs and not the main home blog */ 24 25 } 26 27 /* Widgets that can be enabled anywhere */ 28 register_sidebar_widget( __('Who\'s Online'), 'bp_core_widget_whos_online'); 29 register_widget_control( __('Who\'s Online'), 'bp_core_widget_whos_online_control' ); 30 22 31 } 23 32 add_action( 'plugins_loaded', 'bp_core_register_widgets' ); … … 91 100 <?php if ( $users ) : ?> 92 101 <div class="item-options" id="members-list-options"> 93 <img id="ajax-loader-members" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> 102 <img id="ajax-loader-members" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> 94 103 <a href="<?php echo site_url() . '/members' ?>" id="newest-members" class="selected"><?php _e("Newest") ?></a> | 95 104 <a href="<?php echo site_url() . '/members' ?>" id="recently-active-members"><?php _e("Active") ?></a> | … … 150 159 <?php 151 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 $users = BP_Core_User::get_online_users($options['max_members']) ?> 176 177 <?php if ( $users ) : ?> 178 <div class="avatar-block"> 179 <?php foreach ( (array) $users as $user ) : ?> 180 <?php if ( !bp_core_user_has_home($user->user_id) || !$user->user_id ) continue; ?> 181 <div class="item-avatar"> 182 <a href="<?php echo bp_core_get_userurl($user->user_id) ?>" title="<?php bp_fetch_user_fullname( $user->user_id, true ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?></a> 183 </div> 184 <?php endforeach; ?> 185 </div> 186 </ul> 187 188 <?php 189 if ( function_exists('wp_nonce_field') ) 190 wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' ); 191 ?> 192 193 <input type="hidden" name="bp_core_widget_members_max" id="bp_core_widget_members_max" value="<?php echo $options['max_members'] ?>" /> 194 195 <?php else: ?> 196 <div class="widget-error"> 197 <?php _e('There are no users currently online.') ?> 198 </div> 199 <?php endif; ?> 200 201 <?php echo $after_widget; ?> 202 <?php 203 } 204 205 function bp_core_widget_whos_online_control() { 206 global $current_blog; 207 208 $options = $newoptions = get_blog_option( $current_blog->blog_id, 'bp_core_widget_whos_online' ); 209 210 if ( $_POST['bp-widget-whos-online-submit'] ) { 211 $newoptions['max_members'] = strip_tags( stripslashes( $_POST['bp-widget-whos-online-max-members'] ) ); 212 } 213 214 if ( $options != $newoptions ) { 215 $options = $newoptions; 216 update_blog_option( $current_blog->blog_id, 'bp_core_widget_whos_online', $options ); 217 } 218 219 $max_members = attribute_escape( $options['max_members'] ); 220 ?> 221 <p><label for="bp-widget-whos-online-max-members"><?php _e('Maximum number of members to show:'); ?><br /><input class="widefat" id="bp-widget-whos-online-max-members" name="bp-widget-whos-online-max-members" type="text" value="<?php echo $max_members; ?>" style="width: 30%" /></label></p> 222 <input type="hidden" id="bp-widget-whos-online-submit" name="bp-widget-whos-online-submit" value="1" /> 223 <?php 224 } -
trunk/bp-friends.php
r373 r375 194 194 $friendship = new BP_Friends_Friendship( $friendship_id, false, false ); 195 195 196 if ( !$friendship )196 if ( !$friendship->initiator_user_id || !$friendship->friend_user_id ) 197 197 return false; 198 198 -
trunk/bp-friends/bp-friends-ajax.php
r373 r375 134 134 if ( BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $_POST['fid'] ) == 'is_friend' ) { 135 135 if ( !friends_remove_friend( $bp['loggedin_userid'], $bp['current_userid'] ) ) { 136 echo "-1[[SPLIT]]" .__("Friendship could not be canceled.");136 echo __("Friendship could not be canceled."); 137 137 } else { 138 138 friends_update_friend_totals( $bp['loggedin_userid'], $bp['current_userid'], 'remove' ); … … 141 141 } else if ( BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $_POST['fid'] ) == 'not_friends' ) { 142 142 if ( !friends_add_friend( $bp['loggedin_userid'], $_POST['fid'] ) ) { 143 echo "-1[[SPLIT]]" . __("Friend could not be added.");143 echo __("Friendship could not be requested."); 144 144 } else { 145 145 echo __('Friendship Requested'); -
trunk/bp-groups.php
r373 r375 3 3 4 4 define ( 'BP_GROUPS_IS_INSTALLED', 1 ); 5 define ( 'BP_GROUPS_VERSION', '0.1. 6' );5 define ( 'BP_GROUPS_VERSION', '0.1.9' ); 6 6 7 7 include_once( 'bp-groups/bp-groups-classes.php' ); … … 58 58 KEY is_confirmed (is_confirmed) 59 59 );"; 60 61 $sql[] = "CREATE TABLE ". $bp['groups']['table_name_groupmeta'] ." ( 62 id int(11) NOT NULL AUTO_INCREMENT, 63 group_id int(11) NOT NULL, 64 meta_key varchar(255) DEFAULT NULL, 65 meta_value longtext DEFAULT NULL, 66 PRIMARY KEY (id), 67 KEY group_id (group_id), 68 KEY meta_key (meta_key) 69 );"; 60 70 61 71 if ( function_exists('bp_wire_install') ) { … … 86 96 **************************************************************************/ 87 97 88 function groups_setup_globals() { 89 global $bp, $wpdb; 90 98 function groups_setup_globals( $global = true ) { 99 global $wpdb; 100 101 if ( $global ) 102 global $bp; 103 91 104 $bp['groups'] = array( 92 105 'table_name' => $wpdb->base_prefix . 'bp_groups', 93 106 'table_name_members' => $wpdb->base_prefix . 'bp_groups_members', 107 'table_name_groupmeta' => $wpdb->base_prefix . 'bp_groups_groupmeta', 94 108 'image_base' => site_url() . '/wp-content/mu-plugins/bp-groups/images', 95 109 'format_activity_function' => 'groups_format_activity', … … 101 115 102 116 $bp['groups']['forbidden_names'] = array( 'my-groups', 'group-finder', 'create', 'invites', 'delete', 'add' ); 117 118 return $bp; 103 119 } 104 120 add_action( 'wp', 'groups_setup_globals', 1 ); … … 124 140 if ( ( $wpdb->get_var("show tables like '%" . $bp['groups']['table_name'] . "%'") == false ) || ( get_site_option('bp-groups-version') < BP_GROUPS_VERSION ) ) 125 141 groups_install(BP_GROUPS_VERSION); 126 142 127 143 } 128 144 add_action( 'admin_menu', 'groups_add_admin_menu' ); … … 135 151 136 152 function groups_setup_nav() { 137 global $bp ;153 global $bp, $current_blog; 138 154 global $group_obj, $is_single_group; 139 155 … … 151 167 bp_core_add_nav_default( $bp['groups']['slug'], 'groups_screen_my_groups', 'my-groups' ); 152 168 153 $groups_link = $ group_link = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/';169 $groups_link = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/'; 154 170 155 171 /* Add the subnav items to the groups nav item */ … … 170 186 $bp['bp_options_title'] = $bp['current_fullname']; 171 187 172 } else if ( $is_single_group ) { 188 } else if ( $is_single_group ) { 173 189 // We are viewing a single group, so set up the 174 190 // group navigation menu using the $group_obj global. … … 183 199 $bp['bp_options_avatar'] = '<img src="' . $group_obj->avatar_thumb . '" alt="Group Avatar Thumbnail" />'; 184 200 185 $group_link = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/' . $group_obj->slug . '/'; 201 switch_to_blog(1); 202 $group_link = site_url() . '/' . $bp['groups']['slug'] . '/' . $group_obj->slug . '/'; 203 switch_to_blog($current_blog->blog_id); 186 204 187 205 // Reset the existing subnav items … … 202 220 203 221 bp_core_add_subnav_item( $bp['groups']['slug'], 'members', __('Members'), $group_link, 'groups_screen_group_members', 'group-members' ); 204 bp_core_add_subnav_item( $bp['groups']['slug'], 'send-invites', __('Send Invites'), $group_link, 'groups_screen_group_invite', 'group-invite' );205 222 206 223 if ( is_user_logged_in() && groups_is_user_member( $bp['loggedin_userid'], $group_obj->id ) ) { 224 bp_core_add_subnav_item( $bp['groups']['slug'], 'send-invites', __('Send Invites'), $group_link, 'groups_screen_group_invite', 'group-invite' ); 207 225 bp_core_add_subnav_item( $bp['groups']['slug'], 'leave-group', __('Leave Group'), $group_link, 'groups_screen_group_leave', 'group-leave' ); 208 226 } … … 211 229 } 212 230 add_action( 'wp', 'groups_setup_nav', 2 ); 231 232 function groups_get_group_theme() { 233 global $current_component, $current_action, $is_single_group; 234 235 // The theme filter does not recognize any globals, where as the stylesheet filter does. 236 // We have to set up the globals to use manually. 237 bp_core_set_uri_globals(); 238 $groups_bp = groups_setup_globals(false); 239 240 if ( $current_component == $groups_bp['groups']['slug'] ) 241 $is_single_group = BP_Groups_Group::group_exists( $current_action, $groups_bp['groups']['table_name'] ); 242 243 if ( $current_component == $groups_bp['groups']['slug'] && $is_single_group ) 244 $theme = 'buddypress'; 245 else 246 $theme = get_option('template'); 247 248 return $theme; 249 } 250 add_filter( 'template', 'groups_get_group_theme' ); 251 252 function groups_get_group_stylesheet() { 253 global $bp, $is_single_group; 254 255 if ( $bp['current_component'] == $bp['groups']['slug'] && $is_single_group ) 256 return 'buddypress'; 257 else 258 return get_option('stylesheet'); 259 } 260 add_filter( 'stylesheet', 'groups_get_group_stylesheet' ); 261 213 262 214 263 /***** Screens **********/ … … 334 383 } 335 384 } 336 385 337 386 } else if ( $bp['action_variables'][1] == 'delete' && BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $group_obj->id ) ) { 338 339 if ( !groups_delete_wire_post( $bp['action_variables'][2], $bp['groups']['table_name_wire'] ) ) { 387 $wire_message_id = $bp['action_variables'][2]; 388 389 if ( !groups_delete_wire_post( $wire_message_id, $bp['groups']['table_name_wire'] ) ) { 340 390 bp_catch_uri( 'groups/group-home' ); 341 391 } else { … … 412 462 } else { 413 463 $bp['message'] = __('You left the group successfully.'); 414 $bp['message_type'] = 'success'; 464 $bp['message_type'] = 'success'; 415 465 } 416 466 add_action( 'template_notices', 'bp_core_render_notice' ); 417 467 418 $is_single_group = false; 419 $bp['current_action'] = 'group-finder'; 420 bp_catch_uri( 'groups/group-finder' ); 468 $bp['current_action'] = 'group-home'; 469 bp_catch_uri( 'groups/group-home' ); 421 470 422 471 } else if ( isset($bp['action_variables']) && $bp['action_variables'][1] == 'no' ) { … … 445 494 } else { 446 495 $bp['message'] = __('You joined the group!'); 447 $bp['message_type'] = 'success'; 496 $bp['message_type'] = 'success'; 448 497 } 449 498 … … 469 518 } 470 519 } 471 add_action( ' bp_groups_joined_group', 'groups_record_activity' );472 add_action( ' bp_groups_created_group', 'groups_record_activity' );473 add_action( ' bp_groups_new_wire_post', 'groups_record_activity' );520 add_action( 'activity_groups_joined_group', 'groups_record_activity' ); 521 add_action( 'activity_groups_created_group', 'groups_record_activity' ); 522 add_action( 'activity_groups_new_wire_post', 'groups_record_activity' ); 474 523 475 524 /************************************************************************** … … 518 567 519 568 /************************************************************************** 520 groups_ admin_setup()569 groups_update_last_activity() 521 570 522 Setup CSS, JS and other things needed for the xprofile component. 523 **************************************************************************/ 524 525 function groups_admin_setup() { 526 } 527 add_action( 'admin_menu', 'groups_admin_setup' ); 528 571 Sets groupmeta for the group with the last activity date for the group based 572 on specific group activities. 573 **************************************************************************/ 574 575 function groups_update_last_activity( $args = true ) { 576 extract($args); 577 578 groups_update_groupmeta( $group_id, 'last_activity', time() ); 579 } 580 add_action( 'groups_deleted_wire_post', 'groups_update_last_activity' ); 581 add_action( 'groups_new_wire_post', 'groups_update_last_activity' ); 582 add_action( 'groups_joined_group', 'groups_update_last_activity' ); 583 add_action( 'groups_leave_group', 'groups_update_last_activity' ); 584 add_action( 'groups_created_group', 'groups_update_last_activity' ); 585 586 587 /************************************************************************** 588 groups_get_user_groups() 589 590 Fetch the groups the current user is a member of. 591 **************************************************************************/ 529 592 530 593 function groups_get_user_groups( $pag_page, $pag_num ) { … … 655 718 if ( !$group->save() ) 656 719 return false; 657 720 658 721 // Save the creator as the group administrator 659 722 $admin = new BP_Groups_Member( $bp['loggedin_userid'], $group->id ); … … 663 726 $admin->inviter_id = 0; 664 727 $admin->is_confirmed = 1; 665 728 666 729 if ( !$admin->save() ) 667 730 return false; 668 731 732 /* Set groupmeta */ 733 groups_update_groupmeta( $group->id, 'total_member_count', 1 ); 734 groups_update_groupmeta( $group->id, 'theme', 'buddypress' ); 735 groups_update_groupmeta( $group->id, 'stylesheet', 'buddypress' ); 736 669 737 return $group->id; 670 738 } … … 680 748 $group->enable_photos = 1; 681 749 $group->photos_admin_only = 0; 682 $group->date_created = time();683 750 684 751 if ( !isset($_POST['group-show-wire']) ) … … 727 794 groups_send_invites($group); 728 795 729 do_action( 'bp_groups_created_group', array( 'item_id' => $group->id, 'component_name' => 'groups', 'component_action' => 'created_group', 'is_private' => 0 ) ); 796 /* activity stream recording action */ 797 do_action( 'activity_groups_created_group', array( 'item_id' => $group->id, 'component_name' => 'groups', 'component_action' => 'created_group', 'is_private' => 0 ) ); 798 799 /* regular action */ 800 do_action( 'groups_created_group', array( 'group_id' => $group->id ) ); 730 801 731 802 header( "Location: " . $bp['loggedin_domain'] . $bp['groups']['slug'] . "/" . $group->slug ); … … 774 845 return false; 775 846 847 do_action( 'groups_invite_user', array( 'group_id' => $group_id, 'user_id' => $user_id ) ); 848 776 849 return true; 777 850 } … … 782 855 if ( !BP_Groups_Member::delete( $user_id, $group_id ) ) 783 856 return false; 784 857 858 do_action( 'groups_uninvite_user', array( 'group_id' => $group_id, 'user_id' => $user_id ) ); 859 785 860 return true; 786 861 } … … 824 899 wp_mail( $invited_user->email, __("New Group Invitation:") . $group_obj->name, $message, "From: noreply@" . $_SERVER[ 'HTTP_HOST' ] ); 825 900 } 901 902 do_action( 'groups_send_invites', array( 'group_id' => $group_obj->id, 'invited_users' => $invited_users ) ); 826 903 } 827 904 … … 832 909 if ( !groups_uninvite_user( $bp['loggedin_userid'], $group_id ) ) 833 910 return false; 911 912 do_action( 'groups_leave_group', array( 'group_id' => $group_id, 'user_id' => $bp['loggedin_userid'] ) ); 913 914 /* Modify group member count */ 915 groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') - 1 ); 834 916 835 917 return true; … … 850 932 if ( !$new_member->save() ) 851 933 return false; 852 853 do_action( 'bp_groups_joined_group', array( 'item_id' => $new_member->group_id, 'component_name' => 'groups', 'component_action' => 'joined_group', 'is_private' => 0 ) ); 934 935 /* activity stream recording action */ 936 do_action( 'activity_groups_joined_group', array( 'item_id' => $new_member->group_id, 'component_name' => 'groups', 'component_action' => 'joined_group', 'is_private' => 0 ) ); 937 938 /* regular action */ 939 do_action( 'groups_joined_group', array( 'group_id' => $group_id, 'user_id' => $bp['loggedin_userid'] ) ); 940 941 /* Modify group member count */ 942 groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') + 1 ); 854 943 855 944 return true; … … 858 947 function groups_new_wire_post( $group_id, $content ) { 859 948 if ( $wire_post_id = bp_wire_new_post( $group_id, $content ) ) { 860 do_action( 'bp_groups_new_wire_post', array( 'item_id' => $wire_post_id, 'component_name' => 'groups', 'component_action' => 'new_wire_post', 'is_private' => 0 ) ); 949 950 /* activity stream recording action */ 951 do_action( 'activity_groups_new_wire_post', array( 'item_id' => $wire_post_id, 'component_name' => 'groups', 'component_action' => 'new_wire_post', 'is_private' => 0 ) ); 952 953 /* regular action */ 954 do_action( 'groups_new_wire_post', array( 'group_id' => $group_id, 'wire_post_id' => $wire_post_id ) ); 955 861 956 return true; 862 957 } … … 867 962 function groups_delete_wire_post( $wire_post_id, $table_name ) { 868 963 if ( bp_wire_delete_post( $wire_post_id, $table_name ) ) { 869 do_action( ' bp_groups_deleted_wire_post', array( 'wire_post_id' => $wire_post_id ) );964 do_action( 'groups_deleted_wire_post', array( 'wire_post_id' => $wire_post_id ) ); 870 965 return true; 871 966 } … … 873 968 return false; 874 969 } 970 971 function groups_get_newest( $limit = 5 ) { 972 return BP_Groups_Group::get_newest($limit); 973 } 974 975 function groups_get_active( $limit = 5 ) { 976 return BP_Groups_Group::get_active($limit); 977 } 978 979 function groups_get_popular( $limit = 5 ) { 980 return BP_Groups_Group::get_popular($limit); 981 } 982 983 984 // 985 // Group meta functions 986 // 987 988 function groups_delete_groupmeta( $group_id, $meta_key, $meta_value = '' ) { 989 global $wpdb, $bp; 990 991 if ( !is_numeric( $group_id ) ) 992 return false; 993 994 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 995 996 if ( is_array($meta_value) || is_object($meta_value) ) 997 $meta_value = serialize($meta_value); 998 999 $meta_value = trim( $meta_value ); 1000 1001 if ( !empty($meta_value) ) 1002 $wpdb->query( $wpdb->prepare("DELETE FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE groups_id = %d AND meta_key = %s AND meta_value = %s", $group_id, $meta_key, $meta_value) ); 1003 else 1004 $wpdb->query( $wpdb->prepare("DELETE FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key) ); 1005 1006 // TODO need to look into using this. 1007 // wp_cache_delete($group_id, 'groups'); 1008 1009 return true; 1010 } 1011 1012 function groups_get_groupmeta( $group_id, $meta_key = '') { 1013 global $wpdb, $bp; 1014 1015 $group_id = (int) $group_id; 1016 1017 if ( !$group_id ) 1018 return false; 1019 1020 if ( !empty($meta_key) ) { 1021 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 1022 1023 // TODO need to look into using this. 1024 //$user = wp_cache_get($user_id, 'users'); 1025 1026 // Check the cached user object 1027 //if ( false !== $user && isset($user->$meta_key) ) 1028 // $metas = array($user->$meta_key); 1029 //else 1030 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key) ); 1031 } else { 1032 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d", $group_id) ); 1033 } 1034 1035 if ( empty($metas) ) { 1036 if ( empty($meta_key) ) 1037 return array(); 1038 else 1039 return ''; 1040 } 1041 1042 $metas = array_map('maybe_unserialize', $metas); 1043 1044 if ( count($metas) == 1 ) 1045 return $metas[0]; 1046 else 1047 return $metas; 1048 } 1049 1050 function groups_update_groupmeta( $group_id, $meta_key, $meta_value ) { 1051 global $wpdb, $bp; 1052 1053 if ( !is_numeric( $group_id ) ) 1054 return false; 1055 1056 $meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key ); 1057 1058 if ( is_string($meta_value) ) 1059 $meta_value = stripslashes($wpdb->escape($meta_value)); 1060 1061 $meta_value = maybe_serialize($meta_value); 1062 1063 if (empty($meta_value)) { 1064 return groups_delete_groupmeta( $group_id, $meta_key ); 1065 } 1066 1067 $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) ); 1068 1069 if ( !$cur ) { 1070 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['groups']['table_name_groupmeta'] . " ( group_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $group_id, $meta_key, $meta_value ) ); 1071 } else if ( $cur->meta_value != $meta_value ) { 1072 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['groups']['table_name_groupmeta'] . " SET meta_value = %s WHERE group_id = %d AND meta_key = %s", $meta_value, $group_id, $meta_key ) ); 1073 } else { 1074 return false; 1075 } 1076 1077 // TODO need to look into using this. 1078 // wp_cache_delete($user_id, 'users'); 1079 1080 return true; 1081 } 1082 875 1083 876 1084 function groups_remove_data( $user_id ) { -
trunk/bp-groups/bp-groups-ajax.php
r348 r375 94 94 <img class="avatar" alt="Group Avatar" src="<?php echo $group->avatar_thumb ?>"/> 95 95 <h4> 96 <a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] . '/' . $group->slug?>"><?php echo $group->name ?></a>97 <span class="small"> - <?php echo count($group->user_dataset) ?> members</span>96 <a href="<?php bp_group_permalink( $group ) ?>"><?php echo $group->name ?></a> 97 <span class="small"> - <?php echo $group->total_member_count . ' ' . __('members') ?></span> 98 98 </h4> 99 99 <p class="desc"><?php echo bp_create_excerpt( $group->description, 20 ) ?></p> … … 150 150 <img class="avatar" alt="Group Avatar" src="<?php echo $group->avatar_thumb ?>"/> 151 151 <h4> 152 <a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] . '/' . $group->slug?>"><?php echo $group->name ?></a>153 <span class="small"> - <?php echo count($group->user_dataset) ?> members</span>152 <a href="<?php bp_group_permalink( $group ) ?>"><?php echo $group->name ?></a> 153 <span class="small"> - <?php echo $group->total_member_count . ' ' . __('members') ?></span> 154 154 </h4> 155 155 <p class="desc"><?php echo bp_create_excerpt( $group->description, 20 ) ?></p> … … 164 164 } 165 165 add_action( 'wp_ajax_group_finder_search', 'groups_ajax_group_finder_search' ); 166 167 168 function groups_ajax_widget_groups_list() { 169 global $bp; 170 171 check_ajax_referer('groups_widget_groups_list'); 172 173 if ( !$bp ) { 174 bp_core_setup_globals(); 175 groups_setup_globals(); 176 } 177 178 switch ( $_POST['filter'] ) { 179 case 'newest-groups': 180 $groups = groups_get_newest($_POST['max-groups']); 181 break; 182 case 'recently-active-groups': 183 $groups = groups_get_active($_POST['max-groups']); 184 break; 185 case 'popular-groups': 186 $groups = groups_get_popular($_POST['max-groups']); 187 break; 188 } 189 190 if ( $groups ) { 191 echo '0[[SPLIT]]'; // return valid result. 192 193 foreach ( (array) $groups as $group ) { 194 $group = new BP_Groups_Group( $group->group_id, false ); 195 ?> 196 <li> 197 <div class="item-avatar"> 198 <img src="<?php echo $group->avatar_thumb ?>" class="avatar" alt="<?php echo $group->name ?> Avatar" /> 199 </div> 200 201 <div class="item"> 202 <div class="item-title"><a href="<?php echo bp_group_permalink( $group, true ) ?>" title="<?php echo $group->name ?>"><?php echo $group->name ?></a></div> 203 <div class="item-meta"> 204 <span class="activity"> 205 <?php 206 if ( $_POST['filter'] == 'newest-groups') { 207 echo bp_core_get_last_activity( $group->date_created, __('created '), __(' ago') ); 208 } else if ( $_POST['filter'] == 'recently-active-groups') { 209 echo bp_core_get_last_activity( groups_get_groupmeta( $group->id, 'last_activity' ), __('active '), __(' ago') ); 210 } else if ( $_POST['filter'] == 'popular-groups') { 211 if ( $group->total_member_count == 1 ) 212 echo $group->total_member_count . __(' member'); 213 else 214 echo $group->total_member_count . __(' members'); 215 } 216 ?> 217 </span> 218 </div> 219 </div> 220 </li> 221 <?php 222 } 223 } else { 224 echo "-1[[SPLIT]]<li>" . __("No groups matched the current filter."); 225 } 226 } 227 add_action( 'wp_ajax_widget_groups_list', 'groups_ajax_widget_groups_list' ); 228 166 229 ?> -
trunk/bp-groups/bp-groups-classes.php
r373 r375 56 56 $this->enable_photos = $group->enable_photos; 57 57 $this->photos_admin_only = $group->photos_admin_only; 58 $this->date_created = $group->date_created; 58 $this->date_created = strtotime($group->date_created); 59 $this->total_member_count = groups_get_groupmeta( $this->id, 'total_member_count' ); 59 60 60 61 if ( !$group->avatar_thumb ) … … 70 71 if ( $get_user_dataset ) { 71 72 $this->user_dataset = $this->get_user_dataset(); 72 $this->total_member_count = count( $this->user_dataset ); 73 74 if ( !$this->total_member_count ) { 75 $this->total_member_count = count( $this->user_dataset ); 76 groups_update_groupmeta( $this->id, 'total_member_count', $this->total_member_count ); 77 } 73 78 } 74 79 } … … 159 164 ); 160 165 } 161 166 162 167 $result = $wpdb->query($sql); 163 168 … … 221 226 return false; 222 227 228 /* Remove groupmeta */ 229 groups_delete_groupmeta( $group_id ); 230 223 231 return true; 224 232 } 225 233 226 function group_exists( $slug ) { 227 global $wpdb, $bp; 228 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name'] . " WHERE slug = %s", $slug ) ); 234 function group_exists( $slug, $table_name = false ) { 235 global $wpdb, $bp; 236 237 if ( !$table_name ) 238 $table_name = $bp['groups']['table_name']; 239 240 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $table_name WHERE slug = %s", $slug ) ); 229 241 } 230 242 … … 313 325 $limit = 5; 314 326 315 return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name'] . " ORDER BY date_created DESC LIMIT %d", $limit ) ); 327 return $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . " ORDER BY date_created DESC LIMIT %d", $limit ) ); 328 } 329 330 function get_active( $limit = 5 ) { 331 global $wpdb, $bp; 332 333 if ( !$limit ) 334 $limit = 5; 335 336 return $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE meta_key = 'last_activity' ORDER BY meta_value DESC LIMIT %d", $limit ) ); 337 } 338 339 function get_popular( $limit = 5 ) { 340 global $wpdb, $bp; 341 342 if ( !$limit ) 343 $limit = 5; 344 345 return $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE meta_key = 'total_member_count' ORDER BY meta_value DESC LIMIT %d", $limit ) ); 316 346 } 317 347 } -
trunk/bp-groups/bp-groups-templatetags.php
r373 r375 147 147 global $groups_template; 148 148 149 ?><img src="<?php echo $groups_template->group->avatar_full ?>" class="avatar" alt=" GroupAvatar" /><?php149 ?><img src="<?php echo $groups_template->group->avatar_full ?>" class="avatar" alt="<?php echo $groups_template->group->name ?> Avatar" /><?php 150 150 } 151 151 … … 153 153 global $groups_template; 154 154 155 ?><img src="<?php echo $groups_template->group->avatar_thumb ?>" class="avatar" alt="Group Avatar" /><?php 156 } 157 158 159 function bp_group_permalink() { 160 global $groups_template, $bp; 161 echo $bp['current_domain'] . $bp['groups']['slug'] . '/' . $groups_template->group->slug; 155 ?><img src="<?php echo $groups_template->group->avatar_thumb ?>" class="avatar" alt="<?php echo $groups_template->group->name ?> Avatar" /><?php 156 } 157 158 159 function bp_group_permalink( $group_obj = false, $echo = true ) { 160 global $groups_template, $bp, $current_blog; 161 162 if ( !$group_obj ) 163 $group_obj = $groups_template->group; 164 165 switch_to_blog(1); 166 167 if ( $echo ) 168 echo site_url() . '/' . $bp['groups']['slug'] . '/' . $group_obj->slug; 169 else 170 return site_url() . '/' . $bp['groups']['slug'] . '/' . $group_obj->slug; 171 172 switch_to_blog($current_blog->blog_id); 162 173 } 163 174 … … 244 255 function bp_group_all_members_permalink() { 245 256 global $groups_template, $bp; 246 echo $bp['current_domain'] . $bp['groups']['slug'] . '/' . $groups_template->group->slug. '/members';257 echo bp_group_permalink( false, true ) . '/members'; 247 258 } 248 259 … … 268 279 269 280 if ( $bp['current_action'] == 'my-groups' || !$bp['current_action'] ) { 270 $action = $bp[' current_domain'] . $bp['groups']['slug'] . '/my-groups/search/';281 $action = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/my-groups/search/'; 271 282 $label = __('Filter Groups'); 272 283 $type = 'group'; 273 284 } else { 274 $action = $bp[' current_domain'] . $bp['groups']['slug'] . '/group-finder/search/';285 $action = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/group-finder/search/'; 275 286 $label = __('Find a Group'); 276 287 $type = 'groupfinder'; … … 505 516 global $groups_template, $bp; 506 517 507 echo $bp['loggedin_domain'] . $bp['groups']['slug'] . '/' . $groups_template->group->slug. '/leave-group/yes';518 echo bp_group_permalink( false, true ) . '/leave-group/yes'; 508 519 } 509 520 … … 511 522 global $groups_template, $bp; 512 523 513 echo $bp['loggedin_domain'] . $bp['groups']['slug'] . '/' . $groups_template->group->slug . '/leave-group/no';524 echo bp_group_permalink( false, true ); 514 525 } 515 526 … … 559 570 global $groups_template, $bp; 560 571 561 echo $bp['loggedin_domain'] . $bp['groups']['slug'] . '/' . $groups_template->group->slug. '/send-invites/send';572 echo bp_group_permalink( false, true ) . '/send-invites/send'; 562 573 } 563 574 … … 566 577 567 578 if ( is_user_logged_in() && !BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $groups_template->group->id ) ) { 568 echo '<a class="join-group" href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/' . $groups_template->group->slug. '/join">' . __('Join Group') . '</a>';579 echo '<a class="join-group" href="' . bp_group_permalink( false, false ) . '/join">' . __('Join Group') . '</a>'; 569 580 } 570 581 } … … 582 593 <?php $group = new BP_Groups_Group( $group_ids[$i], false, false ); ?> 583 594 <li> 584 <a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] . '/' . $group->slug?>"><img src="<?php echo $group->avatar_thumb; ?>" class="avatar" alt="Group Avatar" /></a>585 <h5><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] . '/' . $group->slug?>"><?php echo $group->name ?></a></h5>595 <a href="<?php echo bp_group_permalink( $group, false ) ?>"><img src="<?php echo $group->avatar_thumb; ?>" class="avatar" alt="Group Avatar" /></a> 596 <h5><a href="<?php echo bp_group_permalink( $group, false ) ?>"><?php echo $group->name ?></a></h5> 586 597 </li> 587 598 <?php } ?> -
trunk/bp-groups/bp-groups-widgets.php
r374 r375 37 37 <?php if ( $groups ) : ?> 38 38 <div class="item-options" id="groups-list-options"> 39 <img id="ajax-loader-groups" src="<?php echo $bp['groups']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> 39 <img id="ajax-loader-groups" src="<?php echo $bp['groups']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> 40 40 <a href="<?php echo site_url() . '/groups' ?>" id="newest-groups" class="selected"><?php _e("Newest") ?></a> | 41 41 <a href="<?php echo site_url() . '/groups' ?>" id="recently-active-groups"><?php _e("Active") ?></a> | … … 44 44 <ul id="groups-list" class="item-list"> 45 45 <?php foreach ( $groups as $group ) : ?> 46 <?php $group = new BP_Groups_Group( $group-> id, false ) ?>46 <?php $group = new BP_Groups_Group( $group->group_id, false ) ?> 47 47 <li> 48 48 <div class="item-avatar"> … … 51 51 52 52 <div class="item"> 53 <div class="item-title">< ?php echo $group->name ?></div>53 <div class="item-title"><a href="<?php echo bp_group_permalink( $group ) ?>" title="<?php echo $group->name ?>"><?php echo $group->name ?></a></div> 54 54 <div class="item-meta"><span class="activity"><?php echo bp_core_get_last_activity( $group->date_created, __('created '), __(' ago') ) ?></span></div> 55 55 </div> -
trunk/bp-xprofile.php
r373 r375 263 263 264 264 if ( ( $wire_post->item_id == $bp['loggedin_userid'] && $wire_post->user_id == $bp['loggedin_userid'] ) || ( $wire_post->item_id == $bp['current_userid'] && $wire_post->user_id == $bp['current_userid'] ) ) { 265 $content = bp_core_get_userlink($wire_post->user_id) . ' ' . __('wrote on ') . ' ' . bp_your_or_their() . ' ' . __('own wire') . ': <span class="time-since">%s</span>';265 $content = bp_core_get_userlink($wire_post->user_id) . ' ' . __('wrote on their own wire') . ': <span class="time-since">%s</span>'; 266 266 } else if ( ( $wire_post->item_id != $bp['loggedin_userid'] && $wire_post->user_id == $bp['loggedin_userid'] ) || ( $wire_post->item_id != $bp['current_userid'] && $wire_post->user_id == $bp['current_userid'] ) ) { 267 267 $content = bp_core_get_userlink($wire_post->user_id) . ' ' . __('wrote on ') . bp_core_get_userlink( $wire_post->item_id, false, false, true, true ) . ' wire: <span class="time-since">%s</span>'; -
trunk/bp-xprofile/bp-xprofile-classes.php
r359 r375 991 991 $this->user_id = $profiledata->user_id; 992 992 $this->field_id = $profiledata->field_id; 993 $this->value = $profiledata->value;993 $this->value = stripslashes($profiledata->value); 994 994 $this->last_updated = $profiledata->last_updated; 995 995 } -
trunk/bp-xprofile/bp-xprofile-templatetags.php
r359 r375 232 232 } 233 233 234 function bp_loggedinuser_avatar_thumbnail() { 235 global $bp; 236 echo bp_core_get_avatar( $bp['loggedin_userid'], 1 ); 234 function bp_loggedinuser_avatar_thumbnail( $width = false, $height = false ) { 235 global $bp; 236 237 if ( $width && $height ) 238 echo bp_core_get_avatar( $bp['loggedin_userid'], 1, false, $width, $height ); 239 else 240 echo bp_core_get_avatar( $bp['loggedin_userid'], 1 ); 237 241 } 238 242
Note: See TracChangeset
for help on using the changeset viewer.