Active
Project:
Author Pane
Version:
6.x-2.1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
6 Nov 2011 at 21:21 UTC
Updated:
29 Feb 2012 at 13:41 UTC
I'm using i.e. this php-snippet (in the author-pane.tpl.php) which display a user's age.
<?php
$year_diff = date("Y") - ($account->profile_birthday['year']);
$month_diff = date("m") - ($account->profile_birthday['month']);
$day_diff = date("d") - ($account->profile_birthday['day']);
if ($month_diff < 0)
$year_diff--;
elseif ($month_diff == 0 && $day_diff < 0)
$year_diff--;
print 'Age: ' . $year_diff;
?>I've tried to create a Views block (besides the Authorpane block) where I want to display the user's age, using Views Views Custom Field (or Views PHP field) but the code above does not work in Views, so I wonder if it would be possible to rewrite the code to make it work..?
Comments
Comment #1
Scyther commentedShould not this be a Views issue?
Maybe in Views, you don't have access to the $account variable?