took a while to track this down but pretty sure a bug here. when an og is assigned to a user when the account is created the realname is not created.

actually the realname record is created; but it is blank; so technically this is likely more an issue with og getting in the way of the tokens being created.

both pathauto and realname use tokens:
- pathauto: [user:name]
- realname: [user:field_firstname] [user:field_lastname]

neither are correct when user account is first created.

when user account is re-submitted first time; the realname is corrected
when user account is re-submitted the second time; the url is corrected

if an og is not set at account creation time; both are created correctly immediately

i'll dig some more and create patch (will also try latest -dev of og; this is with 2.3)

Comments

liquidcms’s picture

still broken with latest -dev

liquidcms’s picture

Title: setting og for user on account create breaks realname creation » setting og for user on account create breaks user token creation

better title

liquidcms’s picture

Version: 7.x-2.3 » 7.x-2.x-dev
liquidcms’s picture

Title: setting og for user on account create breaks user token creation » setting og for user on account create breaks realname creation

i think the pathauto part of this was broken by my custom user token code (always clone objects like $account and $node when using them in code.. ughh!!) but this isn't what breaks the realname values not getting stored correctly.

i do see in the call stack when creating account that OgMembership->save() is called which eventually gets to entity_load(). this runs all the $module_user_load hooks including the realname_user_load which i would guess does a user_load which does not yet have the realname saved and therefore ends up wiping it out of the $user object before the realnode module gets to save it..

liquidcms’s picture

this isn't a fix as there is a bug here somewhere in the interaction between og and realname; but until i get a chance to solve it or someone else does, in case any one else is having this issue, the following will hack in a fix:

function MYMODULE_user_insert(&$edit, $account, $category) {
  realname_update($account);
}
liquidcms’s picture

Version: 7.x-2.x-dev » 7.x-2.7

came across this issue with another project; problem still exists; bumping to 2.7

a little more digging and i can see it is the entitymetadatawrapper that og adds in that breaks this.