Support » Fixing WordPress » Thoughts on my workflow to add custom comments from a remote source

  • Hello,

    I work on integrating some features from a blockchain platform (steem) onto wordpress. Basically right now posts are duplicated on that blockchain and on the owner’s blog. And different people comment on the blockchain and on wordpress.

    Thing is only the comments from wordpress are displayed on the wordpress blog and I would like to add the ones that come from the blockchain. I have made a poc with a filter on “the_content” to manually add a div with comments but I feel like this is dirty and hacky as it will 100% be ugly on some themes.

    Plus it’s a shame not to use wordpress’s powerfull moderation tools etc. So I guessed there was a better way but I didn’t really find it.

    So what would be the best way to add comments from another source ?

    I saw wp_insert_comment but I’m not sure as to when I would use it considering the limitations.

    Here are a few limitations that I face :

    – Comments may be edited or deleted on the distant source so they must be kept up to date.
    – I want to add more infos on the comments like a button and some more details. (basically something similar to a facebook like button)
    – I would like these comments to merge with “normal” wordpress comments, aka be on the whole “comment-list” div.
    – And of course insert them so that they can be moderated any other comment.

    Basically what I had in mind is a workflow like this :

    – Someone views the article
    – a call is made to check if the local comments are the same as the distant comments
    – if not, add/edit them to the wordpress database with special metadata so that we know that those are not “normal” comments and perform actions later on.
    – display everything and using a filter on the_comments add various elements to the “special” comments
    – Send the page and everyone is happy.

    But I’m afraid that if two users view it at the same time comments would get duplicated and that a call to a remote api when rendering the page would severly impact the performances of the blog.

    What do you think ? How would you do it ? Is there something I’m missing ?

    Any comment is appreciated, thanks 🙂

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s impractical to moderate and manage the same comments through two different sites. It should all be done through one site. The other site merely mirrors the comments from the “master” site. Ideally, do not duplicate content. Fetch the requisite comments directly from the original site through some sort of API request.

    With a proper API, comments could even be collected on the remote site, then added to the main site for moderation through the API. I’ve no idea if such an API exists for Steem. WP certainly has one, but I don’t know if you can get Steem to make use of it.

    Anyway, my main point is to not duplicate content or effort if at all possible.

Viewing 1 replies (of 1 total)
  • The topic ‘Thoughts on my workflow to add custom comments from a remote source’ is closed to new replies.