How to redirect customer on custom page after registration in Magento 2 Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Magento 2 - Redirect user to specific page after registerHow to add date filed in admin & show on front in magento2Magento 2: How to override newsletter Subscriber modelAfter rewrite MagentoCustomerModelAccountManagement giving me fatal errorMagento 2: Plugin class does not existHaving trouble exporting products from Magento 2.x. Fatal error: Uncaught Error: Call to a member function getName()Magento 2: After custom cookie is created all pages default to home pageMagento Core doesnt work after transferError in collectionsMagento 2.3 Can't view module's front end page output?Magento2 REST API get all customers details

How to run gsettings for another user Ubuntu 18.04.2 LTS

Overriding an object in memory with placement new

If a contract sometimes uses the wrong name, is it still valid?

Using audio cues to encourage good posture

What does this icon in iOS Stardew Valley mean?

Why am I getting the error "non-boolean type specified in a context where a condition is expected" for this request?

When do you get frequent flier miles - when you buy, or when you fly?

How to call a function with default parameter through a pointer to function that is the return of another function?

What is the role of the transistor and diode in a soft start circuit?

Can a USB port passively 'listen only'?

Storing hydrofluoric acid before the invention of plastics

prime numbers and expressing non-prime numbers

What would be the ideal power source for a cybernetic eye?

3 doors, three guards, one stone

Error "illegal generic type for instanceof" when using local classes

How does the particle を relate to the verb 行く in the structure「A を + B に行く」?

Why aren't air breathing engines used as small first stages

Why did the IBM 650 use bi-quinary?

Short Story with Cinderella as a Voo-doo Witch

Is the Standard Deduction better than Itemized when both are the same amount?

Why are Kinder Surprise Eggs illegal in the USA?

porting install scripts : can rpm replace apt?

String `!23` is replaced with `docker` in command line

How to deal with a team lead who never gives me credit?



How to redirect customer on custom page after registration in Magento 2



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Magento 2 - Redirect user to specific page after registerHow to add date filed in admin & show on front in magento2Magento 2: How to override newsletter Subscriber modelAfter rewrite MagentoCustomerModelAccountManagement giving me fatal errorMagento 2: Plugin class does not existHaving trouble exporting products from Magento 2.x. Fatal error: Uncaught Error: Call to a member function getName()Magento 2: After custom cookie is created all pages default to home pageMagento Core doesnt work after transferError in collectionsMagento 2.3 Can't view module's front end page output?Magento2 REST API get all customers details



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















Here is my code




customerregistersuceessobserver.php




 <?php


namespace WebkulMarketplaceObserverRewrite;
use WebkulMarketplaceObserverCustomerRegisterSuccessObserver;
use MagentoFrameworkEventObserverInterface;
use WebkulMarketplaceModelResourceModelSellerCollectionFactory;


class CustomerRewriteRegisterSuccessObserver extends CustomerRegisterSuccessObserver
{
/**
* @var ObjectManagerInterface
*/
protected $_objectManager;

/**
* @var CollectionFactory
*/
protected $_collectionFactory;

/**
* @var MagentoFrameworkStdlibDateTimeDateTime
*/
protected $_date;

/**
* @var MagentoStoreModelStoreManagerInterface
*/
protected $_storeManager;

/**
* @var MagentoFrameworkMessageManagerInterface
*/
private $_messageManager;

/**
* @param MagentoFrameworkObjectManagerInterface $objectManager
* @param MagentoFrameworkStdlibDateTimeDateTime $date
* @param MagentoStoreModelStoreManagerInterface $storeManager
* @param MagentoFrameworkMessageManagerInterface $messageManager,
* @param CollectionFactory $collectionFactory
*/
public function __construct(
MagentoFrameworkObjectManagerInterface $objectManager,
MagentoFrameworkStdlibDateTimeDateTime $date,
MagentoStoreModelStoreManagerInterface $storeManager,
MagentoFrameworkMessageManagerInterface $messageManager,
CollectionFactory $collectionFactory
)
$this->_objectManager = $objectManager;
$this->_storeManager = $storeManager;
$this->_messageManager = $messageManager;
$this->_collectionFactory = $collectionFactory;
$this->_date = $date;


/**
* customer register event handler.
*
* @param MagentoFrameworkEventObserver $observer
*/
public function execute(MagentoFrameworkEventObserver $observer)

$data = $observer['account_controller'];
try
$paramData = $data->getRequest()->getParams();
if (!empty($paramData['is_seller']) && !empty($paramData['selling_categories']) && $paramData['is_seller'] == 1)
$customer = $observer->getCustomer();

//~ $profileurlcount = $this->_objectManager->create(
//~ 'WebkulMarketplaceModelSeller'
//~ )->getCollection();
//~ $profileurlcount->addFieldToFilter(
//~ 'selling_categories',
//~ $paramData['selling_categories']
//~ );
//~ if (!$profileurlcount->getSize())
$status = $this->_objectManager->get(
'WebkulMarketplaceHelperData'
)->getIsPartnerApproval() ? 0 : 1;
$customerid = $customer->getId();
$model = $this->_objectManager->create(
'WebkulMarketplaceModelSeller'
);
$categories=implode(',',$paramData['selling_categories']);
$model->setData('is_seller', $status);
$model->setData('selling_categories',$categories);
$model->setData('seller_id', $customerid);
$model->setData('store_id', 0);
$model->setCreatedAt($this->_date->gmtDate());
$model->setUpdatedAt($this->_date->gmtDate());
if ($status == 0)
$model->setAdminNotification(1);

$model->save();
$loginUrl = $this->_objectManager->create(
'MagentoFrameworkUrlInterface'
)->getUrl("marketplace/account/dashboard");
$this->_objectManager->create(
'MagentoCustomerModelSession'
)->setBeforeAuthUrl($loginUrl);
$this->_objectManager->create(
'MagentoCustomerModelSession'
)->setAfterAuthUrl($loginUrl);

$helper = $this->_objectManager->get(
'WebkulMarketplaceHelperData'
);
//~ if ($helper->getAutomaticUrlRewrite())
//~ $this->createSellerPublicUrls($paramData['profileurl']);
//~
$adminStoremail = $helper->getAdminEmailId();
$adminEmail = $adminStoremail ? $adminStoremail : $helper->getDefaultTransEmailId();
$adminUsername = 'Admin';
$senderInfo = [
'name' => $customer->getFirstName().' '.$customer->getLastName(),
'email' => $customer->getEmail(),
];
$receiverInfo = [
'name' => $adminUsername,
'email' => $adminEmail,
];
$emailTemplateVariables['myvar1'] = $customer->getFirstName().' '.
$customer->getLastName();
$emailTemplateVariables['myvar2'] = $this->_objectManager->get(
'MagentoBackendModelUrl'
)->getUrl(
'customer/index/edit',
['id' => $customer->getId()]
);
$emailTemplateVariables['myvar3'] = 'Admin';

$this->_objectManager->create(
'WebkulMarketplaceHelperEmail'
)->sendNewSellerRequest(
$emailTemplateVariables,
$senderInfo,
$receiverInfo
);







//~ else
//~ $this->_messageManager->addError(
//~ __('This Shop URL already Exists.')
//~ );
//~

catch (Exception $e)
$this->_messageManager->addError($e->getMessage());





here I need to redirect the customer after register in magento 2
how i can set redirect (note: email verfication enabled)




how i can do this




now it redirects to the customer login page











share|improve this question
























