4

What I want:
Admin should redirect my custom module url('adminhtml_module1/testimonial/index') instead of dashboard page after successfully admin login.

Any idea ? How can I do this ?

8

Short answer:

The redirect is done to the page selected in System > Configuration > Admin > Startup Page.

If you already defined a menu node for your admin page, you should be able to select it form the dropdown.

Further information:

The dropdown consists of system config values form the source model adminhtml/system_config_source_admin_page built in app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php

This iterates through all <menu> nodes from the admin config entries.

The corresponding XML config node is admin/startup/page where the corresponding URL for the redirect is retreived in Mage_Admin_Model_User.

The actual redirect happens in Mage_Adminhtml_IndexController:

/**
 * Admin area entry point
 * Always redirects to the startup page url
 */
public function indexAction()
{
    $session = Mage::getSingleton('admin/session');
    $url = $session->getUser()->getStartupPageUrl();
    if ($session->isFirstPageAfterLogin()) {
        // retain the "first page after login" value in session (before redirect)
        $session->setIsFirstPageAfterLogin(true);
    }
    $this->_redirect($url);
}
  • Thanks for best and deeply answer and If I change or set custom url as per your answer then any security admin login issue(admin login hacking problem) in future ? – Niraj Patel Dec 13 '15 at 11:43
  • This is more a question of how you defined the admin router. – Anna Völkl Dec 13 '15 at 13:00
  • Good explanation @AnnaVölkl +v1 – Amit Bera Dec 13 '15 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.