Changeset 4961 for trunk/bp-groups/bp-groups-classes.php
- Timestamp:
- 08/10/2011 06:32:02 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-classes.php
r4907 r4961 294 294 if ( is_array( $include ) ) 295 295 $include = implode( ',', $include ); 296 296 297 297 $include = $wpdb->escape( $include ); 298 298 $sql['include'] = " AND g.id IN ({$include})"; … … 302 302 if ( is_array( $exclude ) ) 303 303 $exclude = implode( ',', $exclude ); 304 304 305 305 $exclude = $wpdb->escape( $exclude ); 306 306 $sql['exclude'] = " AND g.id NOT IN ({$exclude})"; … … 598 598 return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) ); 599 599 } 600 601 600 601 602 602 /** 603 603 * Get a total count of all topics of a given status, across groups/forums … … 611 611 function get_global_topic_count( $status = 'public', $search_terms = false ) { 612 612 global $bbdb, $wpdb, $bp; 613 613 614 614 switch ( $status ) { 615 615 case 'all' : 616 616 $status_sql = ''; 617 617 break; 618 618 619 619 case 'hidden' : 620 620 $status_sql = $wpdb->prepare( "AND g.status = 'hidden'" ); 621 621 break; 622 622 623 623 case 'private' : 624 624 $status_sql = $wpdb->prepare( "AND g.status = 'private'" ); 625 625 break; 626 626 627 627 case 'public' : 628 628 default : … … 630 630 break; 631 631 } 632 632 633 633 $sql = array(); 634 634 635 635 $sql['select'] = "SELECT COUNT(t.topic_id)"; 636 636 637 637 $sql['from'] = "FROM {$bbdb->topics} AS t INNER JOIN {$bp->groups->table_name_groupmeta} AS gm ON t.forum_id = gm.meta_value INNER JOIN {$bp->groups->table_name} AS g ON gm.group_id = g.id"; 638 638 639 639 $sql['where'] = "WHERE gm.meta_key = 'forum_id' {$status_sql} AND t.topic_status = '0' AND t.topic_sticky != '2'"; 640 640 641 641 if ( $search_terms ) { 642 642 $st = like_escape( $search_terms ); 643 643 $sql['where'] .= " AND ( t.topic_title LIKE '%{$st}%' )"; 644 644 } 645 645 646 646 return $wpdb->get_var( implode( ' ', $sql ) ); 647 647 } … … 667 667 $this->__construct($user_id,$group_id,$id,$populate); 668 668 } 669 669 670 670 function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) { 671 671 if ( $user_id && $group_id && !$id ) { … … 772 772 function ban() { 773 773 global $bp; 774 774 775 775 if ( $this->is_admin ) 776 776 return false; … … 790 790 function unban() { 791 791 global $bp; 792 792 793 793 if ( $this->is_admin ) 794 794 return false; … … 804 804 function accept_invite() { 805 805 global $bp; 806 806 807 807 $this->inviter_id = 0; 808 808 $this->is_confirmed = 1; … … 814 814 function accept_request() { 815 815 global $bp; 816 816 817 817 $this->is_confirmed = 1; 818 818 $this->date_modified = bp_core_current_time(); … … 958 958 if ( !$user_id ) 959 959 return false; 960 960 961 961 $sql = "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0"; 962 962 963 963 if ( 'sent' == $type ) 964 964 $sql .= " AND invite_sent = 1"; … … 1215 1215 function _register() { 1216 1216 global $bp; 1217 1217 1218 1218 if ( !empty( $this->enable_create_step ) ) { 1219 1219 // Insert the group creation step for the new group extension … … 1245 1245 add_action( $this->display_hook, array( &$this, 'widget_display' ) ); 1246 1246 } 1247 1247 1248 1248 // Construct the admin edit tab for the new group extension 1249 1249 if ( !empty( $this->enable_edit_item ) && !empty( $bp->is_item_admin ) ) {
Note: See TracChangeset
for help on using the changeset viewer.