Changeset 580 for trunk/bp-groups/bp-groups-templatetags.php
- Timestamp:
- 11/26/2008 10:49:51 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-groups/bp-groups-templatetags.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-templatetags.php
r570 r580 14 14 var $total_group_count; 15 15 16 var $single_group = false; 17 16 18 var $sort_by; 17 19 var $order; … … 29 31 30 32 $this->groups = groups_get_user_groups( $this->pag_num, $this->pag_page ); 31 $this->total_group_count = (int)$this->groups[' count'];33 $this->total_group_count = (int)$this->groups['total']; 32 34 $this->groups = $this->groups['groups']; 33 35 $this->group_count = count($this->groups); … … 36 38 37 39 $this->groups = groups_filter_user_groups( $_REQUEST['group-filter-box'], $this->pag_num, $this->pag_page ); 38 $this->total_group_count = (int)$this->groups[' count'];40 $this->total_group_count = (int)$this->groups['total']; 39 41 $this->groups = $this->groups['groups']; 40 42 $this->group_count = count($this->groups); … … 43 45 44 46 $this->groups = groups_search_groups( $_REQUEST['groupfinder-search-box'], $this->pag_num, $this->pag_page ); 45 $this->total_group_count = (int)$this->groups[' count'];47 $this->total_group_count = (int)$this->groups['total']; 46 48 $this->groups = $this->groups['groups']; 47 49 $this->group_count = count($this->groups); … … 60 62 if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] != '' ) { 61 63 $this->groups = groups_search_groups( $_REQUEST['s'], $this->pag_num, $this->pag_page, $this->sort_by, $this->order ); 62 $this->total_group_count = (int)$this->groups[' count'];64 $this->total_group_count = (int)$this->groups['total']; 63 65 $this->groups = $this->groups['groups']; 64 66 $this->group_count = count($this->groups); 65 67 } else { 66 $this->groups = BP_Groups_Group::get_all( false, $this->pag_num, $this->pag_page, $this->sort_by, $this->order, true );68 $this->groups = BP_Groups_Group::get_all( $this->pag_num, $this->pag_page, false, $this->sort_by, $this->order, true ); 67 69 $this->total_group_count = count(BP_Groups_Group::get_all( false )); // TODO: not ideal 68 70 $this->group_count = count($this->groups); … … 70 72 71 73 } else if ( $group_slug ) { 72 73 $this->groups = array( new BP_Groups_Group( BP_Groups_Group::get_id_from_slug($group_slug), true ) ); 74 $this->single_group = true; 75 76 $group = new stdClass(); 77 $group->group_id = BP_Groups_Group::get_id_from_slug($group_slug); 78 79 $this->groups = array( $group ); 74 80 $this->total_group_count = 1; 75 81 $this->group_count = 1; … … 100 106 $this->group = $this->groups[$this->current_group]; 101 107 108 // If this is a single group then instantiate group meta when creating the object. 109 if ( $this->single_group ) 110 $this->group = new BP_Groups_Group( $this->group->group_id, true ); 111 else 112 $this->group = new BP_Groups_Group( $this->group->group_id, false ); 113 102 114 return $this->group; 103 115 } … … 212 224 } 213 225 214 function bp_group_last_active( ) {226 function bp_group_last_active( $echo = true ) { 215 227 global $groups_template; 216 228 … … 220 232 _e( 'not yet active', 'buddypress' ); 221 233 else 222 echo bp_core_time_since( groups_get_groupmeta( $groups_template->group->id, 'last_activity' ));234 echo bp_core_time_since( $last_active ); 223 235 } 224 236 … … 530 542 <?php } else { ?> 531 543 <div id="message" class="info"> 532 < ?php _e( 'This group has no administrators', 'buddypress' ); ?>544 <p><?php _e( 'This group has no administrators', 'buddypress' ); ?></p> 533 545 </div> 534 546 <?php } … … 643 655 } 644 656 645 function bp_group_has_requested_membership( ) {657 function bp_group_has_requested_membership( $group = false ) { 646 658 global $bp, $groups_template; 647 659 648 if ( groups_check_for_membership_request( $bp['loggedin_userid'], $groups_template->group->id ) ) 660 if ( !$group ) 661 $group = $groups_template->group; 662 663 if ( groups_check_for_membership_request( $bp['loggedin_userid'], $group->id ) ) 649 664 return true; 650 665 … … 889 904 ?> 890 905 <div class="left-menu"> 891 <h4> Select Friends<img id="ajax-loader" src="<?php echo $bp['groups']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></h4>906 <h4><?php _e( 'Select Friends', 'buddypress' ) ?> <img id="ajax-loader" src="<?php echo $bp['groups']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></h4> 892 907 <?php bp_group_list_invite_friends() ?> 893 908 <?php if ( function_exists('wp_nonce_field') ) … … 930 945 } 931 946 932 function bp_group_join_button( ) {947 function bp_group_join_button( $group = false ) { 933 948 global $bp, $groups_template; 934 949 935 if ( !is_user_logged_in() || BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $groups_template->group->id ) || groups_is_user_banned( $bp['loggedin_userid'], $groups_template->group->id ) ) 950 if ( !$group ) 951 $group =& $groups_template->group; 952 953 // If they're not logged in or are banned from the group, no join button. 954 if ( !is_user_logged_in() || groups_is_user_banned( $bp['loggedin_userid'], $group->id ) ) 936 955 return false; 937 938 switch ( $groups_template->group->status ) { 956 957 echo '<div class="group-button ' . $group->status . '" id="groupbutton-' . $group->id . '">'; 958 959 switch ( $group->status ) { 939 960 case 'public': 940 echo '<a class="join-group" href="' . bp_group_permalink( false, false ) . '/join">' . __('Join Group', 'buddypress') . '</a>'; 961 if ( BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $group->id ) ) 962 echo '<a class="leave-group" href="' . bp_group_permalink( $group, false ) . '/leave-group">' . __('Leave Group', 'buddypress') . '</a>'; 963 else 964 echo '<a class="join-group" href="' . bp_group_permalink( $group, false ) . '/join">' . __('Join Group', 'buddypress') . '</a>'; 941 965 break; 942 966 943 967 case 'private': 944 if ( !bp_group_has_requested_membership() ) 945 echo '<a class="request-membership" href="' . bp_group_permalink( false, false ) . '/request-membership">' . __('Request Membership', 'buddypress') . '</a>'; 946 else 947 echo 'Membership Requested'; 968 if ( BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $group->id ) ) { 969 echo '<a class="leave-group" href="' . bp_group_permalink( $group, false ) . '/leave-group">' . __('Leave Group', 'buddypress') . '</a>'; 970 } else { 971 if ( !bp_group_has_requested_membership( $group ) ) 972 echo '<a class="request-membership" href="' . bp_group_permalink( $group, false ) . '/request-membership">' . __('Request Membership', 'buddypress') . '</a>'; 973 else 974 echo '<a class="membership-requested" href="' . bp_group_permalink( $group, false ) . '">' . __('Membership Requested', 'buddypress') . '</a>'; 975 } 948 976 break; 949 977 } 978 979 echo '</div>'; 950 980 } 951 981
Note: See TracChangeset
for help on using the changeset viewer.