We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Some requirements regarding plugin coding | Forum

dave Team
dave Apr 22 '16
I am not sure if these are new requirements or not, however since 1.7.5 and now 1.8.2 this is new stuff for me so i wanted to try to help other developers if they get stuck and maybe this might help.  I will try to keep this updated as i discover things :)

So Far:  

It appears that a "classes" folder for listeners is now required. You will need to add a "classes" folder and also add your code into a file inside the classes folder called event_handler.php  and also wrap that code inside the class name of: 

class YOURMODNAME_CLASS_EventHandler

otherwise your listener may not function.  

What i found is that my listener would not function until i added the folder and the file and moved my listener code from my plugin init file to the event_handler file inside my new class name. 

2. It appears that Oxwall is either making some public classes private or simply changing some paths access points.   One part of this i have noticed is with the photo plugin. 

My old call changed in two ways since 1.7.5 to 1.8.2 : 

old code: 

OW::getEventManager()->bind(PHOTO_CLASS_EventHandler::EVENT_BEFORE_PHOTO_DELETE, 'listenForPhoto');

PHOTO_CLASS_EventHandler  is no longer available as public.

New Code: 

OW::getEventManager()->bind('photo.onBeforeDelete', array($this,'listenForPhoto'));

notice that no more is the constant EVENT_BEFORE_PHOTO_DELETE

you will need to refer to the photo event handler file for actual constant values and use those. 

notice they added the $this requirement also

This has been my experience..

So far that is all i have...

 happy coding :)


dave Team
dave May 5 '16
When you are doing your updates be sure your calling the OW class and not the Update class in your calls inside your update php file.  It wont find the Update class.  
dave Team
dave May 10 '16
Speaking of updates when you are doing an update for your plugin you need to think about some of the following. 

Do you have changes to the database, values, fields, tables - add delete or modify?

Do you add anything to the config table for your plugin?

Do you add permissions for your plugin, and do they include guest permissions?

Do you need to add a button to the sidebar for your plugin?

Do you need to add a page for your plugin on the user side, or is it strictly admin panel?

And if you are going to do all or some of these things you need to include them in your update folder.  Here is how the system works for update folders. 

So you have your first version of the plugin version 1.0 Build 1

Inside the update folder of your plugin you should have a folder named 1

The system will look for that folder depending on the build in your plugin xml file. 

BUT WAIT IMPORTANT the folder name cannot be greater than the build number, and it must be greater than the last build. 

If you start off correctly youll be fine. 


Build 1    update folder/1 (name of folder inside the update folder)

Build 2    update folder/2 (name of folder inside the update folder)

and so on.... 

But lets say that you have a few updates and you get out of wack. As long as you keep the update folder name inside the update folder


greater than the last folder name - and  NOT greater than the build number 

you will be just fine. 

so inside of  pluginname/update you may have folder names 





just remember the rule, larger than the last one,  no greater than the current build number. 

Now lets talk about what is inside those folders and why you should leave them there. 

First you should never remove them because if someone is updating from an older version then they will need all those updates to run on their system. 

Now inside those folders there is a update.php file.   Even if you are not going to do anything inside of it just create it anyway  and just put this inside it. 



that way its always there and the system knows you dont want to do anything with it. 

Now also inside that folder is the langs.zip file if you have updates to the plugin language file. 

So what you would do is add this line to your update php file 

$config = OW::getConfig();

OW::getLanguage()->importPluginLangs(OW::getPluginManager()->getPlugin('your plugin name')->getRootDir().'update/the folder name/langs.zip', 'your plugin name');

//nothing further

and then just include the langs.zip in that folder and it will install it during the update. 

We wont cover database updates today but inside your update.php file you also need to include all those things we asked at the start of this post, sql commands and such. 

Hope this helps

The Forum post is edited by dave May 10 '16
dave Team
dave May 22 '16
I have also realized that when using a upload field you must use the MultiFileField option as for some reason the FileField declaration is not working and i always received a required request on submit. 

So to use the MultiFileField declaration and limit it to 1 file you just do this 

$YourFieldDeclarionName = new MultiFileField('name',1); 

It will then act just like a normal FileField declaration.

Oxwall Germany Club
Oxwall Germany Jul 17 '18
Topic was moved from General Chat.
Anais Merreta
Anais Merreta Mar 30
I just joined the forum so there are so many things I don't know yet, I hope to have the help of the boards, and I really want to get to know you all on the forum.