printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>','buddypress'),bp_get_root_domain().'/'.bp_get_activity_root_slug().'/p/'.$item['id'].'/',date_i18n(get_option('date_format'),strtotime($item['date_recorded'])),date_i18n(get_option('time_format'),strtotime($item['date_recorded'])));
printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>','buddypress'),bp_get_root_domain().'/'.bp_get_activity_root_slug().'/p/'.$item['id'].'/',get_date_from_gmt($item['date_recorded'],get_option('date_format')),get_date_from_gmt($item['date_recorded'],get_option('time_format')));
$activities=$wpdb->get_results(apply_filters('bp_activity_get_user_join_filter',"{$select_sql}{$from_sql}{$where_sql} ORDER BY a.date_recorded {$sort}{$pag_sql}",$select_sql,$from_sql,$where_sql,$sort,$pag_sql));
$activities=$wpdb->get_results(apply_filters('bp_activity_get_user_join_filter',"{$select_sql}{$from_sql}{$join_sql}{$where_sql} ORDER BY a.date_recorded {$sort}{$pag_sql}",$select_sql,$from_sql,$where_sql,$sort,$pag_sql));
}else{
$activities=$wpdb->get_results(apply_filters('bp_activity_get_user_join_filter',"{$select_sql}{$from_sql}{$where_sql} ORDER BY a.date_recorded {$sort}",$select_sql,$from_sql,$where_sql,$sort));
$activities=$wpdb->get_results(apply_filters('bp_activity_get_user_join_filter',"{$select_sql}{$from_sql}{$join_sql}{$where_sql} ORDER BY a.date_recorded {$sort}",$select_sql,$from_sql,$where_sql,$sort));
}
$total_activities_sql=apply_filters('bp_activity_total_activities_sql',"SELECT count(a.id) FROM {$bp->activity->table_name} a {$index_hint_sql}{$where_sql} ORDER BY a.date_recorded {$sort}",$where_sql,$sort);
$total_activities_sql=apply_filters('bp_activity_total_activities_sql',"SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$index_hint_sql}{$join_sql}{$where_sql} ORDER BY a.date_recorded {$sort}",$where_sql,$sort);
if($names=$wpdb->get_results("SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})")){
return$wpdb->query("DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})");
}
...
...
@@ -556,10 +614,14 @@ class BP_Activity_Activity {
return$wpdb->get_results($wpdb->prepare("SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d",$parent_id));
}
/**
* Fetch a list of all components that have activity items recorded
*
* @return array
*/
functionget_recorded_components(){
global$wpdb,$bp;
return$wpdb->get_col($wpdb->prepare("SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC"));
return$wpdb->get_col("SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC");
}
functionget_sitewide_items_for_feed($limit=35){
...
...
@@ -668,3 +730,285 @@ class BP_Activity_Activity {
return$wpdb->get_var($wpdb->prepare("UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d",$user_id));
}
}
/**
* Create a RSS feed using the activity component.
*
* You should only construct a new feed when you've validated that you're on
* the appropriate screen.
*
* See {@link bp_activity_action_sitewide_feed()} as an example.
*
* Accepted parameters:
* id - internal id for the feed; should be alphanumeric only
* (required)
* title - RSS feed title
* link - Relevant link for the RSS feed
* description - RSS feed description
* ttl - Time-to-live (see inline doc in constructor)
* update_period - Part of the syndication module (see inline doc in
* constructor for more info)
* update_frequency - Part of the syndication module (see inline doc in
* constructor for more info)
* max - Number of feed items to display
* activity_args - Arguments passed to {@link bp_has_activities()}
*
* @since BuddyPress (1.8)
*/
classBP_Activity_Feed{
/**
* Holds our custom class properties.
*
* These variables are stored in a protected array that is magically
* updated using PHP 5.2+ methods.
*
* @see BP_Feed::__construct() This is where $data is added
* @var array
*/
protected$data;
/**
* Magic method for checking the existence of a certain data variable.