Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
if ( arg(0) == 'node' && is_numeric(arg(1)) && ! arg(2) ) {
$node = node_load(arg(1));
$sql = "SELECT value FROM profile_values WHERE (uid = $node->uid) AND (fid = 2)"; //'2' is MY location field... it may not be the same as yours.'
$result = db_query($sql);
$location = db_fetch_object($result);
Comments
get profile_value from current Node in a block
How do i get profile_field_name (profile_values) of current node in a block
Need further explanasion
your questions are not informative at all. please explain further.
--
Praveen Gunasekara
get profile_values
when a node is displayed i want to call the user profile field values in a block to show his contact details like email , phone etc
here is my solution
hi incom,
you have two options.
1. nodeapi
2. node.tpl.php
3. blocks
yes you can either use nodeapi hook with operation = view or you can edit node.tpl.php directly.
but if you want it in a block then you first have to check for the url. for ex.
?q=node/24
then first check this with arg() function and then use a sql to get the uid of that specific node id.
and then use that uid to get the relavant profile values.
hope this will help you.
--
Praveen Gunasekara
Thank you Praveen.
Thank you Praveen.