Author Topic: How to disable automatic login to Virtuemart after registration?  (Read 23654 times)

drejk

  • Beginner
  • *
  • Posts: 2
Re: How to disable automatic login to Virtuemart after registration?
« Reply #15 on: February 18, 2013, 20:01:40 pm »
Simple solution (VirtueMart bug?)

in administrator/components/com_virtuemart/models/user.php, in function store(), line approx. 494, change
Code: [Select]
$user = JFactory::getUser();to
Code: [Select]
$user = new JUser;
(works on 2.0.14)

Stonedfury

  • Jr. Member
  • **
  • Posts: 266
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: How to disable automatic login to Virtuemart after registration?
« Reply #16 on: March 20, 2013, 23:06:09 pm »
What's the fix to 2.0.20b? lol
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

Stonedfury

  • Jr. Member
  • **
  • Posts: 266
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: How to disable automatic login to Virtuemart after registration?
« Reply #17 on: March 21, 2013, 17:50:52 pm »
then you can see the return of this part sould be the login action, but the line '$return = $mainframe->login($credentials);' does not do anything, change it also to:

This part was correct, sorry, did not know do a 'return' this way...
I was learned to write "return bla bla bla;" and not "$return = bla bla bla;"

sorry  :-[
Has anyone else tried this? I don't mind the customer being logged in after registering as that just makes it simpler. But not being logged in completely is a problem.

VM should get along with joomla not the other way. Joomla is by far a superior and more reliable product so why not use their standards literally.

This is what my user.php has
Code: [Select]
if($currentUser->guest==1){

$msg = (is_array($ret)) ? $ret['message'] : $ret;

$usersConfig = JComponentHelper::getParams( 'com_users' );

$useractivation = $usersConfig->get( 'useractivation' );

if (is_array($ret) and $ret['success'] and !$useractivation) {

// Username and password must be passed in an array

$credentials = array('username' => $ret['user']->username,

  'password' => $ret['user']->password_clear

);

$return = $mainframe->login($credentials);

}
The user is not being logged into joomla but they are logged in. We did a customer over the phone today and I watched as they checked out and they were never logged in and still show as "logged in - Never" I have searched for the code
Code: [Select]
if($currentUser->id==0){ and it doesn't exist in that file so I am hoping to be safe in assuming that the VM devs tried to fix it but still failed. :(
My VM is 2.0.20b joomla 2.5.9 php 5.3
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28300
  • Always on vacation
    • Jenkin Hill Internet
Re: How to disable automatic login to Virtuemart after registration?
« Reply #18 on: March 22, 2013, 10:17:34 am »
I want all shoppers to be logged in to VM immediately so they can complete the purchase without being put off. To get users registered in Joomla too the solution for most people is here: http://forum.virtuemart.net/index.php?topic=113802.0    No need to hack any core files.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 3.8.9.10473 on Joomla 3.9.28 PHP 7.4.14

Stonedfury

  • Jr. Member
  • **
  • Posts: 266
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: How to disable automatic login to Virtuemart after registration?
« Reply #19 on: March 23, 2013, 21:05:57 pm »
I want all shoppers to be logged in to VM immediately so they can complete the purchase without being put off. To get users registered in Joomla too the solution for most people is here: http://forum.virtuemart.net/index.php?topic=113802.0    No need to hack any core files.
Thank you Jenkin! I will give this a shot as I agree I want them to be logged in to VM and JM. We do not do email activation as they will be paying with a card or PayPal and leaving. The activation email deters them and you can kiss most of those customers good bye.
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

zomby688

  • Beginner
  • *
  • Posts: 2
  • Skype Name: zomby688
Re: How to disable automatic login to Virtuemart after registration?
« Reply #20 on: July 26, 2013, 14:31:00 pm »
if still intersting , i solved this problem more simple. All this threads not solve this problem, because user still not login in joomla after registration and autologin in vm. I make authorization through joomla module only and it's  important for me. I made force logout on order_done page by adding this code in com_virtuemart\cart\order_done.php:
Code: [Select]
<?php
$currentUser 
JFactory::getUser()
if (
$currentUser->guest) {
$app JFactory::getApplication();
$app->logout();
}
?>

it's part of code from post above and you can apply it to your template and no hack need
Sry my english.

AnSit

  • Jr. Member
  • **
  • Posts: 121
Re: How to disable automatic login to Virtuemart after registration?
« Reply #21 on: July 27, 2013, 11:37:18 am »
I want all shoppers to be logged in to VM immediately so they can complete the purchase without being put off.

Good day to all!
Raised a very important topic!
I agree that the buyer should be able to as quickly as possible to make the order.
But equally important is the feedback from them!

After all, he created the VM so that correspond with the buyer. It is very important notice about the change of status of order. It's easy! On the phone is not an option to do so. And uncomfortable.

And as the activation time is needed in order to confirm the correct mailbox. Thus activation of the guarantee to the user.

If an order can be issued without activation and registration or wrong mailbox, then there are no guarantees. Yes and no account in Joomla that I can contact someone to do newsletters and the like. If the user makes a mistake and accidentally have the wrong mailbox it will not receive a letter of confirmation of order and therefore will not be able to get it.

The problem is not even that activation does not go well, and that it is possible to place an order without a full registration.

I beg you to make at least an option that would allow the permit or deny ordering without activation / registration!

Otherwise makes no sense option: "Only registered users can checkout"!

And many thanks to the developers for the VM and their work!

Stallion

  • Beginner
  • *
  • Posts: 1
Re: How to disable automatic login to Virtuemart after registration?
« Reply #22 on: January 31, 2014, 15:56:13 pm »
Seriously guys of VM you should consider adding an option (checkbox in configuration) to disable vm auto login.

Activation link does not work because of session variables and it is pretty annoying....

Does anyone have a fix for this????

BrownSystems

  • Beginner
  • *
  • Posts: 8
Re: How to disable automatic login to Virtuemart after registration?
« Reply #23 on: December 18, 2014, 22:49:49 pm »
I ended up using a combination of the hacks proposed by cavalier79 and czuryk. I believe they would both work independently just fine.

I faced a scenario in which I needed to require account activation via email before a user was able to access their account. Obviously the auto login was not acceptable because the requirement was to have users activate before accessing their account. In addition to this issue I also found that the account activation link would not work. So I had to modify the users registration model as described by cavalier79 and czuryk.

I'm not sure if this is still an issue in VM as I am using a dated and heavily hacked version of Virtuemart but it seems to me that the account activation feature wasn't created in a logical manner. I can't think of any scenario in which you would want to require account activation yet allow access to the account immediately after registration.

I initially attempted to figure out where VM is establishing the auto login but I ended up giving up and using this ugly hack. It would be nice if VM developers would provide the location of where the auto login happens or even better provide a config setting to disable this. 

anksuthar

  • Beginner
  • *
  • Posts: 3
  • A beginner
  • Skype Name: anksuthar
Re: How to disable automatic login to Virtuemart after registration?
« Reply #24 on: May 05, 2016, 09:30:17 am »
It is solved by hack in Virtuemart file hack also working if user activate account by him-self  through email no need to core joomla file hack only hack in virtuemart

I m solve this issue in  VirtueMart 3.0.12  other version may be some different code.


in file path "components\com_virtuemart\controllers\user.php"
find function
private function saveData($cartObj) {

}


then in function
$switch = false;
            if($currentUser->guest==1 and $register){
               $userModel->setId(0);
               $superUser = vmAccess::isSuperVendor();
               if($superUser>1){
                  $data['vendorId'] = $superUser;
               }
               $switch = true;
            }
                               
Add again "$switch = false;"  for stop session
                                $switch = false;

and find
$return = $mainframe->login($credentials);
and comment them

//$return = $mainframe->login($credentials);