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.

Creating a plugin for basic forum customization

I was thinking it might help new vanilla forum admins get started to more easily customize their forums if they had a plugin that would point them in the right direction in terms of how to customize their forum (and keep them from customizing Vanilla Core instead). I came up with the following, but since I'm new to Vanilla I'm sure there are other basic pieces to add that might go a long way in simplifying the introduction to Vanilla process. Thus, if anyone has any suggestions to add such a basic piece that new users could benefit from, please add them below. I know it's really basic, but for a beginner, it could really benefit. Here's what I have so far:

<?php if (!defined('APPLICATION')) exit();

 * Provides the ability to add:
 * one or more custom JS file(s)
 * one or more custom CSS file(s)
 * a Google Analytics <script>
 * Anything else?
 * without modifying files in Vanilla that you shouldn't modify in order to easily upgrade your forum
 * whenever the next release comes out.

$PluginInfo['MyCustomized'] = array(
    'Name' => 'MyCustomized',
    'Description' => 'Adds SEO - search engine optimization.',
    'Version' => '1.0',
    'MobileFriendly' => TRUE,
    'RequiredApplications' => array('Vanilla' => '2.1.11'),
    'RequiredTheme' => FALSE,
    'RequiredPlugins' => FALSE,

class MyCustomizedPlugin extends Gdn_Plugin {
    public function Base_Render_Before($Sender) {
        // Add your Google Analytics or any other <script></script> for the header here

Thanks in advance for your input.



  • R_JR_J Ex-Fanboy Munich Admin

    I think it's great that you see a need for a plugin and already provide a solution for it!

    Looking at your plugin I would:
    a) choose another name
    b) change the description in the plugin head
    c) Add a explanation what the AddString will do so that a user can understand in detail what he'll be able to use it for

    I could also think of 2 different ways to enhance this plugin:
    1. "autoload" all js files and css files that are in the js and design subdirectory or
    2. add a config screen where user can upload one or more css/js files choose which one to include. This config screen could also provide a textbox for the AddString content

    That said: I wouldn't invest time in doing any of the enhancements I've pointed out above ;) Have you seen the CSSedit and HTMLedit plugins? They can both be used for the same purpose and are very flexible.
    They might be too flexible for absolute beginners which would be a reason for a plugin like yours. But I really think that absolute beginners who would like to host a forum have to become at least novices in nearly every part of internet technologies to be a responsible host. So it would be helpful for them if they at least see the css code they like to show in their forum when they copy & paste it. And if they want to include a js file, they would have to edit the template which gives them a better understanding on html.

    But that's just my very teacher-like point of view and as I've said before: I think it's great that you solved a problem that you have seen. If you think that plugin is useful, it's most probable that there are others who find it usefull, too. So go and release it!

  • edited October 2015

    Thanks for the feedback. I went ahead and am nearly done constructing the plugin. I'm thinking of naming it AddCssAndJavascript. I liked the CSSedit and HTMLedit plugins and tried them out. I think there is a different enough feel to doing things this way that it's worth sharing, plus some might prefer having the .js file to customize with as well as the option to add something to the head.

Sign In or Register to comment.