  • If below answer not helpful then refer this link : magento.stackexchange.com/questions/131850/…

    – Sanjay Gohil
    yesterday











  • Try the below updated code and place it in your observer by removing your code

    – Prathap Gunasekaran
    yesterday











  • no here had some data process there ..... how i can add

    – prabhakaran7
    yesterday


















1















Here is my code




customerregistersuceessobserver.php




 <?php


namespace WebkulMarketplaceObserverRewrite;
use WebkulMarketplaceObserverCustomerRegisterSuccessObserver;
use MagentoFrameworkEventObserverInterface;
use WebkulMarketplaceModelResourceModelSellerCollectionFactory;


class CustomerRewriteRegisterSuccessObserver extends CustomerRegisterSuccessObserver
{
/**
* @var ObjectManagerInterface
*/
protected $_objectManager;

/**
* @var CollectionFactory
*/
protected $_collectionFactory;

/**
* @var MagentoFrameworkStdlibDateTimeDateTime
*/
protected $_date;

/**
* @var MagentoStoreModelStoreManagerInterface
*/
protected $_storeManager;

/**
* @var MagentoFrameworkMessageManagerInterface
*/
private $_messageManager;

/**
* @param MagentoFrameworkObjectManagerInterface $objectManager
* @param MagentoFrameworkStdlibDateTimeDateTime $date
* @param MagentoStoreModelStoreManagerInterface $storeManager
* @param MagentoFrameworkMessageManagerInterface $messageManager,
* @param CollectionFactory $collectionFactory
*/
public function __construct(
MagentoFrameworkObjectManagerInterface $objectManager,
MagentoFrameworkStdlibDateTimeDateTime $date,
MagentoStoreModelStoreManagerInterface $storeManager,
MagentoFrameworkMessageManagerInterface $messageManager,
CollectionFactory $collectionFactory
)
$this->_objectManager = $objectManager;
$this->_storeManager = $storeManager;
$this->_messageManager = $messageManager;
$this->_collectionFactory = $collectionFactory;
$this->_date = $date;


/**
* customer register event handler.
*
* @param MagentoFrameworkEventObserver $observer
*/
public function execute(MagentoFrameworkEventObserver $observer)

$data = $observer['account_controller'];
try
$paramData = $data->getRequest()->getParams();
if (!empty($paramData['is_seller']) && !empty($paramData['selling_categories']) && $paramData['is_seller'] == 1)
$customer = $observer->getCustomer();

//~ $profileurlcount = $this->_objectManager->create(
//~ 'WebkulMarketplaceModelSeller'
//~ )->getCollection();
//~ $profileurlcount->addFieldToFilter(
//~ 'selling_categories',
//~ $paramData['selling_categories']
//~ );
//~ if (!$profileurlcount->getSize())
$status = $this->_objectManager->get(
'WebkulMarketplaceHelperData'
)->getIsPartnerApproval() ? 0 : 1;
$customerid = $customer->getId();
$model = $this->_objectManager->create(
'WebkulMarketplaceModelSeller'
);
$categories=implode(',',$paramData['selling_categories']);
$model->setData('is_seller', $status);
$model->setData('selling_categories',$categories);
$model->setData('seller_id', $customerid);
$model->setData('store_id', 0);
$model->setCreatedAt($this->_date->gmtDate());
$model->setUpdatedAt($this->_date->gmtDate());
if ($status == 0)
$model->setAdminNotification(1);

$model->save();
$loginUrl = $this->_objectManager->create(
'MagentoFrameworkUrlInterface'
)->getUrl("marketplace/account/dashboard");
$this->_objectManager->create(
'MagentoCustomerModelSession'
)->setBeforeAuthUrl($loginUrl);
$this->_objectManager->create(
'MagentoCustomerModelSession'
)->setAfterAuthUrl($loginUrl);

$helper = $this->_objectManager->get(
'WebkulMarketplaceHelperData'
);
//~ if ($helper->getAutomaticUrlRewrite())
//~ $this->createSellerPublicUrls($paramData['profileurl']);
//~
$adminStoremail = $helper->getAdminEmailId();
$adminEmail = $adminStoremail ? $adminStoremail : $helper->getDefaultTransEmailId();
$adminUsername = 'Admin';
$senderInfo = [
'name' => $customer->getFirstName().' '.$customer->getLastName(),
'email' => $customer->getEmail(),
];
$receiverInfo = [
'name' => $adminUsername,
'email' => $adminEmail,
];
$emailTemplateVariables['myvar1'] = $customer->getFirstName().' '.
$customer->getLastName();
$emailTemplateVariables['myvar2'] = $this->_objectManager->get(
'MagentoBackendModelUrl'
)->getUrl(
'customer/index/edit',
['id' => $customer->getId()]
);
$emailTemplateVariables['myvar3'] = 'Admin';

$this->_objectManager->create(
'WebkulMarketplaceHelperEmail'
)->sendNewSellerRequest(
$emailTemplateVariables,
$senderInfo,
$receiverInfo
);







//~ else
//~ $this->_messageManager->addError(
//~ __('This Shop URL already Exists.')
//~ );
//~

catch (Exception $e)
$this->_messageManager->addError($e->getMessage());





here I need to redirect the customer after register in magento 2
how i can set redirect (note: email verfication enabled)




how i can do this




now it redirects to the customer login page











share|improve this question
























