• Hello,

    The new buddypress update has made changes to the way activity updates are being displayed see link below
    https://buddypress.trac.wordpress.org/ticket/8052
    https://buddypress.org/2022/11/buddypress-11-0-0-beta2/

    Can you help update this code to work with the new upcoming buddypress 11.0

    /**
     * Change buddypress wpadverts activity display format
     */
    add_filter( "wpadverts_bp_activity_add_params", function( $args, $post_id ) {
        $content = "";
        /** Insert Ad Content */
        $content .= "<br/>". get_the_excerpt( $post_id ) . "<br/>";
        /** Insert Ad Price */    
        $content .= "<b>". adverts_get_the_price( $post_id ) . "</b>";
        /** Insert Ad Image */
        $image_id = adverts_get_main_image_id( $post_id );
        if( $image_id ) {
            $content .= sprintf( '<img src="%s" alt="" /> ', adverts_get_main_image( $post_id ) );
        }
        $args["content"] = $content;
        return $args;
    }, 10 , 2);

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    I am not sure how does this affect WPAdverts BP integration? I read the thread and the changes seem to be for the blog posts only (not custom post types) and only in filters/actions we do not use.

    Thread Starter teeboy4real

    (@teeboy4real)

    The display of the activity is now different from the code you sent for example In the new buddypress 11.0 the featured images in post activity is now a clickable link while images in ads is not clickable, see image below for the differences.

    1. Activity for Post post type – https://ibb.co/fFr78p7
    2. Activity for Advert post type – https://ibb.co/DtR6nCt

    Thanks

    Plugin Author Greg Winiarski

    (@gwin)

    From the threads it looks like the styling is different *only* for the posts, it stays the same for custom post types.

    So the best you could do is make the image in the description clickable by changing the line

    
    $content .= sprintf( '<img src="%s" alt="" /> ', adverts_get_main_image( $post_id ) );
    

    or in other words, the bp_activity_add() function that submits new activity does not seem to have any changes or new params https://codex.buddypress.org/developer/function-examples/bp_activity_add/ that would allow submitting the activity in a different format

    Thread Starter teeboy4real

    (@teeboy4real)

    Thanks for the feedback

    I was hoping for a uniform design with the advert styling to be the same as the new post styling. What do I change the code into to make it clickable

    Thanks

    Thread Starter teeboy4real

    (@teeboy4real)

    I have added a comment hopefully a resolution can be provided https://buddypress.trac.wordpress.org/ticket/8052#comment:24

    Thread Starter teeboy4real

    (@teeboy4real)

    Hi Greg,

    A new ticket has been created at https://buddypress.trac.wordpress.org/ticket/8779

    Plugin Author Greg Winiarski

    (@gwin)

    Once a unified layout for all activities will be implemented in BB it should change automatically.

    Until then nothing else can be done since it is unknown if the unified layout will have any changes to the bp_activity_add() function or not.

    Thread Starter teeboy4real

    (@teeboy4real)

    Hi Greg

    For now how can I make the image to be a clickable link. you said this needs to be changed ($content .= sprintf( ‘ ‘, adverts_get_main_image( $post_id ) ); )

    but im not good at coding

    Thanks

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    you can do that by changing the line

    
    $content .= sprintf( '<img src="%s" alt="" /> ', adverts_get_main_image( $post_id ) );
    

    to

    
    $url_img = adverts_get_main_image( $post_id );
    $url_ad = get_permalink( $post_id );
    $content .= sprintf( '<a href="%s"><img src="%s" alt="" /></a>', $url_ad, $url_img );
    
    Thread Starter teeboy4real

    (@teeboy4real)

    Thank you so much sir, im really grateful

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Buddypress update’ is closed to new replies.