Changeset 2088 for trunk/bp-groups/bp-groups-templatetags.php
- Timestamp:
- 11/13/2009 01:01:37 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-templatetags.php
r2077 r2088 247 247 $this->group = $this->next_group(); 248 248 249 // If this is a single group then instantiate group meta when creating the object. 250 if ( $this->single_group ) { 251 if ( !$group = wp_cache_get( 'groups_group_' . $this->group->group_id, 'bp' ) ) { 252 $group = new BP_Groups_Group( $this->group->group_id, true ); 253 wp_cache_set( 'groups_group_' . $this->group->group_id, $group, 'bp' ); 254 } 255 } else { 256 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $this->group->group_id, 'bp' ) ) { 257 $group = new BP_Groups_Group( $this->group->group_id, false, false ); 258 wp_cache_set( 'groups_group_nouserdata_' . $this->group->group_id, $group, 'bp' ); 259 } 260 } 261 262 $this->group = $group; 249 if ( $this->single_group ) 250 $this->group = new BP_Groups_Group( $this->group->group_id, true, true ); 263 251 264 252 if ( 0 == $this->current_group ) // loop has just started … … 282 270 extract( $r, EXTR_SKIP ); 283 271 284 /* The following code will auto set parameters based on the page being viewed. 285 * for example on example.com/members/andy/groups/my-groups/most-popular/ 286 * $type = 'most-popular' 287 */ 288 if ( 'my-groups' == $bp->current_action ) { 289 $order = $bp->action_variables[0]; 290 if ( 'recently-joined' == $order ) 291 $type = 'recently-joined'; 292 else if ( 'most-popular' == $order ) 293 $type = 'popular'; 294 else if ( 'admin-of' == $order ) 295 $type = 'admin-of'; 296 else if ( 'mod-of' == $order ) 297 $type = 'mod-of'; 298 else if ( 'alphabetically' == $order ) 299 $type = 'alphabetical'; 300 } else if ( 'invites' == $bp->current_action ) { 301 $type = 'invites'; 302 } else if ( $bp->groups->current_group->slug ) { 303 $type = 'single-group'; 304 $slug = $bp->groups->current_group->slug; 272 if ( '' == $args ) { 273 /* The following code will auto set parameters based on the page being viewed. 274 * for example on example.com/members/andy/groups/my-groups/most-popular/ 275 * $type = 'most-popular' 276 */ 277 if ( 'my-groups' == $bp->current_action ) { 278 $order = $bp->action_variables[0]; 279 if ( 'recently-joined' == $order ) 280 $type = 'recently-joined'; 281 else if ( 'most-popular' == $order ) 282 $type = 'popular'; 283 else if ( 'admin-of' == $order ) 284 $type = 'admin-of'; 285 else if ( 'mod-of' == $order ) 286 $type = 'mod-of'; 287 else if ( 'alphabetically' == $order ) 288 $type = 'alphabetical'; 289 } else if ( 'invites' == $bp->current_action ) { 290 $type = 'invites'; 291 } else if ( $bp->groups->current_group->slug ) { 292 $type = 'single-group'; 293 $slug = $bp->groups->current_group->slug; 294 } 305 295 } 306 296 … … 470 460 $group =& $groups_template->group; 471 461 472 $last_active = groups_get_groupmeta( $group->id, 'last_activity' ); 462 $last_active = $group->last_activity; 463 464 if ( !$last_active ) 465 $last_active = groups_get_groupmeta( $group->id, 'last_activity' ); 473 466 474 467 if ( empty( $last_active ) ) { … … 1997 1990 } 1998 1991 1999 function bp_the_site_group_avatar( ) {2000 echo bp_get_the_site_group_avatar( );2001 } 2002 function bp_get_the_site_group_avatar( ) {1992 function bp_the_site_group_avatar( $args = '' ) { 1993 echo bp_get_the_site_group_avatar( $args ); 1994 } 1995 function bp_get_the_site_group_avatar( $args = '' ) { 2003 1996 global $site_groups_template; 2004 1997 2005 return apply_filters( 'bp_the_site_group_avatar', bp_core_fetch_avatar( array( 'item_id' => $site_groups_template->group->id, 'object' => 'group', 'type' => 'full', 'avatar_dir' => 'group-avatars', 'alt' => __( 'Group Avatar', 'buddypress' ) ) ) ); 1998 $defaults = array( 1999 'type' => 'full', 2000 'width' => false, 2001 'height' => false, 2002 'class' => 'avatar', 2003 'id' => false, 2004 'alt' => __( 'Group avatar', 'buddypress' ) 2005 ); 2006 2007 $r = wp_parse_args( $args, $defaults ); 2008 extract( $r, EXTR_SKIP ); 2009 2010 return apply_filters( 'bp_the_site_group_avatar', bp_core_fetch_avatar( array( 'item_id' => $site_groups_template->group->id, 'object' => 'group', 'type' => $type, 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height ) ) ); 2006 2011 } 2007 2012
Note: See TracChangeset
for help on using the changeset viewer.