Generic Plugin Create

Hi,
I would like to create a generic plugin for OJS for the purpose of creating a menu item that opens a page. I’ve already gotten so far that the plugin creates the menu item but the page it opens fails into error 404.
Do you maybe have any tips for solving this problem? Have any of you had an issue similar to this one?
Also you can find the zip with the source code in it by clicking on the link below. Can you take a look at it? Maybe you’ll find where the problem is.

Thanks,
Balazs

Hi @balazs95,

Would you be willing to post your code in something like GitHub? There are code review tools there that are a lot quicker and easier to work with, and when the plugin is finished, it’ll be easier to add to the Plugin Gallery (if that’s what you’d like to do).

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Sure, thank you for the opportunity. Please see the Github link below.

Hi @balazs95,

At a glance it looks like you’re on the right track. Can you check if there’s an entry for your plugin in the versions table in your database? This normally gets added by the plugin install tool but if you’re writing a new plugin from scratch it’s easy to overlook. If there’s no entry, you can create one using tools/installPluginVersion.php.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Yes there is an entry, see attached picture.


Any other ideas?

Thanks,

Balazs

Hi @balazs95,

At what URL are you trying to view the newly created page? It looks like there might be a mismatch between the function name in the handler class (view) and the URL generated elsewhere in the code (e.g. MostReadArticlePlugin::setMenuItemDisplayDetails, which doesn’t specify an operation, and therefore uses the default index).

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Thank you for your advice, it helped me solve the problem. The plugin is available at the link below:


I hope it will be useful for other users.

Best,
Balazs

Hi @balazs95,

Congratulations! If you’d like to get the plugin into the plugin gallery, please send me a PM when it’s ready – we generally do a quick code review then work with the plugin developer to package the plugin so it’s ready for distribution.

Thanks,
Alec Smecher
Public Knowledge Project Team