Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

can i get some details of comment integration posts from WP to Vanilla?

isurusisurus New
edited October 2014 in Vanilla 2.0 - 2.8

So, I've got comment integration working, but, it's not an ideal solution to our problem.

We would like to have the full article text posted into the thread, and not just simply the first HTML "P" tag that is found on the page, or whatever logic is being used to make the snippet of content pasted into the forums after the first comment is made...

In the themes I have tried (one custom, the other WP 2012), and depending if they had sidebars or not, completely irrelevant graphics and text were being pasted as a 'preview' into the forum post... I had to modify my theme in order to get the real blog post content in there. Obviously not the best solution in any regard.

We also want the post to appear in the Vanilla forums right away, and not after someone comments on the WP blog post... that is just poor design.

So I'm looking at writing my own custom query that will make a new Vanilla forum post when the WP blog post is made, and still use the comment integration (without duplicating the topic).

Any details from the experts or Vanilla team would be appreciated. Wading into unknown territory with this architecture, and I'd rather not swim blindly if some people can give me some insight.

Comments

  • Options
    BleistivtBleistivt Moderator
    edited October 2014

    We would like to have the full article text posted into the thread, and not just simply the first HTML "P" tag that is found on the page, or whatever logic is being used to make the snippet of content pasted into the forums after the first comment is made...

    Vanilla basically visits you worpress page and extracts the information using this function:
    https://github.com/vanilla/vanilla/blob/master/library/core/functions.general.php#L853

    You can override this by just creating a plugin and copying over the whole function like this:

    $PluginInfo['SamplePlugin'] = array(
       'Description' => 'This is a sample plugin.',
       'Version' => '1.0',
       'Author' => "Your Name",
    );
    
    class SamplePlugin extends Gdn_Plugin { }
    
    function FetchPageInfo($Url, $Timeout = 3) {
    //here goes the function...
    

    Then right here add something like:

    $PageInfo['Description'] = $Dom->find('.postcontent', 0)->plaintext;

    You might need to play around with the selector, i have no way to test this, as I don't have a wordpress blog set up.

    We also want the post to appear in the Vanilla forums right away, and not after someone comments on the WP blog post... that is just poor design.

    You would either need some kind of cron functionality or create an endpoint on vanilla that is called from wordpress to trigger the creation of the discussion.

    This is the part which creates the discussion when someone posts a comment on the embedded comment form.

    https://github.com/vanilla/vanilla/blob/master/applications/vanilla/controllers/class.postcontroller.php#L397-L485

    Another option would be to just insert the discussion into the database.

  • Options

    Awesome, thanks for the answers, I'll probably just do an insert into the database, but it's nice to the know the functionality of how it currently works.

    I may be back to see how the comment integration works on the blog post, but I think I'll probably figure it out so it sticks around.

Sign In or Register to comment.