TransWikia.com

EntityDrupalWrapper->value() causes infinite recursion on user login?

Drupal Answers Asked by tigertrussell on December 24, 2021

I have a few instances on my site where I perform actions on User Login.

I create an EntityMetadataWrapper like so:

global $user;
$uw = entity_metadata_wrapper('user', $user);

And then I go to retrieve values like this:

$special_value = $uw->field_special_value->value()

For some reason, this particular line will cause an infinite recursion and crash my site.

Does anyone know what I’m doing wrong here? I am calling one of these from a Rules event and another one from hook_user_login, but it seems like no matter what, I get this recursive error.

This ONLY seems to happen in hook_user_login, all of my other value() calls to Entity Metadata Wrappers seem to work fine.

Note; these are both Entity References — one references a Taxonomy Term and the other references a custom Entity.

One Answer

are you sure the user is logged in and you have a full $user object available in your rule?

Maybe you have to call $user = user_load($uid, TRUE); explicity for this 1 case?

Answered by tenken on December 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP