Changeset 2919 for trunk/bp-groups/bp-groups-templatetags.php
- Timestamp:
- 04/13/2010 04:01:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-templatetags.php
r2770 r2919 23 23 var $order; 24 24 25 function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $ populate_extras ) {25 function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $include, $populate_extras ) { 26 26 global $bp; 27 27 … … 36 36 $this->groups = array( $group ); 37 37 } else 38 $this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) );38 $this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'include' => $include, 'populate_extras' => $populate_extras ) ); 39 39 40 40 if ( 'invites' == $type ) { … … 169 169 'slug' => $slug, // Pass a group slug to only return that group 170 170 'search_terms' => $search_terms, // Pass search terms to return only matching groups 171 'include' => false, // Pass comma separated list of group ID's to return only these groups 171 172 172 173 'populate_extras' => true // Get extra meta - is_member, is_banned … … 176 177 extract( $r ); 177 178 178 $groups_template = new BP_Groups_Template( (int)$user_id, $type, (int)$page, (int)$per_page, (int)$max, $slug, $search_terms, (bool)$populate_extras );179 $groups_template = new BP_Groups_Template( (int)$user_id, $type, (int)$page, (int)$per_page, (int)$max, $slug, $search_terms, $include, (bool)$populate_extras ); 179 180 return apply_filters( 'bp_has_groups', $groups_template->has_groups(), &$groups_template ); 180 181 } … … 726 727 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span> 727 728 728 <?php if ( function_exists( 'friends_install' ) ) : ?>729 <?php if ( bp_is_active( 'friends' ) ) : ?> 729 730 <div class="action"> 730 731 <?php bp_add_friend_button( $admin->user_id ) ?> … … 764 765 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span> 765 766 766 <?php if ( function_exists( 'friends_install' ) ) : ?>767 <?php if ( bp_is_active( 'friends' ) ) : ?> 767 768 <div class="action"> 768 769 <?php bp_add_friend_button( $mod->user_id ) ?> … … 1034 1035 global $groups_template, $bp; 1035 1036 1036 if ( ! function_exists('friends_install') )1037 if ( !bp_is_active( 'friends' ) ) 1037 1038 return false; 1038 1039 … … 1047 1048 1048 1049 function bp_group_join_button( $group = false ) { 1049 global $bp, $groups_template; 1050 1051 if ( !$group ) 1052 $group =& $groups_template->group; 1053 1054 // If they're not logged in or are banned from the group, no join button. 1055 if ( !is_user_logged_in() || $group->is_banned ) 1056 return false; 1057 1058 if ( !$group->status ) 1059 return false; 1060 1061 if ( 'hidden' == $group->status && !$group->is_member ) 1062 return false; 1063 1064 echo '<div class="generic-button group-button ' . $group->status . '" id="groupbutton-' . $group->id . '">'; 1065 1066 switch ( $group->status ) { 1067 case 'public': 1068 if ( $group->is_member ) 1069 echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; 1070 else 1071 echo '<a class="join-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>'; 1072 break; 1073 1074 case 'private': 1075 if ( $group->is_member ) { 1076 echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; 1077 } else { 1078 if ( !bp_group_has_requested_membership( $group ) ) 1079 echo '<a class="request-membership" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_request_membership' ) . '">' . __('Request Membership', 'buddypress') . '</a>'; 1050 echo bp_get_group_join_button( $group ); 1051 } 1052 function bp_get_group_join_button( $group = false ) { 1053 global $bp, $groups_template; 1054 1055 if ( !$group ) 1056 $group =& $groups_template->group; 1057 1058 // If they're not logged in or are banned from the group, no join button. 1059 if ( !is_user_logged_in() || $group->is_banned ) 1060 return false; 1061 1062 if ( !$group->status ) 1063 return false; 1064 1065 if ( 'hidden' == $group->status && !$group->is_member ) 1066 return false; 1067 1068 $button = '<div class="generic-button group-button ' . $group->status . '" id="groupbutton-' . $group->id . '">'; 1069 1070 switch ( $group->status ) { 1071 case 'public': 1072 if ( $group->is_member ) 1073 $button .= '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; 1080 1074 else 1081 echo '<a class="membership-requested" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>'; 1082 } 1083 break; 1084 1085 case 'hidden': 1086 if ( $group->is_member ) 1087 echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; 1088 break; 1089 } 1090 1091 echo '</div>'; 1092 } 1075 $button .= '<a class="join-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>'; 1076 break; 1077 1078 case 'private': 1079 if ( $group->is_member ) { 1080 $button .= '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; 1081 } else { 1082 if ( !bp_group_has_requested_membership( $group ) ) 1083 $button .= '<a class="request-membership" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_request_membership' ) . '">' . __('Request Membership', 'buddypress') . '</a>'; 1084 else 1085 $button .= '<a class="membership-requested" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>'; 1086 } 1087 break; 1088 1089 case 'hidden': 1090 if ( $group->is_member ) 1091 $button .= '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; 1092 break; 1093 } 1094 1095 $button .= '</div>'; 1096 1097 return apply_filters( 'bp_get_group_join_button', $button ); 1098 } 1093 1099 1094 1100 function bp_group_status_message( $group = false ) { … … 1640 1646 global $bp; 1641 1647 1642 if ( ! function_exists('friends_install') )1648 if ( !bp_is_active( 'friends' ) ) 1643 1649 return false; 1644 1650
Note: See TracChangeset
for help on using the changeset viewer.