MyBB Cross-Postalicious
[resolved] Display posts as comment (3 posts)

  1. AdamPL
    Posted 2 years ago #

    Hey you wrote that you still have code from display posts as comment feature.
    Could you post it somewhere ? I really need that feature :)



  2. Markus Echterhoff
    Plugin Author

    Posted 2 years ago #

    Here you go:

    You'll have to create an instance of the MybbXPCommentFetcher class, call its fetch method, passing the WordPress post ID that you'd like to display the comments for. The method will obtain the MyBB forum post id from the WP post meta and place a query against the MyBB database to fetch all forum replies. It will then run my extracted and slightly stripped down standalone version of the MyCode parser against the results (so that you'll have interpreted MyCode in your comments), transform them into WordPress comments and return these comments.

    In order to embed it into your WordPress installation, if I remember correctly, you will have to hook the 'comments_array' filter. The signature for your hook looks like this: comments_array_hook($comments_array, $post_id) and it should return the same array of comments that fetch() produces. Therefore, in the hook, call fetch() to obtain the new array of comments and return it. Or you could extract the code of the fetch() method and place it directly in your hook. You could also mix forum comments with existing WordPress comments, etc. I have placed all my filter hooks in mybb-cross-postalicious.php and their corresponding methods in MyBBXP.php, simply add the 'comments_array' hook in the same fashion and it should work.

    Let me know if you run into trouble.

  3. a_ahmed
    Posted 2 years ago #

    Hey I was trying to download this to see it but it didnt work :(

    I have cackle and i want to integrate the forum posts too! Help a brother!

    Also I am trying to figure out how to read the thread last post date? And the thread last posted user so i could display them.. and the amount of posts in thread.

    I am sure its possible but id like to have some help, would like to show u what i did with my site too anyway to contact you?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • MyBB Cross-Postalicious
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic