Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Update for critical security issue in PHPMailer included in release Vanilla 2.3.1
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Change the title of the discussion thread created when using embedded Blog Comments

Hello! As the title states, my goal is to be able to manipulate the name of the forum thread created when the first blog comment is made via the embed script.

Currently it's appending my site title at the end of every post title (since that's the HTML title for the page) and it's very redundant. Here's what I mean..

*New blog post made
*Blog post title: TITLE HERE
*Viewer visits blog post
*HTML title: TITLE HERE | SITE TITLE
*Viewer makes first comment
*Forum thread is created, called: TITLE HERE | SITE TITLE

What I want is for the forum thread to be called just TITLE HERE

If it fetches the site title via JS, then all I need to know is what variable to manipulate so I can search and replace the "SITE TITLE" part.

Comments

  • CaylusCaylus ✭✭

    Have you ever written a Vanilla plugin?

    If you're up for it, this is the event hook you'd need:

    public function discussionModel_BeforeSaveDiscussion_Handler($Sender, $Args) {
            //If a discussion has a ForeignID it's most likely generated by Wordpress
            if($Sender->EventArguments['FormPostValues']['ForeignID'])
            {
                     //Here you can change the name of the discussion to anything you'd like
                     $changedName=$Sender->EventArguments['FormPostValues']['Name'];
                     $Sender->EventArguments['FormPostValues']['Name']=$changedName;
             }
    }
    
    R_Jrbrahmsonhgtonight
  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NJ ✭✭✭

    Just a small (and irrelevant to this change) clarification to the comment about the foreign ID - I'd say it's likely a result of an import (e.g. WordPress, feed import, etc.). I happen to work on a new feed import plugin in my little spare time and I also use it...

    Caylushgtonight
Sign In or Register to comment.