How do can I get a field from the current user in an entry point?

Greetings,

I added a custom field to the Users and through research I found out that I can get that field by using something like:

<?php
global $current_user;
$fieldData = $current_user->my_field_c;

I tested this out on my local instance and it worked fine but when I installed the module in a online instance $fieldData always stays blank. Anyone knows the cause of the problem?

Thanks in advance,

André Policarpo

  • Hi Hiren,

    I'm on 7.8 Pro and it is still working for me.

    If you are retrieving the Users bean in a logic_hook you might want to try disabling row-level security and ignoring the cache:

    $user = BeanFactory::retrieveBean('Users', $current_user->id,  array('disable_row_level_security' => true, 'use_cache' => false));

    Hope this helps,
    Francesca

1 2