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.

General 2.5 Plugin Compatibility Issues

R_JR_J Admin
edited December 2017 in Vanilla 2.0 - 2.8

If you have a plugin with the plugin key called "Something", the plugin class must be named "SomethingPlugin" like so

<?php

$PluginInfo['Something'] = array(
    // ...
);

class SomethingPlugin extends Gdn_Plugin {

Sometimes you find plugins which only use class Something extends Gdn_Plugin. Plugins like that seem to "not work" with Vanilla 2.5 any more. It can be simply fixed by renaming the class. Afterwards you have to delete the file /cache/addon.php and the problem should be gone.

@Vivant: you have mentioned problems with the "I Like This" plugin.
@Dr_Sommer: you have problems with the Add Registration Question

You both should be able to fix these problems by replacing class LikeThis extends Gdn_Plugin { with class LikeThisPlugin extends Gdn_Plugin { for the "I Like This" plugin and class AddRegistrationQuestion extends Gdn_Plugin { with class AddRegistrationQuestionPlugin extends Gdn_Plugin { for the "Add Registration Question" plugin and deleting the file /cache/addon.php afterwards.

Comments

  • You can also add a class parameter to the addon data if you're using the new JSON format if you really want to call the class something else.

  • @Linc said:
    You can also add a class parameter to the addon data if you're using the new JSON format if you really want to call the class something else.

    I've just tried the following and it didn't work for class LikeThis. I've slightly changed the plugins name in the addon.json and I could see in the plugin list, that the name from the addon.json was used.

    {
        "name": "I Like This (Plugin)",
        "description": "Like Posts Like on Facebook -- now with More Karma (integration) - And Role Permissions",
        "version": "1.1",
        "registerPermissions": [
            "Plugins.LikeThis.AllowedToLike"
        ],
        "mobileFriendly": true,
        "key": "LikeThis",
        "class": "LikeThis",
        "type": "addon",
        "authors": [
            {
                "name": "HBF",
                "email": "sales@imperialcraftbrewery.com",
                "homepage": "http://www.homebrewforums.net"
            }
        ],
        "require": {
            "vanilla": ">=2.0.18"
        }
    }
    
  • Well, I was pretty sure that's what it was for. :o

  • Thanks @R_J - that fixed it

  • @Linc said:
    Well, I was pretty sure that's what it was for. :o

    And you were not wrong: it is possible to choose a differing class name but the key needed for that is "className" not "class".

  • @R_J said:
    If you have a plugin with the plugin key called "Something", the plugin class must be named "SomethingPlugin" like so

    You both should be able to fix these problems by replacing class LikeThis extends Gdn_Plugin { with class LikeThisPlugin extends Gdn_Plugin { for the "I Like This" plugin and class AddRegistrationQuestion extends Gdn_Plugin { with class AddRegistrationQuestionPlugin extends Gdn_Plugin { for the "Add Registration Question" plugin and deleting the file /cache/addon.php afterwards.

    @R_J:
    ThX a lot... worked!! :+1:

    I'll post the solution in the correct Discussion for noobs like me... :lol::+1:

Sign In or Register to comment.