Can anyone help me with autologin??

13 years 3 months ago #148001 by harisg7
Can anyone help me with autologin?? was created by harisg7
Hello there!

In old version I used a code for autologin but now it doesn't work. Can anyone help me?

This was the code:


Find this line in components/com_comprofiler/comprofiler.php:
[code:1]echo "\n<div>" . implode( "</div>\n<div>", $messagesToUser ) . "</div>\n";[/code:1]


Replace with:
[code:1]
$options = array();
$options = false;
$credentials = array();
$credentials =$username;
$password = cbGetParam( $_POST, 'password', '');
$credentials = $password;
global $mainframe;
$error = $mainframe->login($credentials, $options);

//here you can add the default page after registration where www.site.com Is your redirect page after registration for all users.
header( 'Location: www.site.com/index.php?option=com_comprofiler') ;[/code:1]

Post edited by: harisg7, at: 2010/12/07 18:05

Please Log in to join the conversation.

13 years 3 months ago #148048 by krileon
Replied by krileon on topic Re:Can anyone help me with autologin??
You're using Joomla API to handle the login, you need to be using CB. Please try the following usage which uses CB API.

[code:1]
function loginUser( $username, $password ) {
cbimport( 'cb.authentication' );

$cbAuthenticate = new CBAuthentication();

$messagesToUser = array();
$alertmessages = array();
$redirect_url = 'index.php';
$resultError = $cbAuthenticate->login( $username, $password, 0, 1, $redirect_url, $messagesToUser, $alertmessages, 0 );

if ( $resultError ) {
return $resultError;
} else {
return true;
}

return false;
}
[/code:1]

Adjust as necessary of course. I don't recommend core edits as you can do this with a new CB plugin and trigger usage (see tutorials in signature).

Post edited by: krileon, at: 2010/12/07 22:18


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.

13 years 3 months ago #148053 by harisg7
Replied by harisg7 on topic Re:Can anyone help me with autologin??
Thank you for your answer!
I'm not so good with coding, so I need an explanation..

I think I found the CB API (www.allmysocials.com/tutorials/item/231-include-api-externally). I must include it in components/com_comprofiler/comprofiler.php?

And the code you gave me, I must replace it with the same line?
[code:1]echo "_CRLF_<div>" . implode( "</div>_CRLF_<div>", $messagesToUser ) . "</div>_CRLF_";[/code:1]

Please Log in to join the conversation.

13 years 3 months ago #148130 by krileon
Replied by krileon on topic Re:Can anyone help me with autologin??
Not much more I can suggest, in order to use CB API outside of CB you'll of course need to include CBs API (see tutorial). Example of logging in via API can be seen in our documentation Facebook and Twitter plugins (they use login without password usage).


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.191 seconds

Facebook Twitter LinkedIn