  • If below answer not helpful then refer this link : magento.stackexchange.com/questions/131850/…

    – Sanjay Gohil
    yesterday











  • Try the below updated code and place it in your observer by removing your code

    – Prathap Gunasekaran
    yesterday











  • no here had some data process there ..... how i can add

    – prabhakaran7
    yesterday














1












1








1








Here is my code




customerregistersuceessobserver.php




 <?php


namespace WebkulMarketplaceObserverRewrite;
use WebkulMarketplaceObserverCustomerRegisterSuccessObserver;
use MagentoFrameworkEventObserverInterface;
use WebkulMarketplaceModelResourceModelSellerCollectionFactory;


class CustomerRewriteRegisterSuccessObserver extends CustomerRegisterSuccessObserver
{
/**
* @var ObjectManagerInterface
*/
protected $_objectManager;

/**
* @var CollectionFactory
*/
protected $_collectionFactory;

/**
* @var MagentoFrameworkStdlibDateTimeDateTime
*/
protected $_date;

/**
* @var MagentoStoreModelStoreManagerInterface
*/
protected $_storeManager;

/**
* @var MagentoFrameworkMessageManagerInterface
*/
private $_messageManager;

/**
* @param MagentoFrameworkObjectManagerInterface $objectManager
* @param MagentoFrameworkStdlibDateTimeDateTime $date
* @param MagentoStoreModelStoreManagerInterface $storeManager
* @param MagentoFrameworkMessageManagerInterface $messageManager,
* @param CollectionFactory $collectionFactory
*/
public function __construct(
MagentoFrameworkObjectManagerInterface $objectManager,
MagentoFrameworkStdlibDateTimeDateTime $date,
MagentoStoreModelStoreManagerInterface $storeManager,
MagentoFrameworkMessageManagerInterface $messageManager,
CollectionFactory $collectionFactory
)
$this->_objectManager = $objectManager;
$this->_storeManager = $storeManager;
$this->_messageManager = $messageManager;
$this->_collectionFactory = $collectionFactory;
$this->_date = $date;


/**
* customer register event handler.
*
* @param MagentoFrameworkEventObserver $observer
*/
public function execute(MagentoFrameworkEventObserver $observer)

$data = $observer['account_controller'];
try
$paramData = $data->getRequest()->getParams();
if (!empty($paramData['is_seller']) && !empty($paramData['selling_categories']) && $paramData['is_seller'] == 1)
$customer = $observer->getCustomer();

//~ $profileurlcount = $this->_objectManager->create(
//~ 'WebkulMarketplaceModelSeller'
//~ )->getCollection();
//~ $profileurlcount->addFieldToFilter(
//~ 'selling_categories',
//~ $paramData['selling_categories']
//~ );
//~ if (!$profileurlcount->getSize())
$status = $this->_objectManager->get(
'WebkulMarketplaceHelperData'
)->getIsPartnerApproval() ? 0 : 1;
$customerid = $customer->getId();
$model = $this->_objectManager->create(
'WebkulMarketplaceModelSeller'
);
$categories=implode(',',$paramData['selling_categories']);
$model->setData('is_seller', $status);
$model->setData('selling_categories',$categories);
$model->setData('seller_id', $customerid);
$model->setData('store_id', 0);
$model->setCreatedAt($this->_date->gmtDate());
$model->setUpdatedAt($this->_date->gmtDate());
if ($status == 0)
$model->setAdminNotification(1);

$model->save();
$loginUrl = $this->_objectManager->create(
'MagentoFrameworkUrlInterface'
)->getUrl("marketplace/account/dashboard");
$this->_objectManager->create(
'MagentoCustomerModelSession'
)->setBeforeAuthUrl($loginUrl);
$this->_objectManager->create(
'MagentoCustomerModelSession'
)->setAfterAuthUrl($loginUrl);

$helper = $this->_objectManager->get(
'WebkulMarketplaceHelperData'
);
//~ if ($helper->getAutomaticUrlRewrite())
//~ $this->createSellerPublicUrls($paramData['profileurl']);
//~
$adminStoremail = $helper->getAdminEmailId();
$adminEmail = $adminStoremail ? $adminStoremail : $helper->getDefaultTransEmailId();
$adminUsername = 'Admin';
$senderInfo = [
'name' => $customer->getFirstName().' '.$customer->getLastName(),
'email' => $customer->getEmail(),
];
$receiverInfo = [
'name' => $adminUsername,
'email' => $adminEmail,
];
$emailTemplateVariables['myvar1'] = $customer->getFirstName().' '.
$customer->getLastName();
$emailTemplateVariables['myvar2'] = $this->_objectManager->get(
'MagentoBackendModelUrl'
)->getUrl(
'customer/index/edit',
['id' => $customer->getId()]
);
$emailTemplateVariables['myvar3'] = 'Admin';

$this->_objectManager->create(
'WebkulMarketplaceHelperEmail'
)->sendNewSellerRequest(
$emailTemplateVariables,
$senderInfo,
$receiverInfo
);







//~ else
//~ $this->_messageManager->addError(
//~ __('This Shop URL already Exists.')
//~ );
//~

catch (Exception $e)
$this->_messageManager->addError($e->getMessage());





here I need to redirect the customer after register in magento 2
how i can set redirect (note: email verfication enabled)




how i can do this




now it redirects to the customer login page











share|improve this question
















Here is my code




customerregistersuceessobserver.php




