Skip to:
Content
Pages
Categories
Search
Top
Bottom

Why are my blog post updates missing paragraph breaks when shown in the activity stream?


  • Tatiana
    Participant

    @svetka812

    I have a community of poets and so most of their posts are poetry, as you could imagine.

    The written poem
    goes by lines
    of a certain length,
    and breaks often.

    Again, back to the activity stream, it presents posts (poems) in a horrible unreadable fashion – a paragraph of the one single line where everything is smashed together (excerpts).
    I wish there was an option in settings to choose between a whole post or an excerpts on the activity page, as it is given in the wordpress reading settings:

    “For each article in a feed, show
    o Full text
    o Summary”

    If anybody can tell me what and where to change in codes to fix it, I would really appreciate.

    http://svetkidoma.net/activity (it is all in Russian, sorry, but you will get a picture)

    Roger Coathup said:

    “I don’t have a problem with paragraph breaks in the activity stream. My blog posts are being shown correctly with the breaks. I’m using a default installation of BP1.2.5.2

    Paragraphs can be removed by a filter in WordPress / BuddyPress. Have you made any changes to your functions.php or bp-custom.php to turn off the ‘autop’ filter? i.e. do you have any code like this in those files:

    add_action(“init”,”remove_autop_filters_from_activity”);
    function remove_autop_filters_from_activity(){
    remove_filter( ‘bp_get_activity_content_body’, ‘wpautop’ );
    remove_filter( ‘bp_get_activity_content’, ‘wpautop’ );
    }

    Perhaps there is something in the blog template you are using that is doing this?”

Viewing 12 replies - 1 through 12 (of 12 total)

  • Tatiana
    Participant

    @svetka812

    From my observation, if the post is small, it gets into the activity stream as whole, with no change in layout. But if it was longer then some limit, it gets converted into an excerpt.


    r-a-y
    Keymaster

    @r-a-y


    Roger Coathup
    Participant

    @rogercoathup

    @r-a-y: I’m not sure this fix will work for Tatiana. I think she’s wanting to show the whole post (rather than the excerpt) in the activity stream, and make sure that formatting (paragraph breaks) is maintained. The posts are are poems, and many have an image at the top.

    Her problem, is that posts over a certain length are automatically shown just as text excerpts, with all the breaks gone (although a thumbnail image is still preserved.. see other thread).

    Using the excerpt would, without removing filters, lose the images and the paragraph breaks.


    r-a-y
    Keymaster

    @r-a-y

    Notice how I’m linking to a specific post in the thread, rather than the beginning?

    The post I’m linking to should allow you to override the BP-truncated excerpt with the original content.
    I’ve updated the post above with a direct link to the code I’m referring to.

    Add the snippet to your theme’s functions.php.


    Roger Coathup
    Participant

    @rogercoathup

    @r-a-y: will give you that one! :-)


    Tatiana
    Participant

    @svetka812

    Thank you guys! I will try it and let you know.

    Roger, I don’t mind the posts to be shown like it is set by choice on the main page of WP – to the latest posts thread – up to the “more” tag were the author put it (or that could be inserted there later by code), but as long as paragraphs and breaks stay in place!

    And I don’t mind picture in the activity stream to be re-sized to a thumbnail, (but not the other way – enlarged to a 100 in height(!)).
    The WP troubles me the same way, when showing category archives or search results – with no breaks, no paragraphs, no illustration (I can deal with no picture, but code in place of it is too much!)

    I’ll try it and get back to you soon.

    Thank you!


    Tatiana
    Participant

    @svetka812

    well… I added the code to the functions.php in bp default theme…(I use 1.2.5.2 ) …nothing happened. Where this function will be called? maybe it should replace something, not to be just added? is there a specific spot in the functions.php where to put it? I place it here, in between these two, that were mentioning the activity stream:

    /* Hijack the saving of page on front setting to save the activity stream setting */
    function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
    if ( !is_admin() || !is_site_admin() )
    return false;

    if ( ‘activity’ == $_POST )
    return ‘activity’;
    else
    return $oldvalue;
    }
    add_action( ‘pre_update_option_page_on_front’, ‘bp_dtheme_page_on_front_update’, 10, 2 );

    /* added function */

    function my_bp_blogs_record_activity_content( $bp_excerpt, $content ) {
    return $content;
    }
    add_filter( ‘bp_blogs_record_activity_content’, ‘my_bp_blogs_record_activity_content’, 1, 2 );

    /* Load the activity stream template if settings allow */
    function bp_dtheme_page_on_front_template( $template ) {
    global $wp_query;

    if ( empty( $wp_query->post->ID ) )
    return locate_template( array( ‘activity/index.php’ ), false );
    else
    return $template;
    }
    add_filter( ‘page_template’, ‘bp_dtheme_page_on_front_template’ );

    Sorry for being such a dummy, I am not a pro, just an end user..


    r-a-y
    Keymaster

    @r-a-y

    I forgot to mention that this won’t fix existing blog posts in the activity stream.
    See if new posts work.

    FYI, if you’re going to be making changes to the bp-default theme, it’s better to create a child theme:
    https://codex.buddypress.org/how-to-guides/building-a-buddypress-child-theme/


    Tatiana
    Participant

    @svetka812

    It didn’t, It wouldn’t even post a new post. Gave me two lines of an error message – something about can not do with a header that was already something.


    r-a-y
    Keymaster

    @r-a-y

    Ahh, I understand why it doesn’t work right now.
    It’s because BuddyPress 1.2.6 hasn’t been released yet with the updated patch.

    If you can’t wait for BP 1.2.6, make the following change:
    https://trac.buddypress.org/changeset/3132

    Sounds like ‘headers already sent’ error. check your closing or opening PHP tags there mustn’t be a carriage return after you close php, no extra lines added that qualify as browser output .


    Tatiana
    Participant

    @svetka812

    I guess, my best choice here is to wait for the 1.2.6 and pray :)

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Why are my blog post updates missing paragraph breaks when shown in the activity stream?’ is closed to new replies.
Skip to toolbar