[SOLVED] separate registration procedure

10 years 6 months ago - 10 years 6 months ago #236039 by Ntelos
Replied by Ntelos on topic separate registration procedure
I didn't understand what you are proposing.

If i use this if:
if ( $confirmation == 0 ) {
 $user->confirmed = 1;
 } else {
 $user->confirmed = 0;
 }

then its like confirmation == 0 always, because i receive notification e-mail without confirmation link. If i erase this if, or leave as dummy like this:
if ( $confirmation == 0 ) {
 $user->confirmed = 0;
 } else {
 $user->confirmed = 0;
 }

then when i click on verification link (inside the e-mail) i get a wrong verification code message.

I also noticed this:

At the first of registerUser function i write this:
function registerUser( $fname, $lname, $email, $username, $password, $cb_profiletype, $approve = 0, $confirm = 0 ) {
 global $_CB_framework, $_CB_database, $ueConfig, $_PLUGINS;
 
 $approval = ( $approve == 2 ? $ueConfig['reg_admin_approval'] : $approve );
 $confirmation = ( $confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm );
 $usertype = $_CB_framework->getCfg( 'new_usertype' );
 
 $user = new moscomprofilerUser( $_CB_database );
 $user->usertype = ( $usertype ? $usertype : 'Registered' );
 $user->gid = $_CB_framework->acl->get_group_id( $user->usertype, 'ARO' );
 $user->gids = array( $user->gid );
 $user->sendEmail = 0;
 $user->registerDate = date( 'Y-m-d H:i:s', $_CB_framework->now() );
 $user->name = $fname . ' ' . $lname;
 $user->firstname = $fname;
 $user->lastname = $lname;
 $user->username = $username;
 $user->email = $email;
 $user->password = $user->hashAndSaltPassword( $password );
 $cb_profiletype = "fan-profile"; 
 $user->cb_profiletype = $cb_profiletype;
 $user->registeripaddr = cbGetIPlist();
...
...

If i place those 2 lines of coding:
 $cb_profiletype = "fan-profile"; 
 $user->cb_profiletype = $cb_profiletype;
for example after this line:

$user->registeripaddr = cbGetIPlist();

or before this line:
$user->name = $fname . ' ' . $lname;

then i get different responses from Community Builder. (like when i click on confirmation link then i go to a webpage with a message that i haven't got the rights to see the content or i don't receive a confirmation e-mail at all)

So, i don't know if those 2 lines or the position i place them does something in the whole procedure. I actually use those 2 lines in order to put the value: "fan-profile" inside cb_profiletype field during user registration

Please Log in to join the conversation.

10 years 6 months ago #236063 by krileon
Replied by krileon on topic separate registration procedure
Using the original code that the tutorial proposed all you need to do is set $confirmation to 1 at the very top of the function. That will enable email confirmation and create the confirmation code as needed. Aside from that I don't know what more to advise. This usage is being used in CB Connect perfectly fine so you're welcome to also review its usage in its class file.

You can set CB fields using $user->FIELD_NAME = VALUE as needed as well. This should have no affect on whether registration is successful or not.


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 #236095 by Ntelos
Replied by Ntelos on topic separate registration procedure
I am trying to set $user->confirmation=1; at several places at first of registerUser function with no success.

I looked into comprofiler.php file here:
if ( $user->confirmed == 0 ) {
						if ( $user->checkActivationCode( $confirmcode ) ) {
							// THIS is the normal case: user exists, is not yet confirmed, and confirmation code does match:
							$messagesToUser	=	null;
							$confirmed		=	$user->confirmUser( $messagesToUser );
						} else {
							// confirmation code does not match:
							$messagesToUser	=	array( _UE_WRONG_CONFIRMATION_CODE );
							$confirmed		=	false;
						}
					} 
..
..

So, it appears that the condition $user->checkActivationCode( $confirmcode ) is not valid so i go to ELSE where i see the wrong confirmation code.

I will keep trying with $user->confirmation=1; till i find a solution. If anything comes to mind, please let me know in order to try this.

Thanks in advance

Please Log in to join the conversation.

10 years 6 months ago - 10 years 6 months ago #236117 by Ntelos
Replied by Ntelos on topic separate registration procedure
Is there anyone at joomlapolis.com that i could pay him/her as custom work, in order to give credentials and look through this problem to fix this?

Thank you in advance

Please Log in to join the conversation.

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

I am trying to set $user->confirmation=1; at several places at first of registerUser function with no success.

No, that's not what you need to do. Please see the below original tutorial.

function registerUser( $fname, $lname, $email, $username, $password, $approve = 0, $confirm = 0 ) {
	global $_CB_framework, $_CB_database, $ueConfig, $_PLUGINS;

	$approval = ( $approve == 2 ? $ueConfig['reg_admin_approval'] : $approve );
	$confirmation = ( $confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm );
	$usertype = $_CB_framework->getCfg( 'new_usertype' );

	$user = new moscomprofilerUser( $_CB_database );
	$user->usertype = ( $usertype ? $usertype : 'Registered' );
	$user->gid = $_CB_framework->acl->get_group_id( $user->usertype, 'ARO' );
	$user->gids = array( $user->gid );
	$user->sendEmail = 0;
	$user->registerDate = date( 'Y-m-d H:i:s', $_CB_framework->now() );
	$user->name = $fname . ' ' . $lname;
	$user->firstname = $fname;
	$user->lastname = $lname;
	$user->username = $username;
	$user->email = $email;
	$user->password = $user->hashAndSaltPassword( $password );
	$user->registeripaddr = cbGetIPlist();

	if ( $approval == 0 ) {
		$user->approved = 1;
	} else {
		$user->approved = 0;
	}

	if ( $confirmation == 0 ) {
		$user->confirmed = 1;
	} else {
		$user->confirmed = 0;
	}

	if ( ( $user->confirmed == 1 ) && ( $user->approved == 1 ) ) {
		$user->block = 0;
	} else {
		$user->block = 1;
	}

	$_PLUGINS->trigger( 'onBeforeUserRegistration', array( &$user, &$user ) );

	if ( $user->store() ) {
		if ( ( $user->confirmed == 0 ) && ( $confirmation != 0 ) ) {
			$user->_setActivationCode();
		
			if ( ! $user->store() ) {
				return false;
			}
		}
	
		$_PLUGINS->trigger( 'onAfterUserRegistration', array( &$user, &$user, true ) );
	
		return true;
	}

	return false;
}

Notice the last variable of the function is "$confirm = 0". When calling the function simply set this to "1". Example usage as follows.

registerUser( 'test', '123', 'fake@cb.invalid', 'testuser', '12345678', 0, 1 );

This will enable email confirmation, set confirmed to 0 for the user, and sent the confirmation code.

Is there anyone at joomlapolis.com that i could pay him/her as custom work, in order to give credentials and look through this problem to fix this?

No, we do not have such a service.


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 #236206 by Ntelos
Replied by Ntelos on topic separate registration procedure
You were correct!

I didn't notice that the function sets a value to $confirm variable at its call.

I did this and its working like a charm!

Thank you very much for your time!

I appreciate your help!
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.581 seconds

Facebook Twitter LinkedIn