Auto login for newly registered users

12 years 9 months ago #171925 by houfton
Replied by houfton on topic Re: Auto login for newly registered users
I have had a go at this and managed to create and upload my own plugin which I thought I would never be able to do. (By the way, for anyone who has not spotted it, there is a downloadable file at the bottom of Kyle's Event Triggers tutorial which is easy to miss, for me anyway. It contains a basic plugin structure.)

Unfortunately I have tried various combinations of the code in this thread and in another thread and looked at the Twitter plugin example but I cannot get auto login to work.

I would love to work this out but I might have to give the 'Enhanced Registration' extension a go (though I am not sure it is compatible with CB 1.4).

Please Log in to join the conversation.

12 years 9 months ago - 12 years 9 months ago #171947 by krileon
Replied by krileon on topic Re: Auto login for newly registered users
Assuming you've reviewed the events tutorial the below handler for the after registration trigger will perform the login for you.
global $_PLUGINS;
$_PLUGINS->registerFunction( 'onAfterUserRegistration', 'registered', 'tutorialtriggersPlugin' );

// Define the plugin class:
class tutorialtriggersPlugin extends cbPluginHandler {
	
	// Establish the trigger function:
	function registered( $user ) {
		cbimport( 'cb.authentication' );

		$cbAuthenticate		=	new CBAuthentication();

		$messagesToUser		=	array();
		$alertmessages		=	array();
		$redirect_url		=	null;
		$resultError		=	$cbAuthenticate->login( $user->username, false, 0, 1, $redirect_url, $messagesToUser, $alertmessages, 0 );

		if ( $resultError ) {
			$user->_error	=	$resultError;
		} else {
			return ( count( $alertmessages ) > 0 ? stripslashes( implode( '<br />', $alertmessages ) ) : true );
		}
	}
}

Please note I did not test the above and is for example purposes only. Please make any changes where necessary and test thoroughly.


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.

12 years 9 months ago #171960 by houfton
Replied by houfton on topic Re: Auto login for newly registered users
I really appreciate your persistence on this. Unfortunately it is not quite right as it is triggered after registration but before payment. If you proceed to pay (I am using the dummy payment at the moment but will use PayPal) you return as before, not logged in, to the Registration Complete! page.

Perhaps, rather than using the onAfterUserRegistration trigger, it needs an onAfterPaymentTrigger? I will do some experimenting with the Event Triggers but maybe, if it exists, it would be a special CBSubs trigger. Is there an 'onSubscriptionActivation'?

Please Log in to join the conversation.

12 years 9 months ago #171976 by krileon
Replied by krileon on topic Re: Auto login for newly registered users
CBSubs triggers and CBSubs API is "off limits" to the general public as we've not finalized it yet, sorry I can not provide a trigger for you. This most definitely will have problems with CBSubs in the process.


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.

12 years 9 months ago #172019 by houfton
Replied by houfton on topic Re: Auto login for newly registered users

I'm working on a joomla site using CB and CBSubs. I'd like to reduce the number of clicks for my users and automatically log them into CB once they've successfully registered.


Looks like the answer to Dan's original post is it can't really be done?

Please Log in to join the conversation.

12 years 9 months ago #172188 by krileon
Replied by krileon on topic Re: Auto login for newly registered users

houfton wrote:

I'm working on a joomla site using CB and CBSubs. I'd like to reduce the number of clicks for my users and automatically log them into CB once they've successfully registered.


Looks like the answer to Dan's original post is it can't really be done?

Not with CBSubs present as it changes the workflows entirely. If CBSubs isn't present then it absolutely can be done. Once CBSubs API has opened up however it'll be possible.


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.

Moderators: beatnantkrileon
Time to create page: 0.238 seconds

Facebook Twitter LinkedIn