How to automatic login in wordpress.



//if "test@example.com" is already registered

$user_email="test@example.com"

$pl_userid=email_exists($user_email);

wp_set_current_user($pl_userid, $user_email);

// set the WP login cookie
$secure_cookie = is_ssl() ? true : false;
wp_set_auth_cookie( $pl_userid, true, $secure_cookie );

do_action('wp_login', $user_email);

Advertisements

Get All Urls in Magento

Not secure Skin URL
<?php echo $this->getSkinUrl(‘images/sampleimage.jpg’) ?>

Secure Skin URL
<?php echo $this->getSkinUrl(‘images/ sampleimage.gif’,array(‘_secure’=>true)) ?>

Get  Current URL
<?php $current_url = Mage::helper(‘core/url’)->getCurrentUrl();?>

Get Home URL
<?php $home_url = Mage::helper(‘core/url’)->getHomeUrl();?>

Get Magento Media Url
<?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);?>

<?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);?>

Get Magento Skin Url
<?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>

Get Magento Store Url
<?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);?>