Home Forums Plugin Support WP User Frontend Pro Shortcodes in BP-activities.

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  ggsalas 5 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6420

    ggsalas
    Participant
    Post count: 108

    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 http://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.

    #6455

    Tareq Hasan
    Keymaster
    Post count: 2831

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

    #6466

    ggsalas
    Participant
    Post count: 108

    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

    #6491

    ggsalas
    Participant
    Post count: 108

    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 4 posts - 1 through 4 (of 4 total)

The topic ‘Shortcodes in BP-activities.’ is closed to new replies.