User Profile avatar/picture Snippet

PLEASE NOTE! These snippets are user submitted. It is impossible to check them all, so please use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.


This php snippet checks to see if the user has a picture/avatar uploaded and displays it if they have.

Dependencies: No extra modules required but picture support must be enabled to allow users to upload their avatars/pictures:

A basic User Profile Page to help get you started

Please note: These snippets are user submitted. It is impossible to verify they all work as advertised, so please use at your own risk! Be advised that the snippets here may contain database queries specific to MySQL only.

This php snippet displays is a basic user_profile.tpl.php file to help get you started.

Requires the profile.module to be enabled and city, country custom single-line profile fields added.


  • Using a text editor copy and paste the code into user_profile.tpl.php file.
  • Change the custom profile field names to match the specific site. (Tip: go to administer -> settings -> profile and in the second column it will show the name of each field).
  • Change the div class names or the prefix text to suit.
<div class="custom_profiles">
<div class="fields"><?php print check_plain($account->name) ?></div>
<div class="fields">City: <?php print check_plain($account->profile_city) ?></div>
<div class="fields">Country: <?php print check_plain($account->profile_country) ?></div>
<div class="fields">Postcode: <?php print check_plain($account->profile_postcode) ?></div>

A starter template that reproduces a D5 profile

Client does not support authentication protocol requested by server...

You are installing a new install of Drupal and during setup receive the error

Client does not support authentication protocol requested by server; consider upgrading MySQL client.

You are probably using MySQL 4.1 or higher and need to reset the password to pre 4.1 style.

There's a quick way to fix this if you use recent versions of PhpMyAdmin and have the rights to edit MYSQL user information:

What do all those Unix commands mean?

You will notice references to Unix-like (*nix) commands in some documentation or forum posts and may feel intimidated by them. The authors of the docs, issues or forum postings do this to express clearly and concisely the steps needed to administer your system or fix the problems being discussed.

Having a better understanding of these *nix commands can help you understand what your hosting control panel or GUI FTP client does, and can help you be more productive. Hopefully this will help you become less intimidated by the command line.

Using Apache .htaccess files to stop proxies from caching pages

There are a number of situations that might result in visitors accessing a Drupal site via a caching web proxy. Even though such caches are typically a good thing for sites, sometimes these caching schemes can have undesirable side effects and you may find that instructing proxy servers not to cache pages is the only solution to some problems. (You can learn more about web caches and how they work.)

Some problems that caches may cause with Drupal sites include:

  • A change that a user made to a page may not be reflected immediately, forcing the user to wait some time to see content they contributed (such as a comment) appear on the site.
  • User identities become confused. A user may login under their username but when they access another page, the proxy server sends the cached page from another user's session, effectively switching the identities of the user.

Modules page is blank, says "page not found" or returns an error message

If you attempt to load admin/build/modules and get a blank page, a message that says "The requested page could not be found" or a server error, this is most likely a memory issue.

When viewing this page, modules are (since Drupal 5.x) only loaded if they are enabled (previously, even disabled modules were loaded). Even so, a fair amount of ancillary processing takes place on this page and can cause PHP to run out of available memory. Note that all modules' .info files are loaded whether or not the modules are enabled.

There are two fixes:

  1. Increase PHP's memory limit, e.g. to set it to 16MB try one of these:
    • memory_limit = 16M to your system's main php.ini file (recommended, if you have access. In case you don't, you can try to upload your own php.ini file in the root folder of your Drupal installation, but bear in mind that this will only have an effect if PHP is running as CGI)
    • ini_set('memory_limit', '16M'); in your sites/default/settings.php file (this doesn't work on all servers)
    • php_value memory_limit 16M in your .htaccess file in the Drupal root (this only works if PHP is running as an Apache module)


Subscribe with RSS Subscribe to RSS - Drupal 4.5.x or older