Sorry if the title is confusing.

I have a feature that has the Content Profile module as a dependency. In Content Profile's hook_enable, there is a check for the 'content_profile_profile' variable. If it is not set (and is not an empty array), then a variable_set is called that sets it to an empty array.

The problem I'm having is that even though it appears that my feature's hook_strongarm is being called AFTER Content Profile is enabled (and thus, after Content Profile's hook_enable), my Strongarm data never overwrites the empty array that Content Profile's hook_enable sets.

As a workaround for now, in my feature's hook_enable I've manually retrieved my feature's hook_strongarm data and have done a manual variable_set on $export['content_profile_profile']->value. Obviously, this is not a proper solution, but it's the only way i can get this to work right now.

I may be wrong about the order of events - however, regardless of order, something is not right. If Content Profile's hook_enable is in fact getting hit BEFORE my feature's hook_strongarm, then logically Content Profile's hook_enable variable_get should return nothing, the variable_set occur, and my feature's hook_strongarm should overwrite with its own data. Or if Content Profile's hook_enable is getting hit AFTER my feature's hook_strongarm, then Content Profile's hook_enable variable_get should return the Strongarm data, and should not overwrite with an empty array.

Maybe this has something to do with Strongarm caching? Maybe Strongarm hasn't actually set its data before Content Profile's hook_enable variable_get is called?

Comments

Nick Robillard’s picture

Title: hook_strongarm after variable_set OR variable_get after hook_strongarm - not working » hook_strongarm after variable_set OR variable_get after hook_strongarm - strongarm data not setting

Title change

yhahn’s picture

Status: Active » Closed (works as designed)

Strongarm 2.x no longer overwrites any variables that have a value in the database. You need to revert this variable (ie. variable_del('content_profile_profile')) before your Strongarm'ed value will take over.

My suggestion is taking a look into why content profile is setting a variable value on install -- it seems that it shouldn't have to do this and should use the variable default value instead?