 <?php


namespace WebkulMarketplaceObserverRewrite;
use WebkulMarketplaceObserverCustomerRegisterSuccessObserver;
use MagentoFrameworkEventObserverInterface;
use WebkulMarketplaceModelResourceModelSellerCollectionFactory;


class CustomerRewriteRegisterSuccessObserver extends CustomerRegisterSuccessObserver
{
/**
* @var ObjectManagerInterface
*/
protected $_objectManager;

/**
* @var CollectionFactory
*/
protected $_collectionFactory;

/**
* @var MagentoFrameworkStdlibDateTimeDateTime
*/
protected $_date;

/**
* @var MagentoStoreModelStoreManagerInterface
*/
protected $_storeManager;

/**
* @var MagentoFrameworkMessageManagerInterface
*/
private $_messageManager;

/**
* @param MagentoFrameworkObjectManagerInterface $objectManager
* @param MagentoFrameworkStdlibDateTimeDateTime $date
* @param MagentoStoreModelStoreManagerInterface $storeManager
* @param MagentoFrameworkMessageManagerInterface $messageManager,
* @param CollectionFactory $collectionFactory
*/
public function __construct(
MagentoFrameworkObjectManagerInterface $objectManager,
MagentoFrameworkStdlibDateTimeDateTime $date,
MagentoStoreModelStoreManagerInterface $storeManager,
MagentoFrameworkMessageManagerInterface $messageManager,
CollectionFactory $collectionFactory
)
$this->_objectManager = $objectManager;
$this->_storeManager = $storeManager;
$this->_messageManager = $messageManager;
$this->_collectionFactory = $collectionFactory;
$this->_date = $date;


/**
* customer register event handler.
*
* @param MagentoFrameworkEventObserver $observer
*/
public function execute(MagentoFrameworkEventObserver $observer)

$data = $observer['account_controller'];
try
$paramData = $data->getRequest()->getParams();
if (!empty($paramData['is_seller']) && !empty($paramData['selling_categories']) && $paramData['is_seller'] == 1)
$customer = $observer->getCustomer();

//~ $profileurlcount = $this->_objectManager->create(
//~ 'WebkulMarketplaceModelSeller'
//~ )->getCollection();
//~ $profileurlcount->addFieldToFilter(
//~ 'selling_categories',
//~ $paramData['selling_categories']
//~ );
//~ if (!$profileurlcount->getSize())
$status = $this->_objectManager->get(
'WebkulMarketplaceHelperData'
)->getIsPartnerApproval() ? 0 : 1;
$customerid = $customer->getId();
$model = $this->_objectManager->create(
'WebkulMarketplaceModelSeller'
);
$categories=implode(',',$paramData['selling_categories']);
$model->setData('is_seller', $status);
$model->setData('selling_categories',$categories);
$model->setData('seller_id', $customerid);
$model->setData('store_id', 0);
$model->setCreatedAt($this->_date->gmtDate());
$model->setUpdatedAt($this->_date->gmtDate());
if ($status == 0)
$model->setAdminNotification(1);

$model->save();
$loginUrl = $this->_objectManager->create(
'MagentoFrameworkUrlInterface'
)->getUrl("marketplace/account/dashboard");
$this->_objectManager->create(
'MagentoCustomerModelSession'
)->setBeforeAuthUrl($loginUrl);
$this->_objectManager->create(
'MagentoCustomerModelSession'
)->setAfterAuthUrl($loginUrl);

$helper = $this->_objectManager->get(
'WebkulMarketplaceHelperData'
);
//~ if ($helper->getAutomaticUrlRewrite())
//~ $this->createSellerPublicUrls($paramData['profileurl']);
//~
$adminStoremail = $helper->getAdminEmailId();
$adminEmail = $adminStoremail ? $adminStoremail : $helper->getDefaultTransEmailId();
$adminUsername = 'Admin';
$senderInfo = [
'name' => $customer->getFirstName().' '.$customer->getLastName(),
'email' => $customer->getEmail(),
];
$receiverInfo = [
'name' => $adminUsername,
'email' => $adminEmail,
];
$emailTemplateVariables['myvar1'] = $customer->getFirstName().' '.
$customer->getLastName();
$emailTemplateVariables['myvar2'] = $this->_objectManager->get(
'MagentoBackendModelUrl'
)->getUrl(
'customer/index/edit',
['id' => $customer->getId()]
);
$emailTemplateVariables['myvar3'] = 'Admin';

$this->_objectManager->create(
'WebkulMarketplaceHelperEmail'
)->sendNewSellerRequest(
$emailTemplateVariables,
$senderInfo,
$receiverInfo
);







//~ else
//~ $this->_messageManager->addError(
//~ __('This Shop URL already Exists.')
//~ );
//~

catch (Exception $e)
$this->_messageManager->addError($e->getMessage());





here I need to redirect the customer after register in magento 2
how i can set redirect (note: email verfication enabled)




how i can do this




now it redirects to the customer login page








magento2 customer event-observer redirect






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday







prabhakaran7

















asked yesterday









prabhakaran7prabhakaran7

29312




29312












