Archive for the ‘Web Development – PHP’ Category

 

Disable WordPress 3.1 admin bar for all users except admin

Tuesday, August 9th, 2011
function my_function_admin_bar($content) {
return ( current_user_can("administrator") ) ? $content : false;
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');

Reference: http://www.binbert.com/blog/2011/03/disable-wordpress-3-1-admin-bar-for-all-users-except-admin/

codeignitor IE session problem

Friday, June 3rd, 2011

was facing same problem of session with IE 8. Many threads suggested for underscore, timezone difference. Real problem is timezone difference. CI creates cookie with server time and IE checks expiry related to client timezone. And here issues comes. You can not change time zone of online server to match clients from all over world. The better solution is change cookie / session expiry time. By default it is two hours. Change it to 24 hours and problem will be solved.

In config.php file change value of following variable

from two hours

$config[‘sess_expiration’]      = 7200;

to 24 hours

$config[‘sess_expiration’]      = 3600 * 24;

codeigniter Class ‘MY_Controller’ not found

Wednesday, June 1st, 2011

If you are using codeigniter 2.0 and getting following error

Fatal error: Class ‘MY_Controller’ not found in application\controllers\welcome.php on line 4

then reasons can be

1. you are either not loading it properly (via an __autoload() or manually using include())

2. it is in the wrong place.

In CI 2.0 MY_Controller should be in application/core. In previous version it should be in application/library

__PHP_Incomplete_Class Errors

Thursday, May 5th, 2011

If you get such a error That means class not defined before starting session.

If classes stored  in a session you must define your class before the call to session start().

If you have  in configuration session auto_start = 1, you will have to disable that so you can define your classes before starting the session.

Another easiest workaround is to define  __autoload() function before session start(). This way the appropriate classes are loaded when needed and it will solve the error. also you do not need to make any changes in configuration file

wordpress sort posts by custom field numeric value

Thursday, April 14th, 2011

there is no default option in wordpress to set up sort order of post manually while adding post. Other options are sorting by title or date using query_post() function.  To set up custom sort order we can do this using custom field. Use following code

query_posts(orderby=meta_value&meta_key=sort_order&order=ASC’);

REMEMBER: if you use this function then you have to assign sort_order custom field to each post. Otherwise posts which do not have sort_order custom field will not be displayed.

the_content not responding to the “more tag” outside of WP

Thursday, April 14th, 2011

when used setup_postdata() , the_content ignore more tag

the more tag does not work on custom queries like that.

You can set the global $more variable to either 1 or 0 to turn the more functionality on or off. Do this right before your call to the content:

global $more;
$more = 1;
the_content();

0 means turn on
1 means turn off

Joomla Component Install – Unable to Find Install Package

Thursday, February 10th, 2011

Symptoms:

Joomla 1.5 fresh install was working fine and was able to install and uninstall mods, extensions templates, etc. just fine. After a few days of set up,  modifying my templates and adjusting my Global Settings, I was not able to upload any modules, extensions, templates, etc. and continuously received the ‘Unable to Find Install Package’. This was not a legacy issue.

The Solution:

During my setup, I had enabled my FTP but later turned it off in my Global Settings. However, what I discovered was that my FTP was not actually ‘turning off’. When I would deactivate it, and save my settings, the next time that I logged into my Global Settings, it would be back on. To resolve this, I went directly into my configuration.php file and manually adjusted the FTP settings.

var $ftp_enable = ’0′;
var $ftp_host = ”;
var $ftp_port = ”;
var $ftp_user = ”;
var $ftp_pass = ”;
var $ftp_root = ”;

So, in short — try adjusting your FTP settings directly in your configuration.php file.

I hope this helps someone else!

Details by

Miss Vicky

Magento Admin Flash 10 uploaded fix

Friday, January 21st, 2011

copy following files  from 1.2.1 or 1.3.*  version and issue will be solved

app/code/core/Mage/Adminhtml/Block/Media/Uploader.php
app/design/adminhtml/default/default/template/media/uploader.phtml
js/mage/adminhtml/flexuploader.js
js/mage/adminhtml/product.js
skin/adminhtml/default/default/media/uploader.swf
**** Backup existing files before overwriting with latest files so that if required you can revert  changes

How to reset Typo3 administrative password?

Monday, December 6th, 2010

simple and quick option for programmer is to reset directly from database. Execute following query and it will reset your password
update be_users set password=md5(‘your new password’) where username = ‘admin’;

This will change your administrative password to your new password’.

Keep in mind that it is important for your installation security to change the password again once you are logged in the administrative area.

Magento – Default Stock Availability set to ‘in Stock’

Tuesday, September 21st, 2010
You need to add an attribute to the database:
insert into core_config_data
values ( null, 'default', 0, 'cataloginventory/item_options/is_in_stock', 1 );
Refresh the cache and you’ll see it works.
by
Conor Wyse
to set default quantity
insert into core_config_data
values ( null, 'default', 0, 'cataloginventory/item_options/qty', 10 );
you can change 10 to your choice
Site map | Blog
Copyright © 2008, COG IT Solutions Pvt. Ltd. All Rights Reserved
XHTML Validated