3

What is the file I have to modify in order to get Drupal to output a custom user page.

The default link to the file I need to change is:

http://www.example.com/?q=user/xx

Where xx is the user id.

This page is not dysplaying correctly and I want to fix it, but how do I know which file is Drupal calling?

Is there a reference guide on Drupal 7 default pages and links?

2 Answers 2

4

Here is a brief list of template suggestions for Drupal 7: http://drupal.org/node/1089656

If you are looking to theme the user page, there are multiple templates located in modules/user that can be overridden. The template you should probably start with is user-profile.tpl.php. Copy that file and paste it in your theme directory then edit it as you like and clear the cache and you should see the changes.

4

You shouldn't modify an existing file as modifying files in Drupal core or contrib module is not recommended. What you can and should do is overriding the (default) template(s) used on the user page. Usually, you copy the default templates files from the providing module's folder to your theme's folder and apply you change there. If your theme is based on an existing (contrib) theme, consider creating a sub-theme instead of changing files.

Figuring wich templates to override is a bit tricky, usually a page is composed of various elements produced separately using different templates. A template itself usually use bits of markup produced by other templates or theme functions. The Theme developer module can help you there as it provides a on-page overlay to easily view information about the template or theme function used to produce an element on the page. Also, you can't spare learning how Drupal structures the user information (ie. its data model) in order to figures how to effectively change the templates.

Keep in mind that templates files (.tpl.php) are templates and should notcontains business logic or data access. Data to be laid out by the templates should be provided by modules or preprocess functions in the template.php file of your theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.