Wrong post titles shown in Live Stream Widget

Hi,

We are using Live Stream Widget on the front page of our new blogging network to show the latest activity in the network. It has been live for a couple of days, but today I suddenly notice that the post titles mentioned in some of the updates are wrong. I have made some minor changes to the plugin (included post/comment content), but even if I revert to the original code, the bug persists.

Example:

This could be an update shown in the widget:

"John Doe commented on How to Ride a Bike on The Football Blog."

However, the correct title of the post John Doe has commented on would be 'This Week's Best matches', and 'How to Ride a Bike' would be the name of a post on 'The Cycling Blog' published half a year ago.

In other words: The post title shown in Live Stream Widget seems to be from a completely random blog post in the network. Not related to either the user who comment nor the owner of the blog.

I know that some bloggers in the network have imported posts from their old blogs. Could that be the reason of this bug, and do you have any ideas of how to fix it?

Kinds regards,

Mathias Hoffmann

  • Paul

    @Bloggerslounge, Under a Multisite environment Live Stream pulls the data from the Post Indexer and Comment Indexer tables. The flow is something like this:

    1. You have 21 blogs.
    2. You have the plugins Post Indexer and Comment Indexer installed and activated.
    3. When someone published or comments on a post in one of the blogs there is a trigger sent to either the Post Indexer or Comment Indexer plugins to harvest the information and write a record to their respective database tables.
    4. Then Live Stream simply queries these database tables populated by Post Indexer and Comment Indexer.

    so we need to figure out where the issue is. It could very well be within the Live Stream widget. But more likely something to do with a Post/Comment made and then changed and the update not making it into the Comment Indexer tables.

    So do this you will need to get into phpMyAdmin or some tool to access your database. The Post Indexer plugin creates 3 database tables wp_site_posts, wp_site_terms and wp_site_term_relationships. The Comment Indexer creates one table wp_site_comments.

    For comments I know there is a JOIN in the SQL query. This is needed because the wp_site_comments does not store the Post title for which the comment is related. So that might be a good place to start.

    Let me know.

  • Bloggerslounge

    Hi Paul,

    Thank you for your elaborate reply.

    The problem only seems to appear for comments, but it is not consistent. It only happens for about half of the comment-notifications in Live Stream.

    I've checked the content of the wp_site_comments table and all content and references are correct.

    The "random" post title do however come from a post with the same post_id as the post title that are supposed to be shown.

  • Paul

    @Bloggerslounge, sorry no I don't have an idea on why this is happening on your system. I've tested the widget on half a dozen of my own sites back a few months ago thought with far less real data than what you have in your databases I'm sure.

    Maybe the clue to a solution in in your line

    The "random" post title do however come from a post with the same post_id as the post title that are supposed to be shown.

    I'm really not sure I follow what you wrote. So you ARE finding these random (incorrect) titles? In what table? Are these in the wp_site_posts?

    As I mentioned in my initial long reply when Live Stream does the query for comments this contains the post_id field. So in order to show the post title for the related comment the wp_site_posts post item is pulled into the query via a SQL JOIN. There should be only one entry in the wp_site_posts table for the unique post_id.

  • Paul

    Also, going back to your first example of the issue in your initial post I need some specific details from your system.

    Following the example you initially provided or really any recent example you can determine.

    "John Doe commented on How to Ride a Bike on The Football Blog."

    However, the correct title of the post John Doe has commented on would be 'This Week's Best matches', and 'How to Ride a Bike' would be the name of a post on 'The Cycling Blog' published half a year ago.

    In the wp_site_comments what is the value of the 'comment_id' field? This should match the WordPress wp_comments table record to the comment_ID fields.

    For the same record in wp_site_comments what is the comment_post_id value. This is the ID of the related post of the comment. Does it relate to the correct row in the wp_site_posts table and the WordPress wp_posts table? If not what is different.

  • Paul

    @Bloggerslounge, yeah that would be my guess. Seems like there is just old data in the wp_site_posts table. Again, Live Stream really just pulls from that table data and is not responsible for harvesting or syncing that data. So really the issue lay with Post Indexer. As far as I know there is no method in the current Post Indexer to force a re-sync of data.

    I know the developer is working to release a cool new version but not sure when this will be released.

    So maybe start with this thought. And sorry this is going to be manual. Take a look at your wp_posts table. what is the oldest record there? Now compare that in the wp_site_posts table. Do you have older entries? Older than the oldest post from wp_posts? Is so then those probably need to be removed.

  • Bloggerslounge

    Seems to be working fine.

    But, I've just discovered another minor bug: The number of items shown, are twice the parameter set in "Maximum items to show."

    And on another note. Have you thought about implementing the possibilty to show X characters of the actual comment/post in the widget?

    As of now, I have hard coded this feature into live-stream.php, but on a very selfish level, it would make the job of applying future updates of the widget much easier for my part, if the functionality was included in the standard widget :slight_smile:

    And now that I'm at it, I also have an idea for another new feature, that would make this widget even more awesome: Infinite scroll. Like this.
    Then the widget could act almost like Facebook's news feed and show an endless list of all the interesting stuff going on in the network.

  • Paul

    But, I've just discovered another minor bug: The number of items shown, are twice the parameter set in "Maximum items to show."

    Can't say that I'm seeing that issue. Then again this might be related my my test site not having enough actual data. Will test more.

    And on another note. Have you thought about implementing the possibilty to show X characters of the actual comment/post in the widget?

    Not really Thinking along the lines of the default Recent Post and Recent Comment widgets from WordPress core. These also do not provide the post content or comment content either. Back in the summer it was agreed to leave that detail out since this was supposed to be a sidebar teaser. In other words you want to have the user click to see the comment or post. click click!

    Infinite scroll. Then the widget could act almost like Facebook's

    No. Again this is supposed to be just a widget widget. We have plenty of members already complaining the widget is too busy with the scrolling and refreshing. If this were to be setup as an in page shortcode then yeah I can see how infinite scroll would be useful.

  • Paul

    @Bloggerslounge, Apologies for not getting back to this thread sooner. Wanted to update on the last items

    But, I've just discovered another minor bug: The number of items shown, are twice the parameter set in "Maximum items to show."

    This issue has been identified. Good catch.

    And on another note. Have you thought about implementing the possibilty to show X characters of the actual comment/post in the widget? As of now, I have hard coded this feature into live-stream.php, but on a very selfish level, it would make the job of applying future updates of the widget much easier for my part, if the functionality was included in the standard widget :slight_smile:

    I talked this over with some other members and this would probably be a good addition. I'm looking to add this to the widget this week. Would like to see how you are presenting the content snippet on the widget display. Some members thing the content needs to be quoted. Some want the trailing '...' after the truncated char count. Just looking for ideas.

    Still no traction on the infinite scroll.

  • kriscone

    I guess with this scrolling thing...it would be more of a page short code. For example in my theme, I can pick the home page to be a particular page. Well, if I could put the short code to the activity stream below the other content I wanted on the home page.....then I could show some of the site activity on the home page, but still have my main page content above it.....

    So maybe an option would be use it in a widget or use it on a page....or let the user define the height....

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.