  • If below answer not helpful then refer this link : magento.stackexchange.com/questions/131850/…

    – Sanjay Gohil
    yesterday











  • Try the below updated code and place it in your observer by removing your code

    – Prathap Gunasekaran
    yesterday











  • no here had some data process there ..... how i can add

    – prabhakaran7
    yesterday


















  • If below answer not helpful then refer this link : magento.stackexchange.com/questions/131850/…

    – Sanjay Gohil
    yesterday











  • Try the below updated code and place it in your observer by removing your code

    – Prathap Gunasekaran
    yesterday











  • no here had some data process there ..... how i can add

    – prabhakaran7
    yesterday

















If below answer not helpful then refer this link : magento.stackexchange.com/questions/131850/…

– Sanjay Gohil
yesterday





If below answer not helpful then refer this link : magento.stackexchange.com/questions/131850/…

– Sanjay Gohil
yesterday













Try the below updated code and place it in your observer by removing your code

– Prathap Gunasekaran
yesterday





Try the below updated code and place it in your observer by removing your code

– Prathap Gunasekaran
yesterday













no here had some data process there ..... how i can add

– prabhakaran7
yesterday






no here had some data process there ..... how i can add

– prabhakaran7
yesterday











2 Answers
2






active

oldest

votes


















0














Try this,



Add the below code to observer, and event must be



customer_register_success



<?php
namespace VendorModuleNameObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoFrameworkExceptionInputException;
class LoginSuccess implements ObserverInterface

protected $_urlInterface;
protected $_response;
public function __construct(
MagentoCustomerModelSession $customerSession,
MagentoFrameworkUrlInterface $urlInterface,
MagentoFrameworkAppResponseFactory $response
)
$this->_urlInterface = $urlInterface;
$this->_response = $response;
$this->customerSession = $customerSession;


public function execute(MagentoFrameworkEventObserver $observer)

if ($this->customerSession->isLoggedIn())
$redirectUrl = $this->_urlInterface->getUrl('custom_routename/controller');
$this->_response->create()
->setRedirect($redirectUrl)
->sendResponse();
exit(0);
return $this;





Hope this helps.






share|improve this answer

























  • it will work for after customer registration

    – prabhakaran7
    yesterday











  • Try it and let me know and add the below code in customer_register_success observer

    – Prathap Gunasekaran
    yesterday






  • 1





    _objectManager->create( 'MagentoFrameworkUrlInterface' )->getUrl("marketplace/account/login"); // can i change the path here'

    – prabhakaran7
    yesterday











  • Use the above code and replace this <custom_routename/controller> with your custom route

    – Prathap Gunasekaran
    yesterday











  • @prabhakaran7 you can try, $loginUrl = $this->_objectManager->create( 'MagentoFrameworkUrlInterface')->getUrl("your_custom_url");

    – magefms
    yesterday



















0















Using Plugin :-




di.xml :



<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCustomerModelAccountRedirect">
<plugin name="NewAcctRedirectPlug" type="YourModulePluginRedirect" disabled="false" sortOrder="1"/>
</type>

</config>


events.xml:



<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="customer_register_success">
<observer name="custom_redirect_register_success" instance="YourModuleObserverRegister" disabled="false"/>
</event>
</config>


Register.php:



<?php

namespace YourModuleObserver;


use MagentoFrameworkEventObserverInterface;
use MagentoFrameworkRegistry;

class Register implements ObserverInterface

protected $coreRegistry;

public function __construct(Registry $registry)

$this->coreRegistry = $registry;


public function execute(MagentoFrameworkEventObserver $observer)

$this->coreRegistry->register('is_new_account', true);




Redirect.php:



<?php

namespace YourModulePlugin;

use MagentoFrameworkControllerResultFactory;
use MagentoFrameworkRegistry;
use MagentoFrameworkUrlInterface;

class Redirect

protected $coreRegistry;

protected $url;

protected $resultFactory;

public function __construct(Registry $registry, UrlInterface $url, ResultFactory $resultFactory)

$this->coreRegistry = $registry;
$this->url = $url;
$this->resultFactory = $resultFactory;


public function aroundGetRedirect ($subject, Closure $proceed)

if ($this->coreRegistry->registry('is_new_account'))
/** @var MagentoFrameworkControllerResultRedirect $result */
$result = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$result->setUrl($this->url->getUrl('custom/path'));
return $result;


return $proceed();







share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270058%2fhow-to-redirect-customer-on-custom-page-after-registration-in-magento-2%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Try this,



