0

I'm using devel to find specific fields I'd like to be able to access in a template I have for a user profile page (user-profile.tpl.php)

The field values are present in devel just fine however I'm not sure what to do with the path it gives me.

enter image description here

I see the info I need, (created = 1349810890) and I see a path that devel has given me $...->created but I'm not sure what to replace $... with to get access to that field.

I've attempted the following

$node->created;
$page->created;
$user->created;
$node['created'];
$content->created;
$variables->created;
$variables->node->created;

And several others with no luck

1 Answer 1

0

Are you operating on the user account object?

If so, it should be:

$variables['account']['user']->created;

Which would be used at the template_preprocess function level. From the actual template itself, unless you have intimate knowledge of what was passed to $variables, you will sit there and guess all day long and not get far. Even I am guessing. The only way to know exactly what you have to work with is by using a real debugger.

The best option is implementing a debugger like xdebug so you can get a better idea of whats going on.

It will save a lot of time if you leverage it over devel. You can then set a breakpoint in your template_preprocess function in template.php, inspect all the variables being passed to that appropriate template, and print or modify as you need.

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.