How to get site URL – Magento

You can use the following function to get site urls .

Below given are the function with different arguments

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) – http://phpcodez/js/
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) – http://phpcodez/index.php/
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) – http://phpcodez/media/
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) – http://phpcodez/skin/
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)  -http://phpcodez/
$currentUrl = $this->helper(‘core/url’)->getCurrentUrl();

Share

Script to automatically delete a user – VBulletin

1)Create a file with desired name (let it be vb_delete.php) with the following code

require_once(‘class.forumops.php’);
$clientdata = unserialize($_POST[‘post’]);
$forum = new ForumOps();
$errmsg = $forum->delete_user($clientdata[‘username’]);
if ($errmsg) echo $errmsg;
else echo “User deleted successfully.
n”;

NOTE :You can download the script using the url http://wp.me/p1aZaf-1d

2)Upload the file to the server the vBulletin installed

3)Paste the below given code , immediately after the code that update the user details .

$clientdata = array( ‘username’ => $username);
$url=”http://www.example.com/forum/vb_delete.php”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, array(“post” => serialize($clientdata)));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
echo $store;
curl_close ($ch);
exit;*/
// http://www.example.com/forum/ is the location where vbulletin is installed

Share

VBulletin API for auto updating user details

1) Create a file with desired name (let it be vb_update.php) with the following code
require_once(‘class.forumops.php’);
$clientdata = unserialize($_POST[‘post’]);
foreach($clientdata as $key => $value)
{
$userdata[$key]=$value;
}
$forum = new ForumOps();
$errmsg = $forum->update_user($userdata);
if ($errmsg) echo $errmsg;
else echo “User Updated successfully.
n”;

NOTE :You can download the script using the url http://wp.me/p1aZaf-1d

2)Upload the file to the server the vBulletin installed

3)Paste the below given code , immediately after the code that update the user details .

$clientdata = array( ‘username’ =>$Username);
$clientdata[‘newusername’] = $newUsername;
$clientdata[‘password’] = $password;
$clientdata[’email’] = $email;
$url=”http://www.example.com/forum/vb_update.php”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, array(“post” => serialize($clientdata)));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
curl_close ($ch);

// http://www.example.com/forum/ is the location where vbulletin is installed

Share

Beginners' Guide , PHP Programmer , Zend Certified Engineer , Magento Certified Developer