1

We are building a web site that relies heavily on organic groups. We provide in the front page a webform to allow non-authenticated people to submit a request of membership to one of the main groups (there are subgroups also).

What I need is the webform to work as it does out of the box, but as soon as a submission is sent, subscribe it to a group. Inside the group, a user which belongs to a certain role will accept/reject the membership request.

So far, I have learned that if you add the feature 'is group content' to the webform content type, it affects to the webform but not to the submissions (i.e. unauthenticated users can't reach the webform since the group in the og_group_ref is configured as 'private' (and it has to be this way).

TLDR: I need the submissions of a webform to be able to be assigned the og_group_ref attribute as they are submited. Is it possible?

TIA

0

Interesting question/challenge (+1 from me ...). What you described about the "is group content" makes those webforms indeed unreachable for anybody who is not part of that group (so that's a "works as designed" ...

However, how about using the Rules module to complete your puzzle? Haven't looked at all the details (yet), to see if it can actually be done (I'm pretty sure it can ...), but I'm thinking of using a rule that looks more or less like this:

Event: when Webform is submitted

Condition: If membership for group is requested in the submitted form

Action: Send eMail to an authorized user to accept / reject the request

1
  • Hi Pierre. Thanks for your insight, but I solved my problem some weeks ago. I guess that rules could have been useful, but in the end it turns out that the 'submissions editor' user is who triggers the creation of a new user (+membership, +role granting). I've just answered my own question in case someone happens to end up in this page looking for something similar. Many thanks though. Regards.
    – Jaime
    Jun 6 '15 at 16:57
0

Well, I'll provide an abstract of the solution of the sorts I came with for this problem.

  • hook_node_load: I fill a dropdown box with the suitable groups (db_select). The anonymous user can fill all the data up and select to which group the submission is 'going to be sent'.

  • in the target groups, I've set up a view (panelized) that filters by the value of the group requested by the anonymous user being the same as current.

  • in hook_form_alter I hide the dropdown box if editing an existing submission. Also, I hide a checkbox ('grant membership') if it is the original submission (meaning anonymous user cannot see it or use it).

  • I've set og_permissions so as to who can edit submissions. The allowed editors can then edit a submission and use the 'grant membership' checkbox to accept the request.

  • hook_webform_submission_update: if the 'grant membership' checkbox value is 1, then programmatically create user and assign membership to current group.

I'd hoped for an easier way to solve it, but it is working great.

Cheers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.