[SOLVED] separate registration procedure

10 years 7 months ago #234393 by krileon
Replied by krileon on topic separate registration procedure

After this, you write something about GET instead of POST etc, but i got confused by reading that paragraph. Can you please explain this to me?

You asked about 2 completely different usages. 1 usage you wanted a form to post to CBs registration page and have some fields auto-completed based off what they filled out in your module form, which is done through jQuery. The second usage you asked about updating a users database values, which is done through the API and not through queries.

Finally, lets assume that i have a form with 3 fields: name, e-mail and password. So, by clicking on register button, i need to execute a php script that creates new user, passes the values from name, e-mail and password to cb_name, cb_email and cb_password fields and also triggers a CB Auto Action that assigns a user to a group and a cb subs plan.

Why do you need a custom implementation for this? Just setup the fields on your normal CB registration form to give this exact experience and eliminate all the troubles of trying to implement a custom solution.

So the main idea of the code is something like this, correct?

No, I don't understand why you have a part of a query at the very bottom. This is PHP, not SQL. Please see the below tutorial as it describes how to register a user through API.

www.joomlapolis.com/support/tutorials/120-api-usage/18362-registering-a-user-through-cb-api


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: Ntelos

Please Log in to join the conversation.

10 years 7 months ago - 10 years 7 months ago #234451 by Ntelos
Replied by Ntelos on topic separate registration procedure
OK, i got it. First include API externally and then use a code like here:

www.joomlapolis.com/support/tutorials/120-api-usage/18362-registering-a-user-through-cb-api

to create a new user.

Can i use the api code and the code from the link inside the same php script?If not, should i create a php file with the api code inside and use the code in the link inside php script of form?If yes, then where should i place the API script file?
Also, i need to trigger the function registerUser:

function registerUser( $fname, $lname, $email, $password, $approve = 0, $confirm = 0 ) {}

So, if in my form i have as fields, name, lastnaame, E-mail and password, i will trigger the function like this?

registerUser($_POST,$_POST,$_POST,$_POST,0,0);

Regarding the other:

Finally, lets assume that i have a form with 3 fields: name, e-mail and password. So, by clicking on register button, i need to execute a php script that creates new user, passes the values from name, e-mail and password to cb_name, cb_email and cb_password fields and also triggers a CB Auto Action that assigns a user to a group and a cb subs plan.
Why do you need a custom implementation for this? Just setup the fields on your normal CB registration form to give this exact experience and eliminate all the troubles of trying to implement a custom solution.

i need this because i need a quick registration module in frontpage and after clicking on register, then the user will proceed to fill all the other fields. That way there will be low possibility of losing him/her as possible user.


P.S. Sorry for the tones of questions, but i am not familiar with this stuff.

Please Log in to join the conversation.

10 years 7 months ago #234490 by krileon
Replied by krileon on topic separate registration procedure
As explained previously you don't need a single line of PHP for what you're wanting. It's just HTML and jQuery. Please use the below as PHP seams out of your scope of experience and is too advanced of a topic without further learning or hiring someone to assist you.

Custom HTML Module:
<form action="index.php?option=com_comprofiler&task=registers" method="post" id="reg_mod">
	<input type="hidden" name="option" value="com_comprofiler">
	<input type="hidden" name="task" value="registers">
	<input type="hidden" name="ismodule" value="yes">
	<div>
		<label for="reg_mod_name">Name</label>
		<input type="text" name="name" id="reg_mod_name" class="inputbox input-medium" size="14">
	</div>
	<div>
		<label for="reg_mod_email">Email</label>
		<input type="text" name="email" id="reg_mod_email" class="inputbox input-medium" size="14">
	</div>
	<div>
		<label for="reg_mod_pass">Password</label>
		<input type="text" name="password" id="reg_mod_pass" class="inputbox input-medium" size="14">
	</div>
	<div>
		<input type="submit" class="button" value="Register">
	</div>
</form>

Once the above is setup you'll have a module that posts to CBs registration form. Now we need to grab those values and force them into fields. This is done using CB Auto Actions. The below action should do this for you.

Type: Code
Triggers: onBeforeRegisterFormDisplay
Access: Everybody
Conditiona: [post_ismodule] Equal To yes
Method: jQuery
Code:
$( '#name' ).val( '[post_name]' );
$( '#email,#email__verify' ).val( '[post_email]' );
$( '#password,#password__verify' ).val( '[post_password]' );

Now when you use the module it'll fill out the name field, email field, and password field with the values supplied to the module. Note depending on what you have the name format set to you could have firstname, middlename, and lastname instead of just name so adjust as needed.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

10 years 6 months ago #235502 by Ntelos
Replied by Ntelos on topic separate registration procedure
Ok, i contacted a programmer who actually did what i want.

I used a form from rs form component (as quick registration form) and when the user registers from rs form, he registers to Community Builder too. He inserted the cb api code and the registration function from those links:

www.joomlapolis.com/support/tutorials/120-api-usage/18362-registering-a-user-through-cb-api

and

www.joomlapolis.com/support/tutorials/120-api-usage/18357-including-cb-api-for-usage-outside-of-cb

inside the controller.php file of rsform component. With this way, the user registers successfully inside Community Builder but i have a problem:

The user and the administrator do not receive confirmation/notification e-mails. If i try to register through default cb registration form, i receive the confirmation e-mails. Maybe inside the code in the 2 links above, the user registers as enabled/activated and thats why he doesn't receive confirmation e-mail?

Thank you in advance
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

10 years 6 months ago #235667 by krileon
Replied by krileon on topic separate registration procedure

The user and the administrator do not receive confirmation/notification e-mails. If i try to register through default cb registration form, i receive the confirmation e-mails. Maybe inside the code in the 2 links above, the user registers as enabled/activated and thats why he doesn't receive confirmation e-mail?

The emails have to be triggered. Execute the below before the after registration trigger to send the emails.

activateUser( $user, 1, 'UserRegistration' );


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: Ntelos

Please Log in to join the conversation.

10 years 6 months ago #235861 by Ntelos
Replied by Ntelos on topic separate registration procedure
Thank you very much!That really worked!

I just noticed that the new user is also confirmed. If i wanted not to be confirmed but to click on the link received from confirmation e-mail, what should i change from the code?

For example from the registerUser function, i found this:
if ( $approval == 0 ) {
 $user->approved = 1;
 } else {
 $user->approved = 0;
 }
 
 if ( $confirmation == 0 ) {
 $user->confirmed = 1;
 } else {
 $user->confirmed = 0;
 }

Should i remove those ifs in order to to confirm and approve the user?Maybe only the approve "if", so the user is confirmed but to be approved he must click on the confirmation link?

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.197 seconds

Facebook Twitter LinkedIn