2011 in review


The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 3,900 times in 2011. If it were a NYC subway train, it would take about 3 trips to carry that many people.

Click here to see the complete report.

Joomla password check for wordpress


Hi to All,

Today we will see about joomla password check method for wordpress side.

Normally most of joomla website owners moving to wordpress. Joomla Users Migrating to wordpress users. I think most of the developers did joomla users to wordpress users. Like Firstname, Lastname, username and all information. But when we login from wordpress site, it does not work. So we have to use joomla MD5 password with SALT method. After you migrating the joomla users and wordpress users table. You need to put these code to wordpress includes directory.

Step 1: You have to open this file – /wp-includes/class-phpass.php. Check the end of the code with function. You have to replace this.

function CheckPassword($password, $stored_hash)
{
$hash = $this->crypt_private($password, $stored_hash);
if ($hash[0] == '*')
$hash = crypt($password, $stored_hash);

return $hash == $stored_hash;
}

to replace this code.

function CheckPassword($password, $stored_hash)
{
$password_for_check = $password;
if( @count( $pass_array = @explode(':',$stored_hash) ) == 2 ){
$joomla_pass = $pass_array[0];
$joomla_salt = $pass_array[1];
if($joomla_pass == md5($password_for_check.$joomla_salt))
return 1;
}

$hash = $this->crypt_private($password, $stored_hash);
if ($hash[0] == '*')
$hash = crypt($password, $stored_hash);

return $hash == $stored_hash;
}

Thats it. Now you can login with joomla username and password.

Before you migrating the joomla users to wordpress users, you have check the wp_users table column password. Because joomla MD5 password length is little high. but wordpress table column password length is too short. You have to increase it.

Note:
If we upgrade wordpress, password length again changed to too short. You have to increase the password column limit to 256 varchar.

That’s ALL. If anything you want to know, please comment here.

Thank you.

CS CART Vendor user creation via custom code – Multi Vendor Version


Hi there,

Today we will take a look about the user creation via code.

create a php file what ever you wants from the root of the cs cart folder.


define('AREA', 'A');
define('AREA_NAME', 'admin');
define('ACCOUNT_TYPE', 'admin');
require dirname(__FILE__) . '/prepare.php';
require dirname(__FILE__) . '/init.php';
$user_data['company'] = "Test";
$user_data['status'] = "D";
$user_data['company'] = "Test";
$user_data['lang_code'] = "EN";
$user_data['commission'] = "";
$user_data['commission_type'] = "";
$user_data['email'] = "manisanjai@gmail.com";
$user_data['phone'] = "9944509663";
$user_data['url'] = "";
$user_data['fax'] = "";
$user_data['address'] = "test, Test street";
$user_data['country'] = "IN";
$user_data['state'] = "Tamilnadu";
$user_data['zipcode'] = "6000028";
$user_data['company_description'] = "Test Company";
$user_data['categories'] = "";
$user_data['shippings'] = '';
$result = fn_update_company($user_data);
echo $result; // You can get the results.
}

Just copy and paste this code to your php file. Then execute the file from the browser. You can get the result as an array with user id and profile id.

That’s All.

I hope it helps some one.

Thanks.

How to create a cron for files and sql backup every day, every week or every minute on Linux


Hi to All,

Today i will explain how to handle the cron jobs on linux servers. It helps lot for Website development Guys. Here is the step by step process.

Target : We will create a cron for backup files and sql file using linux commands at every minute.

Step 1: Sql file generate every minute with certain location. We need to know database name, Database username and Database User Password.

Database Name: testdatabase
Database User Name: testdatabaseuser
Database User Password: testdatabasepassword

* * * * * mysqldump -u testdatabaseuser -ptestdatabasepassword testdatabase > /home/manimaran/public_html/$(date, +\%Y\%m\%d\%M\%S).sql

First * – minute (0-59),
Second * – hour (0-23),
Third * – day of the month (1-31),
Fourth * – month of the year (1-12),
Fifth * – day of the week (0-6 with 0=Sunday).

That’s it.

How to execute this code for Cron:

Execute this command line from Shell window : crontab -e
Then you can get the editor to edit some things. Here you can insert our cron code like this.

* * * * * mysqldump -u testdatabaseuser -ptestdatabasepassword testdatabase > /home/manimaran/public_html/$(date, +\%Y\%m\%d\%M\%S).sql

Just save it. The cron is Activated Now. If you want to see the cron is enable, please execute the below command

crontab -l

Then, you can see the list of cron jobs of activated. Here after the sql file generates certain location.

Step 2: Website files tar file generate every minute with certain location.

You have to insert some commands to crontab editor, what you have done so far. You can use like this way,

* * * * * tar -zcf /home/manimaran/public_html/backup-$(date -u +\%Y\%m\%d\%M\%S).tar /home/manimaran/public_html/

You should append this command to crontab editor(crontab -e). The tar file will generate every minute to certain location with specific date name.

That’s it. The cron job is ready for Back up files and sql file.

If any thing do you need let me know.

Thanks Guys.

CS CART user creation via custom code – Multi Vendor Version


Hi there,

Today we will take a look about the user creation via code.

create a php file what ever you wants from the root of the cs cart folder.


define('AREA', 'C');
define('AREA_NAME', 'customer');
require dirname(__FILE__) . '/prepare.php';
require dirname(__FILE__) . '/init.php';
$user_id = $notify_user = $ship_to_another = '';
$user_data = array( 'email' => 'manisanjai@gmail.com',
'password1' => '123456',
'password2' => '123456',
'birthday' => '14/01/1988',
'b_firstname' => 'Manimaran',
'b_lastname' => 'Kalimuthu',
'b_address' => '25, 2nd street',
'b_address_2' => 'test',
'b_city' => 'test',
'b_country' => 'IN',
'b_state' => 'Tamilnadu',
'b_zipcode' => '620008',
'b_phone' => '12345678',
'user_type' => 'C'
);
$_result = fn_update_user($user_id, $user_data, $auth, $ship_to_another,$notify_user);
print_r($_result); // You can get an array with profile id and user id.
}

Just copy and paste this code to your php file. Then execute the file from the browser. You can get the result as an array with user id and profile id.

That’s All.

I hope it helps some one.

Thanks.

Get Reviews for a product in magento


Hi Guys,
Here i have added some Magento Code for Get reviews collection or Reviews Summary collection data of a Product in Magento CMS. I hope it helps lot for beginners.

$_reviews = Mage::getModel('review/review')->getCollection()
->addStoreFilter(Mage::app()->getStore()->getId())
->addStatusFilter('approved')
->addEntityFilter('product', $_product->getId())
->setDateOrder(); // You can filter the results

foreach($_reviews as $re){
print_r($re->getData()); // You can get the results here
}