Uploading current work here and going to ask Fago to help me with unsolved issues:
1. Events are not triggered.
2. How to 'tell' patch to delete og_workflow_ng.inc

Comments

moshe weitzman’s picture

this should move to the very new og_actions module: og_rules_action_info()

amitaibu’s picture

Yes, file is called og.rules.inc

fago’s picture

@patch:
the .rules.inc files are automatically included by rules - so you shouldn't do it.

As an affect, the implementation of og_og() should go into the module itself and use a check module_exists('rules'). The rest should stay in the include file.

@actions module:
hm, I wonder why there is a separate module? It seems that it's the trend to add separate modules for different kind of integration (view, panels, actions,..), but is this really necessary? When the code could also go into a conditionally included file, I see two advantages:
* Users don't have to care about activating just another module to get the integration - it's just there when they use the module (views, panels, rules..).
* One module less cluttering the modules page and at least tiny performance improvements (one module less for hook implementations).

I go this way for rules integrations - but event invocations have to be in the modules. (As rules only includes the include files when rules are configured and get evaluated).

So of course this integration could go into both og or og_actions - as you prefer.

amitaibu’s picture

So of course this integration could go into both og or og_actions - as you prefer

Moshe please decide and I will roll the patch accordingly.

moshe weitzman’s picture

I would like the new actions to go into og_actions module. it sounds like og_og() needs to go into og.module. The rest goes into the include.

fago’s picture

Of course we can rename og_og to og_actions_og and move it into the og actions module too. Then the include file should also be og_actions.rules.inc.

amitaibu’s picture

Title: Og integration with Rules module » OG integration with Rules module
Status: Needs work » Needs review
StatusFileSize
new6.62 KB

How about og_rules.module? I think it makes more sense as these are the actual modules names.

moshe weitzman’s picture

If rules module can load the include itself (just like Views2), then thats ideal. Actions does not do that, so it got its own module. OG Views got its own module because O makes such heavy use of embedded Views that it needed its own (optional) module.

amitaibu’s picture

Status: Needs review » Needs work

Ok, I'll re-roll.

amitaibu’s picture

Status: Needs work » Needs review
StatusFileSize
new6.8 KB

Patch with Rules loading it's own inc files.

fago’s picture

Status: Needs review » Needs work

great. patch looks good.

-> wrong comment + * @see og_rules_action_subscribe_user_submit.
-> @og_og: this code needs to be wrapped by a module_exists call - or you get fatal errors without rules.

Furthermore the rules development snapshot has now the upgrade path from workflow-ng included - so let's make sure it works with it.

amitaibu’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new6.78 KB

Another try :)

amitaibu’s picture

Status: Reviewed & tested by the community » Needs work

oops, set it RTBC by mistake.
Got some remarks from fago in the IRC, I'll fix them.

moshe weitzman’s picture

Can we replaced hook_og() with calls to trigger module instead of rules_invoke_event()? Does rules work with triggers automatically?

fago’s picture

no - it's a replacement for trigger. So it works independent from it.

amitaibu’s picture

Status: Needs work » Needs review
StatusFileSize
new6.87 KB

module_exists() now properly implemented and tested, also removed t() from module name.

amitaibu’s picture

StatusFileSize
new6.84 KB

Some more comments from Fago (thanks for being so patient! :) )

moshe weitzman’s picture

Status: Needs review » Fixed

Committed. Thx.

A new RC5 release is coming momentarily.

fago’s picture

Status: Fixed » Needs review
StatusFileSize
new712 bytes
new4.87 KB

thanks for committing moshe.
I've just gave this a test. I tried importing a workflow-ng test config into rules - importing works fine.

However, the trick for loading the event arguments doesn't work any more that way in 6.x. So I changed it to fit to rules (by setting uid, gid to be hidden). Furthermore 'description' was renamed to 'help' and is really only for help - so I also changed this.

So I attach a patch with my changes - it also removes some whitespaces.

After the changes the test-rule works fine.
If you want to test it: I appended the workflow-ng export so you can import it (latest rules module required).

moshe weitzman’s picture

Status: Needs review » Fixed

committed. thx.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

juicytoo’s picture

Hi guys,

does this mean that we can now trigger a creation of an OG group using rules?

Thanks in advance.

cheers