Changeset 3373 for trunk/bp-activity/bp-activity-classes.php
- Timestamp:
- 11/07/2010 11:33:21 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-classes.php
r3369 r3373 71 71 $this->primary_link = $bp->loggedin_user->domain; 72 72 73 / * If we have an existing ID, update the activity item, otherwise insert it. */73 // If we have an existing ID, update the activity item, otherwise insert it. 74 74 if ( $this->id ) 75 75 $q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = %s, item_id = %s, secondary_item_id = %s, hide_sitewide = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->id ); … … 87 87 } 88 88 89 / * Static Functions */90 91 function get( $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $search_terms = false, $filter = false, $display_comments = false, $show_hidden = false ) {92 global $wpdb, $bp; 93 94 / * Select conditions */89 // Static Functions 90 91 function get( $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $search_terms = false, $filter = false, $display_comments = false, $show_hidden = false, $exclude = false ) { 92 global $wpdb, $bp; 93 94 // Select conditions 95 95 $select_sql = "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name"; 96 96 97 97 $from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID"; 98 98 99 / * Where conditions */99 // Where conditions 100 100 $where_conditions = array(); 101 101 102 / * Searching */102 // Searching 103 103 if ( $search_terms ) { 104 104 $search_terms = $wpdb->escape( $search_terms ); … … 106 106 } 107 107 108 / * Filtering */108 // Filtering 109 109 if ( $filter && $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ) ) 110 110 $where_conditions['filter_sql'] = $filter_sql; 111 111 112 / * Sorting */112 // Sorting 113 113 if ( $sort != 'ASC' && $sort != 'DESC' ) 114 114 $sort = 'DESC'; 115 115 116 / * Hide Hidden Items? */116 // Hide Hidden Items? 117 117 if ( !$show_hidden ) 118 118 $where_conditions['hidden_sql'] = "a.hide_sitewide = 0"; 119 119 120 /* Alter the query based on whether we want to show activity item comments in the stream like normal comments or threaded below the activity */ 120 // Exclude specified items 121 if ( $exclude ) 122 $where_conditions['exclude'] = "a.id NOT IN ({$exclude})"; 123 124 // Alter the query based on whether we want to show activity item comments in the stream like normal comments or threaded below the activity 121 125 if ( !$display_comments || 'threaded' == $display_comments ) { 122 126 $where_conditions[] = "a.type != 'activity_comment'"; … … 134 138 $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(a.id) FROM {$bp->activity->table_name} a {$where_sql} ORDER BY a.date_recorded {$sort}" ) ); 135 139 136 / * Get the fullnames of users so we don't have to query in the loop */140 // Get the fullnames of users so we don't have to query in the loop 137 141 if ( bp_is_active( 'xprofile' ) && $activities ) { 138 142 foreach ( (array)$activities as $activity ) { … … 161 165 $activities = BP_Activity_Activity::append_comments( &$activities ); 162 166 163 / * If $max is set, only return up to the max results */167 // If $max is set, only return up to the max results 164 168 if ( !empty( $max ) ) { 165 169 if ( (int)$total_activities > (int)$max ) … … 194 198 $activities = BP_Activity_Activity::append_comments( $activities ); 195 199 196 / * If $max is set, only return up to the max results */200 // If $max is set, only return up to the max results 197 201 if ( !empty( $max ) ) { 198 202 if ( (int)$total_activities > (int)$max )
Note: See TracChangeset
for help on using the changeset viewer.