API page: http://api.drupal.org/api/drupal/modules--user--user-profile.tpl.php

Describe the problem you have found:

How the author of the post is describing '$user->field_example' to use for raw data for user pages. This is wrong since $user variable in this instance will grab the data from the user that is currently logged in - instead of the user that is the owner of the profile page that is being viewed.

#2 docFix-1278182-2.patch1.01 KBcashwilliams
PASSED: [[SimpleTest]]: [MySQL] 32,947 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


jhodgdon’s picture

Title: Documentation problem with user-profile.tpl.php » user-profile.tpl.php should use $account not $user in example
Version: 7.x-dev » 8.x-dev
Issue tags: +Novice, +needs backport to D7

Thanks! You are right, $user is the global variable representing the logged-in user. The available variables section should be referring to $account to make it clear it is not the global $user.

Looks like a good issue for a novice docs contributor...

cashwilliams’s picture

Status: Active » Needs review
1.01 KB
PASSED: [[SimpleTest]]: [MySQL] 32,947 pass(es). View


Seems strange though, that we call render($user_profile) rather than render($account_profile).

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

$user is a Drupal-wide global variable for the logged-in user. $user_profile is a variable set up by the theme preprocessing functions.

Anyway, the patch looks good, thanks! (d7/8)

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x and 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.