Wednesday, November 24, 2010

Customising User registration form in buddy press

Its been quite a while since i have posted anything. So today i will be posting on how to customize user registration form. Now here's a quick overview of what i m talking about.

What is buddy press
Buddy press is a plugin of wordpress that converts a wordpress from a blog to a social network.

What is the issue faced?
Buddypress comes with a predefined user registration form. Now if users wish to customize it normal problem that they face is that submission doesnot occur and there no display showing some error in process (problem that i will address in this post.)

Now in order to customize it 1st thing you must try to find out what is getting submitted when u submit the form. Like in our case the requirement was that we needed js validation before the form could even submit so that most of the validation is done on client side. For this reaon i wrote a js function and changed the submit buttons functionality in order to trigger that function on submit. This is where we encountered issue. of form not being submitted.

Then i compared the post values that were being submitted with the original form and with the form i modified and found out that root cause of this problem was one of the parameters required for submission to be successful was being sent in post by button. (the value of the button itself).

So inorder to overcome this issue here's what i did:
1. i created a input of type text.
2. i set its display to none via css
3. and assign it the value of the button. (value of button in original form)


My custom user registration form is working :)