How to automatically logout after vendor register

  • Posts: 57
  • Thank you received: 1
10 years 1 month ago #174654

-- HikaShop version -- : 2.3.3
-- HikaMarket version -- : 1.4.4
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.5.14-1

hi
How to i automatically logout user after vendor register and redirect to article id

vendors Registration options is automatic validation

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #174657

Hi,

You can override the view "vendormarket | after_register" and put your PHP custom code.
Thanks to that, you can call Joomla function to logout the user and finish with a redirect to your article.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 1
10 years 1 month ago #174686

i did add this code
$app = JFactory::getApplication();
$user = JFactory::getUser();
$user_id = $user->get('id');
$app->logout($user_id, array());
echo '<script type="text/javascript">
window.location = " www.google.com/ "
</script>'
?>

but i get this error :

Please complete the Address field

Please complete the Post field

Please complete the town field

Please complete the phone field

Warning: Creating default object from empty value in ../administrator/components/com_hikamarket/classes/vendor.php on line 476

do i need to check required fields before adding the code

Like this?
$missing = array();
foreach ($_POST as $key => $value) { if ($value == "") { array_push($missing, $key);}}
if (count($missing) > 0) {
echo "Required fields found empty: ";
foreach ($missing as $k => $v) { echo $v." ";}
} else {
unset($missing);
$app = JFactory::getApplication();
$user = JFactory::getUser();
$user_id = $user->get('id');
$app->logout($user_id, array());
echo '<script type="text/javascript">
window.location = " www.google.com/ "
</script>'
}

Last edit: 10 years 1 month ago by 888.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #174689

Hi,

Thanks for the report.
Please edit the file "administrator/components/com_hikamarket/classes/vendor.php" and remplace

$vendor = $fieldClass->getInput( array('vendorregister','plg.hikamarket.vendor'), $old, true, 'data', false, 'display:vendor_registration=1');
By
$vendor = $fieldClass->getInput( array('vendorregister','plg.hikamarket.vendor'), $old, true, 'data', false, 'display:vendor_registration=1');

if($vendor === false)
	return false;

For the rest, you can register a vendor account without providing the mandatory fields (Address, Post, town phone).
So the registration could not be completed correctly and that's why you got the messages.
The patch will fix that.

About your code, for the redirection, please using instead
$app->redirect('http://www.google.com');
Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 1
10 years 1 month ago #174704

its ok now if you fill in all required fields
but if you do not fill in required fields this error

Warning: Invalid argument supplied for foreach() in
../administrator/components/com_hikashop/classes/field.php on line 642

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #174717

Hi,

I'll try to reproduce your problem in my local website.
But like that, I can't know which custom field group is generating the error in your case.
What required fields do you no fill ? A vendor one ? A user one ? An address one ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 1
10 years 1 month ago #174722

if new user forget / miss any or all of this required fields
plg.hikamarket.vendor vendor_address_company Company
plg.hikamarket.vendor vendor_address_street Address
plg.hikamarket.vendor vendor_address_post_code Post code
plg.hikamarket.vendor vendor_address_city City
plg.hikamarket.vendor vendor_address_telephone Telephone

did test not to fill in Postcode and City field and Telephone get this error

Please complete the Postcode field
Please complete the City field
Please complete the Telephone field

Error during registration

Warning: Invalid argument supplied for foreach() in .../administrator/components/com_hikashop/classes/field.php on line 642

index.php/shop-reg (the vendor registration page start test)
this page opens when you click register index.php/shop-reg/vendor/register (error page)


Regards,

Last edit: 10 years 1 month ago by 888.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #174783

Hi,

Please edit the file "components/com_hikamarket/controllers/vendor.php" and replace

			if($status)
				$user = $userClass->get($userClass->user_id);
			else
				return false;
By
			if($status)
				$user = $userClass->get($userClass->user_id);
			else
				return $this->form();
It will re-display the registration form if there is an error during the user registration.
I am currently working on it in order to perform all tests before the user/vendor creation so if there is something missing for the vendor, the user registration won't be requested.
More than that, I will add some code in order to fill the elements with the previous entered values, some elements are missing.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.066 seconds
Powered by Kunena Forum