I have the following situation:

I use a node reference (called "field_profile_organisation") in content profile to link the user to his/her organisation (which is a content type of it's own).

I now need to get to the nid of the organisation of the currently logged in user.

using drupal firebug on the "my account page" i can see this:

[field_profile_organisation] => array (
[0] => array (
[nid] => [202]
)
)

So in this particular example I would like to extract 202.

I inserted the following code snippet in an otherwise empty page:

<?php
print_r(content_fields(field_profile_organisation, 'profile'));
?>

which returns:

Array ( [field_name] => field_profile_organisation [type_name] => profile [display_settings] => Array ( [label] => Array ( [format] => above [exclude] => 0 ) [teaser] => Array ( [format] => default [exclude] => 0 ) [full] => Array ( [format] => default [exclude] => 0 ) [4] => Array ( [format] => default [exclude] => 0 ) ) [widget_active] => 1 [type] => nodereference [required] => 1 [multiple] => 0 [db_storage] => 1 [module] => nodereference [active] => 1 [locked] => 0 [columns] => Array ( [nid] => Array ( [type] => int [unsigned] => 1 [not null] => ) ) [referenceable_types] => Array ( [organisation] => organisation [course] => 0 [dissemination] => 0 [page] => 0 [profile] => 0 [story] => 0 ) [advanced_view] => -- [advanced_view_args] => [widget] => Array ( [autocomplete_match] => contains [default_value] => Array ( [0] => Array ( [nid] => ) ) [default_value_php] => [label] => Organisation [weight] => 1 [description] => [type] => nodereference_select [module] => nodereference ) ) 

Here, nid seems to be empty?

Please, how can I accomplish this? Any hints would be greatly appreciated!

Comments

rezboom’s picture

never mind, i solved the problem by directly querying the database.

rezboom’s picture

Status: Active » Closed (fixed)