Developer Tips: Extend any JomSocial form easily

 Written by Azrul Published on Wednesday, 08 June 2011 10:36

I was was recently contacted by a developer who wanted some help hacking JomSocial core code. Within JomSocial privacy setting page, he wanted to add some of his own form elements, which would affect some privacy setting of his application.

What? hacking JomSocial core files ? NOOOOO! Really, you don't have to do that bro! Let me show you easy way to extend any JomSocial form with your own content, all from within a plugin.

 

Check out this 2 docs, onFormDisplay and onFormSave . That should give you a clue on how to do this. As shown in the example, your plugin can simply implement onFormDisplay which we will call before a form is rendered on the screen. Within your code, you will be able to insert perhaps some text, or any new html form element.

By implementing onFormSave, your plugin can then be notified when a form submit occur. You can take this opportunity to save any data from your custom form element and store and use it any way you want.

See, it's so easy. Fellow developers, we care about you!

PS:// I have actually blog about this before.

comments powered by Disqus