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.

Change discussion title format of discussions from WordPress integration plugin

frdmnfrdmn New
edited July 2014 in Vanilla 2.0 - 2.8

Hello,

im using the Vanilla WordPress plugin to take advantage of Vanilla as my comment system and also post new blog posts in the forums. It's working well so far, but I want to change the title format of the discussions made by the WordPress plugin. At the moment they look like "<blog post title> | <blog name>". Also im not even sure if its a WordPress plugin or Vanilla embedded related thing. Anyone an idea?

Thanks

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Hiya!

    What version number of Vanilla are you running?

    I am not sure what your are trying to do. Perhaps sharing a screenshot of what is happening right now, and what you want to change would shed some light.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Im running version 2.2.3.4 and WordPress 3.9.1.

    When I write a new blog post now, it looks like this in the forums:

    And I want to change the title format, so it's only "Test pos pls ignore".

    UnderDoghgtonight
  • hgtonighthgtonight ∞ · New Moderator

    I refuse to talk about alpha versions here, so the exact details below might be different on your setup.

    Alright!

    The discussion title is set up on the discussion controller in the Embed method. You can see it on line #813 in file /applications/vanilla/controllers/class.discussioncontroller.php.

    You need to hook in and change the form value. Something like below will get you started:

    public function DiscussionController_BeforeDiscussionRender_Handler($Sender) {
      $CleanedTitle = $Title = $Sender->Form->GetValue('Name');
      $UnwantedString = ' | YEAHWHAT?!';
      $UnwantedLength = strlen($UnwantedLength);
      if(substr($Title, $UnwantedLength * -1) == $UnwantedString) {
        $CleanedTitle = substr($Title, 0, strlen($Title) - $UnwantedLength);
      }
      $Sender->Form->SetValue('Name', $CleanedTitle);
    }
    

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    peregrineUnderDogfrdmn
  • @x00‌ @hgtonight‌ perfect, thank you guys! thats all I need. :)

Sign In or Register to comment.