Hello. Continuing from here http://drupal.org/node/490520

After installing the module I navigate to Rules -> Triggered Rules and get the following error message (repeated twice as beneath):

# warning: Illegal offset type in /home/sitename/public_html/sites/all/modules/rules/rules_admin/rules_admin.inc on line 72.
# warning: Illegal offset type in /home/sitename/public_html/sites/all/modules/rules/rules_admin/rules_admin.inc on line 72

This messages continues to appear randomly during all operations within setting up Triggered Rules.

Once I try and set up one of the TAC rules (having loaded a term to make them appear) I get another error message:

# warning: Invalid argument supplied for foreach() in /home/sitename/public_html/includes/form.inc on line 1207.

Additionally (and this may be me not understanding how the module is meant to work), when using the 'Change a role tac_lite access' rule, under arguments I get drop down menus for the Taxonomy vocabulary and Taxonomy Term, but both are empty, meaning I can't actually select the term to apply the TAC permission to (it would actually be better for my usage example if the term selection was a text field that could accept tokens, as I am automatically creating terms based on new users, and then want to assign that term so that only that user can see content tagged with it).

Hope that is of help!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mlosee222’s picture

I am experiencing this error as well. The dropdowns are empty when making a rule and I get this error on the same page that these dropdowns are on:
# warning: Invalid argument supplied for foreach() in /home/sitename/public_html/includes/form.inc on line 1207.

ju.ri’s picture

The error messages go away when using the DEV version of Taxonomy Access Control Lite.

>>edit: sorry, should have waited before posting ! Error Message reappeared on this page : /admin/rules/trigger/add

regarding the empty fields:
have you added actions to load vocabulary and term before adding the tacl rule action?

AlexisWilke’s picture

Sorry guys, it looks like I did not put my email address in the issue tracking system... That looks bad, indeed. 8-)

More later.
Alexis

AlexisWilke’s picture

Okay... if you're still using this module and still have the problem, could you tell me which version of Rules do you use?

Thank you.
Alexis WIlke

willhowlett’s picture

I'm not using the module anymore, but the error was coming up whilst using Rules 6.x-1.1

dman’s picture

Rules: version = "6.x-1.2"
Tacle rules version = "6.x-1.x-dev"
warning: Illegal offset type in /Library/WebServer/Documents/modicagroup/d6-current/sites/all/modules/rules/rules_admin/rules_admin.inc on line 72.
Code in question:


  foreach (array_filter($elements, 'rules_admin_element_filter') as $name => $element) {
    if (isset($element[$key])) {
      $grouped[$element[$key]][$name] = rules_get_element_label($element);  /** Line 72 **/
    }
    else {
      $ungrouped[$name] = rules_get_element_label($element);
    }
  }

So $element[$key] is set, but is not a string or number. Usually this triggers if it's an array by accident.
...
yeah.
$element[$key] is an array ('Taxonomy', 'Tacle Rules') where it used to be just a string.
Seems hook_rules_event_info seems to be competing with the taxonomy module over ownership/support of the taxonomy_term_insert and taxonomy_term_update events.

Not sure what to blame here.
The action DOES WORK as expected, and the tacle_rules_rules_event_info() does seem to follow the function API signature.
Could be that it's a rendering oversight/assumption in rules itself. Maybe rules_admin_get_grouped_labels() never anticipated more than one module per action.

AlexisWilke’s picture

Ah! Interesting... I haven't looked at the code in a while.

Will the $element[$key] always be an array? Or could it still be a string when only one module is required?

We could do something like this:

  $ekey = is_string($element[$key]) ? $element[$key] : implode(',', $element[$key]);

Then use $ekey instead of $element[$key].

That would apply everywhere the element key is necessary.

What do you think?

Thank you.
Alexis

dman’s picture

I didn't look any deeper at what was expected or why.
All the others are strings normally, it's only when it gets overloaded it turns into an array.
If it's only to create a key, then yeah I guess joining it into something would do it. It might be best to bounce it back to rules.module itself to check on what is intended. It's rules.module that overloaded it into an array, and rules.module that is using it here.

Ganganation’s picture

Hi there, as a response on the earlier posts.
I am using Rules 6.x-1.4 just as tac_lite 6.x-1.4
But as I installed rules and tac_lite everything was working fine, untill I installed tacle_rules
Then the same error as in the first post is displayed.

I love the idea of this module, it is exactly what I need (and I think more people will when they now this is possible).

The Rules module is still working fine, I just don't see the possability's you explain in: http://drupal.org/project/tacle_rules
I hope this is enough information.

Thanks for you help :D

AlexisWilke’s picture

I'm wondering whether you marked that taxonomy as a Tags and/or Multiple Select taxonomy.

The taxonomy used with this module should not have either flag turned on. I guess the module should test that and refuse to do anything in that case. (and show the error in the Reports screen.)

Thank you.
Alexis

Ganganation’s picture

Hi Alexis,

Thank you for your response.
I checked for the Tags and/or Multiple Select taxonomy flags in my vocabulary (I guess you meant my vocabulary, not my taxonomy?).
Both where turned off (see attachment).

Hope this gives some clarification, if you need more detail, let me know.
Thanks in advance.

AlexisWilke’s picture

FileSize
854 bytes

Hmmm... it could be because I did a copy and paste of the rules event info keys.

If you don't mind testing after applying the attached patch to tacle_rules, then we'll know whether it works. You may have to completely uninstall the module and re-install, although it seems to me that Rules is quite dynamic and should find the change automatically.

Thank you.
Alexis

Ganganation’s picture

Hi Alexis,

This is a late response, tested, and it seems to work!
I will come back to this if there still seem to be problems.

Thank you very much :D

AlexisWilke’s picture

Assigned: Unassigned » AlexisWilke

Okay, committed.

Thank you.
Alexis Wilke

See:
http://drupalcode.org/project/tacle_rules.git/commit/fc6ceae

tinker’s picture

Status: Active » Closed (fixed)