Profile page now returns an array like the node listing and node detail pages. Template files remain unchanged; they are quite feature rich already.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

FileSize
2.78 KB

More sensible preprocess

chx’s picture

Status: Needs review » Reviewed & tested by the community

Now, that's nice.

Dries’s picture

I don't understand why this matters; index.php will call drupal_render_page() on the output anyway ... it is easier to understand the original code, IMO, but maybe I'm confused.

moshe weitzman’s picture

After this patch, hook_page_alter() can still alter any of the piece parts of the profile. For example, it can move some parts into the right region and others to the content_top or whatever.

Further, hook_page_alter() is an interesting swap point for alternate presentations like JSON and Atom. One can change #theme and vastly change how the page gets finally rendered. I have been experimenting a little with this. No patch yet.

dmitrig01’s picture

Status: Reviewed & tested by the community » Needs work

"After this patch, hook_page_alter() can still alter any of the piece parts of the profile. For example, it can move some parts into the right region and others to the content_top or whatever." <-- not if the profile is rendered out - then you can only put the whole profile in the sidebar and not parts of it.

Correct me if i'm wrong (which i probably am) but this patch reduces functionality.

dmitrig01’s picture

Status: Needs work » Reviewed & tested by the community

mistake

dmitrig01’s picture

Title: Render profile pages through drupal_render_page » Make profile pages return renderable arrays

I'm confused as i thought i was.

"I don't understand why this matters; index.php will call drupal_render_page() on the output anyway ... it is easier to understand the original code, IMO, but maybe I'm confused." --Dries
This patch makes them return renderable arrays like all pages should ;-).

sun’s picture

Despite of trailing white-space on a blank line

+  

this is truly RTBC.

moshe weitzman’s picture

This has been RTBC since Feb 3. I would appreciate some feedback form CVS Committers. Thanks.

moshe weitzman’s picture

Something? Anything? This really It has been 10 weeks now.

webchick’s picture

The only thing I could really find was this:

+ * To theme user profiles, copy modules/user/user_profile.tpl.php

I realize you're just moving code around, but the file is actually user-profile.tpl.php.

-      'arguments' => array('account' => NULL),
+      'arguments' => array('elements' => NULL),

This represents a net loss in legibility, which I think is where Dries's concerns perhaps were rooted. Moshe pointed out in IRC that this is the standard way to label arguments that are intended to be rendered through the render system, for better or worse.

Otherwise, I looked through the documentation in user-profile.tpl.php and it seems to still be accurate.

AFAIK, Moshe has explained why the patch is important fairly well in #4. So I'll probably commit this once we get a green from testing bot.

moshe weitzman’s picture

FileSize
2.97 KB
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Ok, test bot is happy, so committed to HEAD, with the addition of the following documentation in the header of user_view() so the next poor slob doesn't have to spend 35 minutes var_dump()ing their way through understanding what this gives you. Can we please make sure that all future (and past) functions we convert to drupal_get_page() have similar documentation?

 * The $page['content'] array for user profile pages contains:
 *
 * - $page['content']['Profile Category']:
 *   Profile categories keyed by their human-readable names.
 * - $page['content']['Profile Category']['profile_machine_name']:
 *   Profile fields keyed by their machine-readable names.
 * - $page['content']['user_picture']:
 *   User's rendered picture.
 * - $page['content']['summary']:
 *   Contains the default "History" profile data for a user.
 * - $page['content']['#account']:
 *   The user account of the profile being viewed.

Status: Fixed » Closed (fixed)

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