    Add the below code to observer, and event must be



    customer_register_success



    <?php
    namespace VendorModuleNameObserver;
    use MagentoFrameworkEventObserverInterface;
    use MagentoFrameworkExceptionInputException;
    class LoginSuccess implements ObserverInterface

    protected $_urlInterface;
    protected $_response;
    public function __construct(
    MagentoCustomerModelSession $customerSession,
    MagentoFrameworkUrlInterface $urlInterface,
    MagentoFrameworkAppResponseFactory $response
    )
    $this->_urlInterface = $urlInterface;
    $this->_response = $response;
    $this->customerSession = $customerSession;


    public function execute(MagentoFrameworkEventObserver $observer)

    if ($this->customerSession->isLoggedIn())
    $redirectUrl = $this->_urlInterface->getUrl('custom_routename/controller');
    $this->_response->create()
    ->setRedirect($redirectUrl)
    ->sendResponse();
    exit(0);
    return $this;





    Hope this helps.






    share|improve this answer

























    • it will work for after customer registration

      – prabhakaran7
      yesterday











    • Try it and let me know and add the below code in customer_register_success observer

      – Prathap Gunasekaran
      yesterday






    • 1





      _objectManager->create( 'MagentoFrameworkUrlInterface' )->getUrl("marketplace/account/login"); // can i change the path here'

      – prabhakaran7
      yesterday











    • Use the above code and replace this <custom_routename/controller> with your custom route

      – Prathap Gunasekaran
      yesterday











    • @prabhakaran7 you can try, $loginUrl = $this->_objectManager->create( 'MagentoFrameworkUrlInterface')->getUrl("your_custom_url");

      – magefms
      yesterday
















    0














    Try this,



    Add the below code to observer, and event must be



    customer_register_success



    <?php
    namespace VendorModuleNameObserver;
    use MagentoFrameworkEventObserverInterface;
    use MagentoFrameworkExceptionInputException;
    class LoginSuccess implements ObserverInterface

    protected $_urlInterface;
    protected $_response;
    public function __construct(
    MagentoCustomerModelSession $customerSession,
    MagentoFrameworkUrlInterface $urlInterface,
    MagentoFrameworkAppResponseFactory $response
    )
    $this->_urlInterface = $urlInterface;
    $this->_response = $response;
    $this->customerSession = $customerSession;


    public function execute(MagentoFrameworkEventObserver $observer)

    if ($this->customerSession->isLoggedIn())
    $redirectUrl = $this->_urlInterface->getUrl('custom_routename/controller');
    $this->_response->create()
    ->setRedirect($redirectUrl)
    ->sendResponse();
    exit(0);
    return $this;





    Hope this helps.






    share|improve this answer

























    • it will work for after customer registration

      – prabhakaran7
      yesterday











    • Try it and let me know and add the below code in customer_register_success observer

      – Prathap Gunasekaran
      yesterday






    • 1





      _objectManager->create( 'MagentoFrameworkUrlInterface' )->getUrl("marketplace/account/login"); // can i change the path here'

      – prabhakaran7
      yesterday











    • Use the above code and replace this <custom_routename/controller> with your custom route

      – Prathap Gunasekaran
      yesterday











    • @prabhakaran7 you can try, $loginUrl = $this->_objectManager->create( 'MagentoFrameworkUrlInterface')->getUrl("your_custom_url");

      – magefms
      yesterday














    0












    0








    0







    Try this,



    Add the below code to observer, and event must be



    customer_register_success



    <?php
    namespace VendorModuleNameObserver;
    use MagentoFrameworkEventObserverInterface;
    use MagentoFrameworkExceptionInputException;
    class LoginSuccess implements ObserverInterface

    protected $_urlInterface;
    protected $_response;
    public function __construct(
    MagentoCustomerModelSession $customerSession,
    MagentoFrameworkUrlInterface $urlInterface,
    MagentoFrameworkAppResponseFactory $response
    )
    $this->_urlInterface = $urlInterface;
    $this->_response = $response;
    $this->customerSession = $customerSession;


    public function execute(MagentoFrameworkEventObserver $observer)

    if ($this->customerSession->isLoggedIn())
    $redirectUrl = $this->_urlInterface->getUrl('custom_routename/controller');
    $this->_response->create()
    ->setRedirect($redirectUrl)
    ->sendResponse();
    exit(0);
    return $this;





    Hope this helps.






    share|improve this answer















    Try this,



    Add the below code to observer, and event must be



    customer_register_success



    <?php
    namespace VendorModuleNameObserver;
    use MagentoFrameworkEventObserverInterface;
    use MagentoFrameworkExceptionInputException;
    class LoginSuccess implements ObserverInterface

