Login to another page besides the dashboard

droidman

Member
Is it possible anywhere on mw to set up the landing page after login ?
I don't usually take much time on the main dashboard for the admin and normal users also have complained to me about slow logins since the dashboard is loading a lot of data most of them don't really look into.
Going straight to the campaigns would be good for most users and in the admin setting up another faster page would also help me a lot.
I wanted to know if there is a way to do this besides messing with the php.
thanks
 
Possible only from PHP, the change is rather simple:

create the file apps/customer/config/main-custom.php and place this into it. Save and that's it. Safe on upgrades, etc.
PHP:
<?php defined('MW_PATH') || exit('No direct script access allowed');

return array(
    'components' => array(
        'customer' => array(
            'returnUrl' => array('campaigns/index'),
        ),
    ),
);
 
It worked for the login as a customer, directly to the /customer/ logged in and worked.
as an admin if i try to impersonate an user it goes to the dashboard, and as an admin how do i make the admin also go to a default page? thanks again
 
@droidman - we don't have any hook for that url BUT we can make one for future versions, so here's what you have to do:
1. Open /apps/backend/controllers/CustomersController.php and at line 327 you have:
PHP:
$this->redirect(Yii::app()->apps->getAppUrl('customer', 'dashboard/index', true));
replace that line with:
PHP:
$url = Yii::app()->apps->getAppUrl('customer', 'dashboard/index', true);
$url = Yii::app()->hooks->applyFilters('redirect_url_after_impersonate_customer', $url, $customer);
$this->redirect($url);
Then save your file.

Next, open apps/init-custom.php (create it if missing) and place this code inside:
PHP:
<?php

Yii::app()->hooks->addFilter('redirect_url_after_impersonate_customer', function($url, $customer){
   return Yii::app()->apps->getAppUrl('customer', 'campaigns/index', true);
});
 
Last edited:
How does your apps/init-custom.php file looks like now ?

I am pretty sure the change works, i tested it before i gave you the code.
 
Last edited:
i followed the steps and worked for the customers, for the backoffice it keeps sending me to the dashboard of the users, and when i login to the backoffice i keep going to the dashboard too. im going to see if i placed the code too low on the file or something similar
 
What i did was:
/apps/backend/controllers/CustomersController.php line 327
Code:
 //$this->redirect(Yii::app()->apps->getAppUrl('customer', 'dashboard/index', true));
        $url = Yii::app()->apps->getAppUrl('customer', 'dashboard/index', true);
        $url = Yii::app()->hooks->applyFilters('redirect_url_after_impersonate_customer', $url, $customer);
        $this->redirect($url);

apps/init.php
placed near the end of the file since if i put it anywhere on top it gives me a 500 error
Code:
$app->run();
Yii::app()->hooks->addFilter('redirect_url_after_impersonate_customer', function($url, $customer){
   return Yii::app()->apps->getAppUrl('customer', 'campaigns/index', true);
});
 
done, worked now, placed the code before
$app->run();
and now it works. only admin now goes to the dashboard, no problem, slow but i can live with it untill an new update or something.
Thanks
 
I am sorry, i guided you wrong, i see i kept saying apps/init.php when actually i should have said apps/init-custom.php.
Sorry for that.
 
Back
Top