This patch adds three actions and a one condition:
1. Load a group
2. Subscribe user
3. Unsubscribe user
4. Check if user is in a group.

Suggestion how to test:
1. Enable custom content links (CCL) from the wf_ng package.
2. Create custom links like in snap2.png
3. Import the wf_ng.txt to workflow_ng.
4. Assign the actions to CCL. So every time a CCL is clicked an event is triggered.

I am not a native speaker, so please review also my grammar …

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

FileSize
5.76 KB

Some fixes to Load action.

moshe weitzman’s picture

perhaps fago or other NG person could review this

fago’s picture

Status: Needs review » Needs work

sry for not reviewing this so long.

@og_workflow_ng_action_load_group:

I don't think the group entity makes sense. Groups are nodes, so use entity == 'node' together with a label "Group" - like it is in the existing integration. But be aware that nodes passed to actions/conditions might be no group nodes.

So I think a condition "Content is a group" or so would be handy, so one could react on group creation by using "Content creation" and the condition.

As an affect a load by "nid" action is available for nodes, so you don't need this for groups.

@og_workflow_ng_action_subscribe_user:
Just for the eye: If you don't need $arguments, $log as you have no token integration there, leave it out of the function signature.

@og_workflow_ng_action_subscribe_user:
Why so complicated? This could be even one (simple) line..

Then you have some spelling mistakes in there. I also think the phrases could be better. Also, isn't it "user, who.." not "user, which.." ?

@ multiline t()
+ '#description' => t('Enabled will result with user automatically approved.
+ Disabled will subscribe the user but will still need the approval of the admin.'),

I don't think this is optimal as there is the line ending and many spaces in the sentence. Using "." to concatenate too strings won't work either, as the pot extracter has problems with something like this. So afaik it's best to just use one, long line. Core does so too.

amitaibu’s picture

@fago,
thanks for the review. I'll work on it according to your comments.
You wrote twice @og_workflow_ng_action_subscribe_user in your review, but I think it's a mistake?

amitaibu’s picture

Status: Needs work » Needs review
FileSize
5.22 KB

Indeed, code became a little simpler - thanks fago.

fago’s picture

Status: Needs review » Needs work

* you have a typo in there "memeber" -> "member"

* by just reading it, this can'T work correctly:

+function og_workflow_ng_condition_user_in_group($user, $group, $settings) {
+ return in_array($user->og_groups, array_keys($groups));
+}

I'm not so familiar with og, but isn't there a better way to check whether it's a group?
e.g. og_is_group_type($node->type) should do it or?

@
+ '#description' => t('Subscribe a user to a group. If a user is already member of the group she will be re-subscribed.'),

At least for me this is a bit confusing. Re-Subscribed? I assume there is a subscription time or so?
It don't think it makes much sense to re-subscribe a user or does it? Shouldn't we just check if the user is already subscribed in the action, and only subscribe him if he isn't?

one related thing: Do you have some rules to test this? So please share theme here, so other testers (like me..) could save time and reuse them..

moshe weitzman’s picture

fyi, there is now og_is_group_type() and og_is_group_member(). it is probably safe to just omit the text about resubscribe.

amitaibu’s picture

Status: Needs work » Needs review
FileSize
5.78 KB
1.58 KB

@fago, fixed according to your comments, 10x. Attached also the wf_ng rules that can be imported.

@Moshe, This patch back ports og_is_group_member() to D5's og.module.

fago’s picture

Thanks amitaibu for your export, however I wasn't able to use them directly as I had not the same custom content links in the system and so not their events - I know exporting cclinks would be useful (-> rules (6.x) will allow extension modules like cclinks to make use of the import/export mechanism :)

Anyway, I tested it - it's working as expected. But I'd suggest a small improvement: Call the condition not "User in group" but "User is group member" - I've attached an updated patch which does just this small change.

indeed, it doesn't look like there is already og_is_group_member() in 5.x? Is backporting it that way ok moshe - in particular in regard to the user_access('administer nodes') check it contains?

Apart from that I'm not sure about the backport, I'd say the patch is now ready.

fago’s picture

FileSize
5.79 KB

damn, I forgot to attach the updated patch. Here is it:

fago’s picture

Version: master » 5.x-1.x-dev

selecting right version...

nodestroy’s picture

Status: Needs review » Reviewed & tested by the community

looks fine, i think its ready to be commited

fago’s picture

Title: wf_ng actions and condition » add workflow-ng actions and condition

improving title..

moshe weitzman’s picture

Committed to 5.x despite a rather evil placement of og_og() in the workflow include. Thats the best way for now it seems.

I'd love some help from this group getting triggers support into the D6 version of OG. Actions support would be nice too (see #169226: port to 6 and include in og.module)

moshe weitzman’s picture

I got actions in today so triggers is the biggest outstanding todo.

fago’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

great, thanks!

Personally I'm concentrating on rules. Once it's in beta state, I'll help porting og w-ng integration including actions, that can't be done as "core actions" like these two.

amitaibu’s picture

I've started porting to D6, it's already working as there is almost no change. just want to test it properly.

neuromusic’s picture

I hope that this is not an inappropriate place to ask this question, but here goes... (for my own future reference, please let me know if there is a better place for me to ask this).

I would like to be able to use this set of actions for my site. I have:

  • D5
  • OG 5.x-7.3 (2008-Jul-02)
  • workflow-ng 5.x-2.1 (2008-May-14)

Moshe says this patch has been committed. Where can I find the "committed" version? There is no dev version of 5.x listed on the OG project page. Is there a dev version of OG (perhaps og 5.x-3.x-dev?) which incorporates these actions? If not, how would I patch my own install?

Thanks!
Justin

neuromusic’s picture

Nevermind. I posted too soon. I simply needed to follow the link that I submitted.

scedwar’s picture

Can you add the following event triggers?

1) User promoted to admin of a group

and the action:

1) Email the admins of the group
(this probably could be an option within the "Send a mail to a user" arguments - recipient)

Use cases:
User is promoted to an admin, all the group admins get an email (og only supports emailing the user that has been promoted). Or simply, an email to the group admins whenever a user joins their group.