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

General 2.5 Plugin Compatibility Issues

R_JR_J Cheerleader & TroubleshooterMunich Moderator
edited December 2017 in Vanilla 2.5 Help

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.

LincVivantK17Shadowdaretimme2707mirX

Comments

  • LincLinc Director of Development Detroit Vanilla Staff

    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.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @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": "[email protected]",
                "homepage": "http://www.homebrewforums.net"
            }
        ],
        "require": {
            "vanilla": ">=2.0.18"
        }
    }
    
  • LincLinc Director of Development Detroit Vanilla Staff

    Well, I was pretty sure that's what it was for. :o

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @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".

    VivantLinc
  • Dr_SommerDr_Sommer Dr. of tender Programing ;) ✭✭

    @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.