Customizing the user profile pages (a "before" and "after" example with screenshots)

This illustrative example shows how easy it is to override theme functions using the User_profile pages as an example.

Before

This is how the out-of-the-box user profile looks like, with extra profile fields, such as City, Country, Postcode, Position etc. added in. (please note that i couldn't fit the whole page into the one screenshot..there is an extra "background/more info." field that doesn't show in the BEFORE screen shot.

click to view the BEFORE screenshot in a new window

After

This is how the exact same user profile looks after overriding the theme and applying a simple user_profile.tpl.php file in my theme directory.

click to view the AFTER screenshot in a new window

How I did it

To override just the layout of the User Profile page..I created a template.php file with this in it:


<?php
/**
* Catch the theme_profile_profile function, and redirect through the template api
*/

function phptemplate_user_profile($account, $fields = array()) {
// Pass to phptemplate, including translating the parameters to an associative array. The element names are the names that the variables
// will be assigned within your template.

Specify 403 and 404 error pages

Drupal's page error messages are meant to be direct and to the point. If you want page error messages that are a little more user-friendly, Drupal allows you to customize them.

  1. Create two nodes, one for each kind of page error (403 and 404).
  2. Determine the ID number of the node you wish to redirect users to. One way to determine the node's ID number is to visit the node and look at the number after the last slash in your browser's address bar. This is your node's ID number.
  3. Now enter the paths to your nodes in the appropriate boxes on your error reporting settings page. For example, if the node ID number for 403 error codes is "83," you would type "node/83" into the "Default 403 (access denied) page" setting.
    • Drupal 6 mysite.com/admin/settings/error-reporting
    • Drupal 7 mysite.com/admin/config/system/site-information

Because you are creating nodes, they will show up in the tracker and popular content blocks and anywhere else real nodes would be display. If this isn't acceptable, there is a contributed module called Custom Error that avoids this problem.

Upgrading a theme to a new version

If you upgrade a site from one version of Drupal to another, you must take specific steps to make your theme compatible with the new version.

Always test the modifications on a separate development server before moving to a production site.

How can I change Drupal's character encoding? (UTF-8 and Unicode)

Several people have asked how to specify the character encoding that Drupal uses. The short answer is: you can't.

Drupal uses UTF-8 for encoding all its data. This is a Unicode encoding, so it can contain data in any language. You no longer need to worry about language specific encodings for your website (such as Big5, GB2312, Windows-1251 or 1256, ...). Also, when Drupal imports external XML data (such as RSS or XML-RPC), it is automatically converted into UTF-8 (iconv support for PHP will be required for most encodings).

Pages

Subscribe with RSS Subscribe to RSS - Designers/themers