• Resolved dr_volume

    (@dr_volume)


    First congratulations on a superb plugin!

    I’d like users of my site to see a list of posts they have commented on, and see the date any other user last commented (so they can catch up a discussion thread)

    So in other words I’d like to show a list of posts (by any author) that the currently logged in user has commented on, and showing the most recent date a comment was made by any user.

    Is that possible?

    https://ww.wp.xz.cn/plugins/custom-content-shortcode/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Hello,

    In the newest plugin update, I added a couple parameters to (hopefully) make this possible.

    [loop type=post comment_author=this]
      [comments count=1]
        [if not comment_author=this]
          New comment on [field title-link] by [comment author] ([comment date])
        [/if]
      [/comments]
    [/loop]

    This will get all posts which the current user commented on, and show the post title and comment date if the newest comment is by someone else.

    Is that close to what you imagine?

    Thread Starter dr_volume

    (@dr_volume)

    Hi Eliot Thanks for the reply – what you describe is exactly what I want to do- however at the moment if I copy and paste your code I get a completely blank page? I’m on version 2.9.7 – does that have the new parameters? My site has a very active online community with over 3,000 posts and almost 70k comments – could that be an issue?

    Plugin Author Eliot Akira

    (@miyarakira)

    Ooh, I see – yes, I believe it’s the amount of posts and comments. The code above will go through all posts to see which ones the current user has commented on. Then, it will get the newest comment to see if it was by someone else.

    You could limit the number of posts for the loop:

    [loop type=post comment_author=this count=100]

    When using comment_author, the default is to order by comment date. So, this should check the first 100 posts with new comments.

    Another thought: “blank screen” doesn’t sound right. Even if the loop had trouble with thousands of posts, it should probably end with a timeout error. Well, could you try limiting the number of posts to see if that changes anything?

    Thread Starter dr_volume

    (@dr_volume)

    Hi, yes that seems to work, I can go up to around count= 1500 posts before it goes to white screen so it’s good enough.
    Thanks so much for the help, I’ll paypal over some cash to support your excellent plug in 🙂

    Plugin Author Eliot Akira

    (@miyarakira)

    Thanks for letting me know that “solved” it. Interesting to know the limit: 1500 posts isn’t so many, but looks like it maxes out the memory or the process times out.

    Thread Starter dr_volume

    (@dr_volume)

    A quick p.s. to this – Having gone live, it seems also to depend on how many posts the users have commented on.
    Some users who have added lots of comments get the whitescreen even with the 1,500 limit. Reducing it to around 500 seems to work for the user who has posted the most comments on the site (almost 3,500 comments)

    Plugin Author Eliot Akira

    (@miyarakira)

    I see, yes that makes sense that the number of comments has an effect on the performance. I think there’s no getting around it, to check if the current user has commented on each post.

    One part of the code for checking comment author looks like it could be optimized, so I’ll try that in the next update.

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

The topic ‘Show posts a user has commented on’ is closed to new replies.