Developer Tips: Extend any JomSocial form easily

Posted by: azrul

Tagged in: API

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.

9 Response(s)

You must be logged in to post a comment. Please register if you do not have an account yet.
Naicu Octavian
Naicu Octavian
March 07, 2012
Can you please give a more concrete example of who to implement this, because for me it does not work. How should a plugin look like? I have read all the information from the documentation, but unfortunately it isn't very well made. Please give us a working version of a plugin that implements this extension of forms.
hua12
hua12
October 21, 2011
http://www.belstaffjacketzone.com
http://www.cheapmoncler2.org/
hua12
hua12
October 15, 2011
Save 20-70% On cheap nike shoes ,
jordans for cheap,
cheap ugg boots,
cheap adidas shoes,
cheap asics shoes,
cheap mbt shoes, with Free Shipping at cheaponshoes.com.
Sales discount louboutin 2011 new style and louboutin pumps , christian louboutin designner louboutin shoes, louboutin men sneakers. free shipping and Tax-free.
Yes this christian louboutin store sales Christian Louboutin Shoes.
Save 40-70% On Cheap Ugg Austrilia womens,mens and kids boots with Free Gift,Free Shipping at ugg boots sale uk sizetime.co.uk,All the Sales on Ugg Classic Boots,Shoes,Sandals,Slippers,Sneakers,HandbagsUgg and ugg 2011 and more...
brandsboot.com is an excellent source for all your cheap ugg boots Online.The large variety of top ugg boots and cheapest prices can satisfy even the most pretentious customer.
We are an excellent source for all your cheap cigarettes Online.The large variety of top cigarettes brands and cheap cigarettes prices can satisfy even the most pretentious customer.
monster beats and cheap beats by dre spiderman beats with cheapest dr dre monster beats sold on sales at discount price for you.
supra shoes is an excellent source for all your Cheap Supra Shoes Online.The large variety of top Supra Shoes with cheap prices can satisfy even the most pretentious customer.
Canada Goose is an excellent source for all your Cheap Canada Goose,Fjallraven,Peak Performance,Spyder,Woolrich Online.The large variety of top Jackets with cheap prices can satisfy even the most pretentious customer
Gabe
Gabe
June 29, 2011
It would be nice to have a list of the form names, instead of hunting around for them.
Eivind Antoniazzi
Eivind Antoniazzi
June 19, 2011
Just realized I can't post any code here apparantly :P

Screenshot of the code: www.qmedia.no/tempstuff/plugin-js.jpg
Eivind Antoniazzi
Eivind Antoniazzi
June 19, 2011
Having some trouble trying to implement this. I wish to add some forms to the add discussion form. But nothing is happening/ added to the form.

This is the code in the system-plugin:


bruno
bruno
July 01, 2011
nao mano
blog_elimu_pl
blog_elimu_pl
June 12, 2011
Nice, but what about dependent fields - which are dependent on the user's choice. If he choose A he will see extra B and C field.
bruno
bruno
July 01, 2011
fffffffff
busy