[buddypress-trac] [BuddyPress] #3460: Support custom post types in activity stream
buddypress-trac
noreply at wordpress.org
Mon Jun 17 16:02:39 UTC 2013
#3460: Support custom post types in activity stream
--------------------------+---------------------------
Reporter: boonebgorges | Owner: boonebgorges
Type: enhancement | Status: new
Priority: low | Milestone: 1.9
Component: Activity | Version: 1.2.8
Severity: normal | Resolution:
Keywords: |
--------------------------+---------------------------
Comment (by trishasalas):
I have the custom post types added to the Activity Filter dropdown menu.
The original menu items are currently still hard-coded. I believe that
will require a separate function and will work on that as well. I am
posting now as I have the items I want to exclude from `type` hard coded
into the sql query. I tried a regex and `NOT LIKE` but wasn't able to get
close enough...thought someone might have a more elegant solution.
Here is my function:
{{{
function bp_get_activity_filter_links( $args = false ) {
global $wpdb;
global $bp;
// Fetch the names of components that have activity
recorded in the DB
$add_cpts = $wpdb->get_col( "SELECT DISTINCT type FROM
{$bp->activity->table_name} WHERE type != 'activity_update'
AND `type` != 'new_blog_post' AND `type` != 'joined_group' AND
`type` != 'Post'", 0);
if ( empty( $add_cpts ) )
return false;
foreach ( $add_cpts as $add_cpt ) {
echo '<option value=' . $add_cpt . '>' . $add_cpt
. '</option>';
}
}
}}}
You can see a working example here: http://trishacod.es/activity/
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3460#comment:35>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list