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

Describe the problem you have found:

We cannot use $content array for our fields display. $content works for all other template files. Rather, we need to use $user_profile. And so, if we are trying to display a field with a machine name 'field_cool', we would try and render it this way:

<?php
render
($user_profile['field_cool']);
?>
Files: 
CommentFileSizeAuthor
#11 user_profile-1123092-11.patch1.28 KBmichaellenahan
PASSED: [[SimpleTest]]: [MySQL] 33,138 pass(es).
[ View ]
#8 user_profile-1123092-8.patch1.28 KBmichaellenahan
PASSED: [[SimpleTest]]: [MySQL] 32,941 pass(es).
[ View ]
#6 user_profile-1123092-6.patch749 bytesmichaellenahan
PASSED: [[SimpleTest]]: [MySQL] 33,206 pass(es).
[ View ]
#5 user_profile-1123092-5.patch1018 bytesmichaellenahan
PASSED: [[SimpleTest]]: [MySQL] 33,211 pass(es).
[ View ]

Comments

jhodgdon’s picture

Status:Active» Postponed (maintainer needs more info)

I don't understand what the documentation problem is here that you are trying to report?

varunarora’s picture

The documentation says:


Use render($user_profile) to print all profile items, or print a subset such as render($content['field_example'])

This needs to be:

Use render($user_profile) to print all profile items, or print a subset such as render($user_profile['field_example'])

right?

jhodgdon’s picture

Title:Documentation problem with user-profile.tpl.php» user-profile.tpl.php doc has confusing/misleading first paragraph
Version:7.x-dev» 8.x-dev
Status:Postponed (maintainer needs more info)» Active
Issue tags:+needs backport to D7

Thanks for the clarification!

I think that whole first paragraph probably needs to be rewritten.

LinL’s picture

Assigned:Unassigned» LinL

Working on this at Docs sprint & plan to finish today.

michaellenahan’s picture

Assigned:LinL» Unassigned
Status:Active» Needs review
StatusFileSize
new1018 bytes
PASSED: [[SimpleTest]]: [MySQL] 33,211 pass(es).
[ View ]

here's the patch.

michaellenahan’s picture

StatusFileSize
new749 bytes
PASSED: [[SimpleTest]]: [MySQL] 33,206 pass(es).
[ View ]

Sorry. Ignore the last patch please, here it is again. I'm new! Just learned about this today from the wonderful jhodgdon at DrupalCon London.

jhodgdon’s picture

Status:Needs review» Needs work

Thanks for your contribution -- Looks good! However, the revised line is longer than 80 characters, so it needs to be rewrapped.

michaellenahan’s picture

StatusFileSize
new1.28 KB
PASSED: [[SimpleTest]]: [MySQL] 32,941 pass(es).
[ View ]

Hi there, here's the patch again.

jhodgdon’s picture

Status:Needs work» Needs review

Setting to Needs Review so that the test bot will test the patch (which in this case means just making sure it's formatted correctly and applies).

jhodgdon’s picture

Status:Needs review» Needs work

One small mistake: "which" always needs a comma before it:

By default,
+ * $user_profile['summary'] is provided which contains data on the user's

I realize that this was from the original, not a result of the patch, but if you could fix it that would be nice!

Also, $user_profile['user_picture'] will fit on the 80-character line wrapping, by my editor's count.

Thanks!

michaellenahan’s picture

StatusFileSize
new1.28 KB
PASSED: [[SimpleTest]]: [MySQL] 33,138 pass(es).
[ View ]

Thanks, jhodgton. Here's the patch again.

jhodgdon’s picture

Status:Needs work» Needs review

setting to needs review so the test bot will launch. :)

jhodgdon’s picture

Status:Needs review» Reviewed & tested by the community

Whenever you upload a patch, please set the status to "needs review", which alerts both human and bots that the patch needs to be tested and reviewed. :)

Anyway, this patch looks fine to me (as long as the bot agrees). 7.x/8.x please...

catch’s picture

Version:8.x-dev» 7.x-dev

Committed to 8.x, moving to 7.x for webchick.

webchick’s picture

Status:Reviewed & tested by the community» Fixed

Committed and pushed to 7.x. Thanks! :)

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