Wednesday, January 6, 2016

Magento - How to find and check username logged in magento admin with username

- To get Admin users collection or all admin users details in magento,


$user_collect = Mage::getModel('admin/user')->getCollection();



- To get users admin role in magento,

$get_user_admin = Mage::getSingleton('admin/session')->getUser();
$
get_user_admin ->getRole()->getData('role_id');


- How to find and check username logged in magento admin,


Mage::getSingleton('core/session', array('name'=>'adminhtml'));
if(  Mage::getSingleton('admin/session')->isLoggedIn() )
{
    $get_user_admin = Mage::getSingleton('admin/session')->getUser();
    echo $current_user_admin = $get_user_admin->getData('username');

// It prints 'saurabh.bansal' if username of magento is 'saurabh.bansal'







MySQL: SELECT * FROM `table_name` WHERE start and end date within two dates

My query should include the following: Everything that starts between 2018-03-04 and 2018-03-10 Everything that is due between 2018-03-0...