    protected $_urlInterface;
    protected $_response;
    public function __construct(
    MagentoCustomerModelSession $customerSession,
    MagentoFrameworkUrlInterface $urlInterface,
    MagentoFrameworkAppResponseFactory $response
    )
    $this->_urlInterface = $urlInterface;
    $this->_response = $response;
    $this->customerSession = $customerSession;


    public function execute(MagentoFrameworkEventObserver $observer)

    if ($this->customerSession->isLoggedIn())
    $redirectUrl = $this->_urlInterface->getUrl('custom_routename/controller');
    $this->_response->create()
    ->setRedirect($redirectUrl)
    ->sendResponse();
    exit(0);
    return $this;





    Hope this helps.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited yesterday

























    answered yesterday









    Prathap GunasekaranPrathap Gunasekaran

    1,8721618




    1,8721618












    • it will work for after customer registration

      – prabhakaran7
      yesterday











    • Try it and let me know and add the below code in customer_register_success observer

      – Prathap Gunasekaran
      yesterday






    • 1





      _objectManager->create( 'MagentoFrameworkUrlInterface' )->getUrl("marketplace/account/login"); // can i change the path here'

      – prabhakaran7
      yesterday











    • Use the above code and replace this <custom_routename/controller> with your custom route

      – Prathap Gunasekaran
      yesterday











    • @prabhakaran7 you can try, $loginUrl = $this->_objectManager->create( 'MagentoFrameworkUrlInterface')->getUrl("your_custom_url");

      – magefms
      yesterday


















    • it will work for after customer registration

      – prabhakaran7
      yesterday











    • Try it and let me know and add the below code in customer_register_success observer

      – Prathap Gunasekaran
      yesterday






    • 1





      _objectManager->create( 'MagentoFrameworkUrlInterface' )->getUrl("marketplace/account/login"); // can i change the path here'

      – prabhakaran7
      yesterday











    • Use the above code and replace this <custom_routename/controller> with your custom route

      – Prathap Gunasekaran
      yesterday











    • @prabhakaran7 you can try, $loginUrl = $this->_objectManager->create( 'MagentoFrameworkUrlInterface')->getUrl("your_custom_url");

      – magefms
      yesterday

















    it will work for after customer registration

    – prabhakaran7
    yesterday





    it will work for after customer registration

    – prabhakaran7
    yesterday













    Try it and let me know and add the below code in customer_register_success observer

    – Prathap Gunasekaran
    yesterday





    Try it and let me know and add the below code in customer_register_success observer

    – Prathap Gunasekaran
    yesterday




    1




    1





    _objectManager->create( 'MagentoFrameworkUrlInterface' )->getUrl("marketplace/account/login"); // can i change the path here'

    – prabhakaran7
    yesterday





    _objectManager->create( 'MagentoFrameworkUrlInterface' )->getUrl("marketplace/account/login"); // can i change the path here'

    – prabhakaran7
    yesterday













    Use the above code and replace this <custom_routename/controller> with your custom route

    – Prathap Gunasekaran
    yesterday





    Use the above code and replace this <custom_routename/controller> with your custom route

    – Prathap Gunasekaran
    yesterday













    @prabhakaran7 you can try, $loginUrl = $this->_objectManager->create( 'MagentoFrameworkUrlInterface')->getUrl("your_custom_url");

    – magefms
    yesterday






    @prabhakaran7 you can try, $loginUrl = $this->_objectManager->create( 'MagentoFrameworkUrlInterface')->getUrl("your_custom_url");

    – magefms
    yesterday














    0















    Using Plugin :-




    di.xml :



    <?xml version="1.0"?>

    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <type name="MagentoCustomerModelAccountRedirect">
    <plugin name="NewAcctRedirectPlug" type="YourModulePluginRedirect" disabled="false" sortOrder="1"/>
    </type>

    </config>


    events.xml:



    <?xml version="1.0"?>

    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="customer_register_success">
    <observer name="custom_redirect_register_success" instance="YourModuleObserverRegister" disabled="false"/>
    </event>
    </config>


    Register.php:



    <?php

    namespace YourModuleObserver;


    use MagentoFrameworkEventObserverInterface;
    use MagentoFrameworkRegistry;

    class Register implements ObserverInterface

    protected $coreRegistry;

    public function __construct(Registry $registry)

    $this->coreRegistry = $registry;


    public function execute(MagentoFrameworkEventObserver $observer)

    $this->coreRegistry->register('is_new_account', true);




    Redirect.php:



    <?php

    namespace YourModulePlugin;

    use MagentoFrameworkControllerResultFactory;
    use MagentoFrameworkRegistry;
    use MagentoFrameworkUrlInterface;

    class Redirect

    protected $coreRegistry;

    protected $url;

    protected $resultFactory;

    public function __construct(Registry $registry, UrlInterface $url, ResultFactory $resultFactory)

    $this->coreRegistry = $registry;
    $this->url = $url;
    $this->resultFactory = $resultFactory;


    public function aroundGetRedirect ($subject, Closure $proceed)

    if ($this->coreRegistry->registry('is_new_account'))
    /** @var MagentoFrameworkControllerResultRedirect $result */
    $result = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
    $result->setUrl($this->url->getUrl('custom/path'));
    return $result;


    return $proceed();







    share|improve this answer



























      0















      Using Plugin :-




      di.xml :



      <?xml version="1.0"?>

      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

