If you create a rule that fires on 'User membership has been approved' that assigns roles automatically, these automatic roles will never be applied when you approve members via the UI 'edit membership form'.

This is because the submit handler for the 'og_ui_edit_membership' form assigns the roles from its own submission after it has already saved the og_membership entity.

Simple answer is to change the order of execution, so the og membership entity, and hence the rules event happen after roles have been set by the form submit.

Comments

shushu’s picture

Status: Needs review » Reviewed & tested by the community
amitaibu’s picture

Looks good, but lets add a comment why the save is all the way down, to make sure it stays there.

shushu’s picture

StatusFileSize
new956 bytes

With a comment.

amitaibu’s picture

+++ b/og_ui/og_ui.admin.inc
@@ -370,6 +370,10 @@ function og_ui_edit_membership_submit($form, &$form_state) {
+  // #2157619 - Entity saving should be kept last in the process to keep rules working properly.

No need to add the issue number. Comments should be up to the 80 chars.

shushu’s picture

StatusFileSize
new931 bytes
amitaibu’s picture

Status: Reviewed & tested by the community » Fixed

Changed comment to:

// Saving should be last in the process, so Rules can get a chance to
// assign or revoke roles.

Merged, thanks.

Status: Fixed » Closed (fixed)

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