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.

Styling the prefix? [2.2.4]

ZhaanZhaan Professional fool ✭✭
edited April 2014 in Vanilla 2.0 - 2.8

Hiya! So this is a great plugin, but how can I style the prefix? I figured I could just add a <span class="prefix"> somewhere in class.discussionprefix.plugin.php, but I'm not sure where to put it.

Could someone point me in the right direction? Note that my PHP knowledge is severely limited.

Any help will be appreciated! :)


  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Ok, first of all if you are using vanilla 2.1 or higher you will need to fix the plugin

    change all the (&$Sender) to ($Sender)

    Replace your version or remove this line if it throws an error

    'RequiredApplications' => array('Vanilla' => '2.0.14'),

    There is no where that I can see that you can add this. What you need to do is add the prefix then look at the source html of the page with the prefix and see what it looks like. If it already has a class or if there is a way to add a class to it.

    Then once you know that , add the css rule you want to style it.

  • ZhaanZhaan Professional fool ✭✭
    edited April 2014

    Thanks for your reply! I've made the plugin work for my version of Vanilla, but as far as I can tell there are no existing classes.

    I _think _this is the part I would have to edit.. but again, not sure how:

        * Add prefix to each discussion name in list view
       public function DiscussionsController_BeforeDiscussionName_Handler($Sender) {
          if($Sender->EventArguments['Discussion']->Prefixed == 1)
             $Sender->EventArguments['Discussion']->Name = C('Plugins.DiscussionPrefix.Prefix').' '.$Sender->EventArguments['Discussion']->Name;
  • peregrineperegrine MVP
    edited April 2014


    the one problem you may find is this. Many of the developers have either upgraded to a more recent version of 2.2 (or decided to just stick with 2.1b3 which is the precursor to the next release). Consequently, they may not be able to accurately test on the version you are using (things may work in your version and may not be version dependent, but that's my two cents, for recommendations as to vanilla version to use).

    As noted, even number versions will be for hosted versions in the future and odd number version of vanilla in future will be for self-hosting.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited April 2014

    C('Plugins.DiscussionPrefix.Prefix') is the value stored in the config that you enter in the dashboard or where ever you enter it. Assuming it would be either simple text or accept html, you would have to try it.

    Add the prefix but include something like <span class="Prefix"> your prefeix</span>

    If it works then the html won't show and you will have added the class to the prefix.

    If it does not work you will see the html.

    peregrine made a great plugin

    That inserts the stuff in the comments, but it takes html so you can add almost anything. Maybe you can modify the other plugin to use this type of entry form to accept and format html if the one it has does not.

  • ZhaanZhaan Professional fool ✭✭
    edited April 2014

    Oh wow, I didn't know you could do it via dashboard! Works flawlessly.

    Thanks a million <3

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Hey @Lincoln , now you know that your plugin from 2010 works with 2.2+

    But you need to update it and it is missing an icon ... tisk tisk tisk

  • LincLinc Detroit Admin

    FYI, RequiredApplications indicates the minimum necessary version number, so it should never prevent you from installing it on newer releases.

Sign In or Register to comment.