Setup:
Panels 7.x-3.0
Chaos tools 7.x-1.0-rc1+80-dev

Situation:
I have a custom Page "a" having a panel variant with a set of panes in a standard 3 column layout.

One of these panes contains a Block "x", selected from the list of blocks in the "Miscellaneous" menu. I want this block to be visible on my page variant only during a specific set of circumstances. That conditions is, if a custom user account field is equal to a specific value, an integer "n".

This custom user account field holds only one integer value, it's just a text field, and the integer value in the field increments over time based on some other Rules and conditions.

But basically, if the current logged in user has an integer value of "n" in that custom user account field, I want the Block "x" to be visible on my custom page "a". Otherwise, the block is hidden. Make sense?

The interface to make this happen seems pretty straight forward, and I had no problem figuring it out. However, I get a bunch of errors when saving and updating the custom page, with this visibility rule in place.

One of which is:

http://localhost/admin/structure/pages/nojs/operation/page-frontpage/handlers/page_frontpage_panel_context_3/content
Notice: Undefined offset: 0 in ctools_entity_field_value_ctools_access_summary() (line 220 of C:\xampp\htdocs\sites\all\modules\ctools\plugins\access\entity_field_value.inc).

Coinciding with this error, the Block "x" is not made visible, despite the conditions for it's visibility being true.

Comments

davidcsonka’s picture

Update:

It looks like I was able to make my desired visibility rules happen, but I had to use custom PHP access rules (inside Panels pages) in order to accomplish it.

This worked:

global $user;
$user_data = user_load($user->uid);
$my_custom_field = $user_data->field_custom_field['und']['0']['value'];
if ($my_custom_field == 1) {
return TRUE;
}

It seems the UI interface in Panels pages for making the above work is potentially incomplete, but at least it seems works on the backend with PHP.

merlinofchaos’s picture

Category: support » bug

This is probably because we're using the global $user for the user rather than doing user_load() which adds extra queries. That's irritating. Might have to add some special code to ensure that we user_load when necessary.

davidcsonka’s picture

Cool, either way - you've done a lot of great work. Thanks!

TimG1’s picture

Hi All,

I'm getting this same error for visibility rule on a taxonomy term reference field.

Notice: Undefined offset: 0 in ctools_entity_field_value_ctools_access_summary() (line 232 of /sites/all/modules/contrib/ctools/plugins/access/entity_field_value.inc).

Thanks for reading,
-Tim

cmarcera’s picture

I am also getting this error and Panels seems to be ignoring my Visibility Rules:

Notice: Undefined offset: 0 in ctools_entity_field_value_ctools_access_summary() (line 232 of sites/all/modules/ctools/plugins/access/entity_field_value.inc).
Notice: Undefined offset: 1 in ctools_entity_field_value_ctools_access_summary() (line 232 of sites/all/modules/ctools/plugins/access/entity_field_value.inc).
Ryan Osītis’s picture

Subscribe