More title: it's showing only the bp_activity.content.
I have a site running WordPress 3.2.1 and BuddyPress 1.5.1. Custom theme I inherited. In BP 1.2.8, the activity stream was showing the action properly. I have customized the action to be in a different format. Right now, the only thing that appears on the {username}/activity tab is the avatar, and the space where the action should be shown, was showing. It is looping through all the activity, and outputting a div for each, but there is no "action" shown.
When I activate the BP Default theme, the activity action is shown properly.
I'd like to work with someone to troubleshoot and resolve this issue. Thank you.
Francisco Javier Carazo Gil answers:
Hi Chris,
I have been working with BuddyPress for a year.
Can you paste how you have changed the action?
Chris Hajer comments:
// bug 794, record custom post type activity
function tc_cpt_activity($post_id, $post, $user_id = false) {
global $bp, $wpdb;
$cpts = array('news', 'volunteering', 'freecycle', 'jobs', 'buy-sell', 'recommendations', 'housing');
$post_id = (int)$post_id;
$blog_id = (int)$wpdb->blogid;
if (!$user_id)
$user_id = (int)$post->post_author;
/* This is to stop infinite loops with Donncha's sitewide tags plugin
/ commented out since we're not using that plugin
if ((int)$bp->site_options['tags_blog_id'] == (int)$blog_id)
return false; */
/* Don't record this if it's not is our array of custom post types */
if (!in_array($post->post_type, $cpts))
return false;
if ('publish' == $post->post_status && '' == $post->post_password) {
/* Record this in activity streams */
$post_permalink = get_permalink($post_id);
$cpt_url = tc_cpt_url($post->post_type);
$obj = get_post_type_object($post->post_type);
$activity_action = sprintf(__('%s posted %s under %s', 'buddypress'), bp_core_get_userlink((int)$post->post_author), '<a title="' . $post->post_title . '" href="' . $post_permalink . '">' . $post->post_title . '</a>', '<a title="View all ' . $obj->labels->name . '" href="' . $cpt_url . '">' . $obj->labels->name . '</a>');
$activity_content = $post->post_content;
bp_blogs_record_activity(array(
'user_id' => (int)$post->post_author,
'action' => apply_filters('bp_blogs_activity_new_post_action', $activity_action, &$post, $post_permalink),
'content' => apply_filters('bp_blogs_activity_new_post_content', $activity_content, &$post, $post_permalink),
'primary_link' => apply_filters('bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id),
'type' => 'new_blog_post',
'item_id' => $blog_id,
'secondary_item_id' => $post_id,
'recorded_time' => $post->post_date_gmt
));
} else
bp_blogs_remove_post($post_id, $blog_id);
bp_blogs_update_blogmeta($blog_id, 'last_activity', bp_core_current_time());
do_action('bp_blogs_new_blog_post', $post_id, $post, $user_id);
}
add_action('save_post', 'tc_cpt_activity', 10, 2);
That is the function that saves the action. The database stores the action properly. It's just not being output by the theme.
Thanks for your reply.
Chris Hajer comments:
Also, to be clear, I only change the format of the action for custom post type activity. I do not change the action for these types of activity:
joined_group
created_group
new_avatar
activity_update
activity_comment
new_calendar_event (I'm using the BP Group Calendar plugin)
I don't see the bp_activity.action for any type of activity, not just CPT. Thank you.
Francisco Javier Carazo Gil comments:
Chris,
I have been seeing your code and I see everything OK.
Have you set WP_DEBUG true? You can do the next 5 ways to debug WordPress:
1. define( 'WP_DEBUG', true ); // in wp-config.php
2. define( 'SCRIPT_DEBUG', true ); // in wp-config.php
3. define( 'SAVEQUERIES', true ); // in wp-config.php to save what queries are exectuted
4. add_action( 'all', create_function( '', 'var_dump( current_filter() );' ) ); // in functions.php to see how many hooks get executed on every page load
5. http://wordpress.org/extend/plugins/core-control/ // this plugin to control core WP
Chris Hajer comments:
I have added the three defines to wp-config.php and the one function to my theme's functions.php. I did not install the core control plugin yet.
What output can I share with you to help debug this?
Here is a page on the website so you can see what's going on right now:
http://townconnection.com/rockford-illinois/neighbors/chrishajer/activity/
Thank you.
Francisco Javier Carazo Gil comments:
Chris,
If no errors appear, try to put "show_errors = true" in php.ini and then reload the service of the http daemon.
Francisco Javier Carazo Gil comments:
Chris,
Sorry, the correct parameter is "display_errors = true" and you also should set "error_reporting = E_ALL & ~E_DEPRECATED".
Francisco Javier Carazo Gil comments:
Chris,
Sorry, the correct parameter is "display_errors = true" and you also should set "error_reporting = E_ALL & ~E_DEPRECATED".
Chris Hajer comments:
There are lots of warnings and notices. I am on a shared host, so I can't restart HTTPD. But I think the output is sufficient already. Warnings and noticed are displayed. Do we need more?
Francisco Javier Carazo Gil comments:
Chris,
Send me via PM all notice and warnings please.
Chris Hajer comments:
PM sent. Please let me know if you need more information.