      <type name="MagentoCustomerModelAccountRedirect">
      <plugin name="NewAcctRedirectPlug" type="YourModulePluginRedirect" disabled="false" sortOrder="1"/>
      </type>

      </config>


      events.xml:



      <?xml version="1.0"?>

      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
      <event name="customer_register_success">
      <observer name="custom_redirect_register_success" instance="YourModuleObserverRegister" disabled="false"/>
      </event>
      </config>


      Register.php:



      <?php

      namespace YourModuleObserver;


      use MagentoFrameworkEventObserverInterface;
      use MagentoFrameworkRegistry;

      class Register implements ObserverInterface

      protected $coreRegistry;

      public function __construct(Registry $registry)

      $this->coreRegistry = $registry;


      public function execute(MagentoFrameworkEventObserver $observer)

      $this->coreRegistry->register('is_new_account', true);




      Redirect.php:



      <?php

      namespace YourModulePlugin;

      use MagentoFrameworkControllerResultFactory;
      use MagentoFrameworkRegistry;
      use MagentoFrameworkUrlInterface;

      class Redirect

      protected $coreRegistry;

      protected $url;

      protected $resultFactory;

      public function __construct(Registry $registry, UrlInterface $url, ResultFactory $resultFactory)

      $this->coreRegistry = $registry;
      $this->url = $url;
      $this->resultFactory = $resultFactory;


      public function aroundGetRedirect ($subject, Closure $proceed)

      if ($this->coreRegistry->registry('is_new_account'))
      /** @var MagentoFrameworkControllerResultRedirect $result */
      $result = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
      $result->setUrl($this->url->getUrl('custom/path'));
      return $result;


      return $proceed();







      share|improve this answer

























        0












        0








        0








        Using Plugin :-




        di.xml :



        <?xml version="1.0"?>

        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

        <type name="MagentoCustomerModelAccountRedirect">
        <plugin name="NewAcctRedirectPlug" type="YourModulePluginRedirect" disabled="false" sortOrder="1"/>
        </type>

        </config>


        events.xml:



        <?xml version="1.0"?>

        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
        <event name="customer_register_success">
        <observer name="custom_redirect_register_success" instance="YourModuleObserverRegister" disabled="false"/>
        </event>
        </config>


        Register.php:



        <?php

        namespace YourModuleObserver;


        use MagentoFrameworkEventObserverInterface;
        use MagentoFrameworkRegistry;

        class Register implements ObserverInterface

        protected $coreRegistry;

        public function __construct(Registry $registry)

        $this->coreRegistry = $registry;


        public function execute(MagentoFrameworkEventObserver $observer)

        $this->coreRegistry->register('is_new_account', true);




        Redirect.php:



        <?php

        namespace YourModulePlugin;

        use MagentoFrameworkControllerResultFactory;
        use MagentoFrameworkRegistry;
        use MagentoFrameworkUrlInterface;

        class Redirect

        protected $coreRegistry;

        protected $url;

        protected $resultFactory;

        public function __construct(Registry $registry, UrlInterface $url, ResultFactory $resultFactory)

        $this->coreRegistry = $registry;
        $this->url = $url;
        $this->resultFactory = $resultFactory;


        public function aroundGetRedirect ($subject, Closure $proceed)

        if ($this->coreRegistry->registry('is_new_account'))
        /** @var MagentoFrameworkControllerResultRedirect $result */
        $result = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
        $result->setUrl($this->url->getUrl('custom/path'));
        return $result;


        return $proceed();







        share|improve this answer














        Using Plugin :-




        di.xml :



        <?xml version="1.0"?>

        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

        <type name="MagentoCustomerModelAccountRedirect">
        <plugin name="NewAcctRedirectPlug" type="YourModulePluginRedirect" disabled="false" sortOrder="1"/>
        </type>

        </config>


        events.xml:



        <?xml version="1.0"?>

        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
        <event name="customer_register_success">
        <observer name="custom_redirect_register_success" instance="YourModuleObserverRegister" disabled="false"/>
        </event>
        </config>


        Register.php:



        <?php

        namespace YourModuleObserver;


        use MagentoFrameworkEventObserverInterface;
        use MagentoFrameworkRegistry;

        class Register implements ObserverInterface

        protected $coreRegistry;

        public function __construct(Registry $registry)

        $this->coreRegistry = $registry;


        public function execute(MagentoFrameworkEventObserver $observer)

        $this->coreRegistry->register('is_new_account', true);




        Redirect.php:



        <?php

        namespace YourModulePlugin;

        use MagentoFrameworkControllerResultFactory;
        use MagentoFrameworkRegistry;
        use MagentoFrameworkUrlInterface;

        class Redirect

        protected $coreRegistry;

        protected $url;

        protected $resultFactory;

        public function __construct(Registry $registry, UrlInterface $url, ResultFactory $resultFactory)

        $this->coreRegistry = $registry;
        $this->url = $url;
        $this->resultFactory = $resultFactory;


        public function aroundGetRedirect ($subject, Closure $proceed)

        if ($this->coreRegistry->registry('is_new_account'))
        /** @var MagentoFrameworkControllerResultRedirect $result */
        $result = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
        $result->setUrl($this->url->getUrl('custom/path'));
        return $result;


        return $proceed();








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        Rk RathodRk Rathod

        1,423214




        1,423214



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270058%2fhow-to-redirect-customer-on-custom-page-after-registration-in-magento-2%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form