Shortcodes in BP-activities.

This topic contains 3 reply and 2 voices, and was last updated by ggsalas 10 years, 8 months ago
Viewing 3 Posts - 1 through 3 (of 3 total)
Author Posts
July 29, 2013 at 6:25 pm 6420
ggsalas Hi @Tareq, I have used the code that you sent to me to insert custom fields in BP-activities, and have a problem: the sortcodes not work. I have consulted for this and I have a solution ( with do_shortcode($content)) but not work well:
function wpufe_modify_bp_activity( $post_id ) {
    global $wpdb, $user_ID;
 
    //get the last inserted activity
    $activity = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}bp_activity WHERE secondary_item_id = $post_id AND user_id = $user_ID");
 
    // if activity found, update the activity with custom field
    if ( $activity ) {
        $content = $activity->content . '... Custom Field: ' . get_post_meta( $post_id, 'custom_field', true );
 
        $wpdb->update(
            $wpdb->prefix . 'bp_activity',
            array( 'content' => do_shortcode($content) ),
            array( 'id' => $activity->id )
        );
    }
}
 
add_action( 'wpuf_add_post_after_insert', 'wpufe_modify_bp_activity' );
Do you know what's can be happening? The problem is that the videos not appear and the galleries not shows the images uploads Mi site is www.redminka.com The activities are in http://www.redminka.com/actividad Form to create gallery post: http://www.redminka.com/post-img/ Form to create video post: http://www.redminka.com/post-vide/ Thanks.
July 30, 2013 at 3:45 pm 6455
Tareq Hasan Tareq Hasan

What happens when you create a gallery from wp-admin? Does it works well?

July 30, 2013 at 6:25 pm 6466
ggsalas ggsalas

Hi @Tareq,

I do a normal post with a gallery, without any custom-field, and the gallery not appears in buddypress activity.

Normal post: http://www.redminka.com/gabriel/2013/07/normal-post-with-gallery/
BP. activity: http://www.redminka.com/actividad/#activity-483

If I do a normal post with a video, works well in WP and not work in BP activity:

Normal post: http://www.redminka.com/gabriel/2013/07/normal-post-with-video/
BP. activity: http://www.redminka.com/actividad/#activity-484

July 30, 2013 at 11:43 pm 6491
ggsalas ggsalas

Hi @Tareq,

If I return one variable the video shortcode works in BP activity:

This Works:


$content =  get_post_meta($post_id, 'url_video', true);

This not works:


$content =  get_post_meta($post_id, 'url_video', true) . get_post_meta( $post_id, 'txt_link', true )

Thanks!

Viewing 3 Posts - 1 through 3 (of 3 total)