Right now, og_memberships can be fielded and the fields can be entered when users request membership in a group, but not modified thereafter due to the lack of an edit form. It would be awesome if there were an edit form available for og_membership entities as well as the ability to integrate that edit form and its components with Panels so that custom "edit this attribute of your membership in this/these OG(s)" forms could be easily constructed through the UI.

Files: 
CommentFileSizeAuthor
#5 1909130-5.patch9.53 KBJody Lynn
PASSED: [[SimpleTest]]: [MySQL] 780 pass(es). View
#3 1909130-3.patch9.28 KBJody Lynn
PASSED: [[SimpleTest]]: [MySQL] 780 pass(es). View
#1 og-1909130-1.patch11.18 KBJody Lynn
PASSED: [[SimpleTest]]: [MySQL] 780 pass(es). View

Comments

Jody Lynn’s picture

Status:Active» Needs review
FileSize
11.18 KB
PASSED: [[SimpleTest]]: [MySQL] 780 pass(es). View

This patch adds edit links to the Members Admin view and the edit forms. It includes the ability to change member roles on the edit form (see also [#1920632))

The code should be refactored to be merged/less redundant with the add membership form.

Kazanir, the other request about the Panels integration should be a separate follow-up request.

amitaibu’s picture

Status:Needs review» Needs work

@Jody Lynn, you are awesome! :)

+++ b/includes/views/handlers/og_handler_field_og_membership_link_edit.incundefined
@@ -0,0 +1,75 @@
+    // ensure user has access to edit this membership.

Capital letter here and other comments.

+++ b/og_ui/og_ui.admin.incundefined
@@ -274,6 +274,143 @@ function og_ui_add_users_submit($form, &$form_state) {
+  $og_roles = og_roles($group_type, $bundle, $gid, FALSE, FALSE);

Maybe add a comment, that we want only the non-default roles.

+++ b/og_ui/og_ui.admin.incundefined
@@ -274,6 +274,143 @@ function og_ui_add_users_submit($form, &$form_state) {
+    '#autocomplete_path' => 'user/autocomplete',
+    '#required' => TRUE,

Why do we need it as autocomplete. I would assume it should be #markup

+++ b/og_ui/og_ui.admin.incundefined
@@ -274,6 +274,143 @@ function og_ui_add_users_submit($form, &$form_state) {
+  if (count($og_roles)) {

if ($og_roles) is probably enough.

+++ b/og_ui/og_ui.admin.incundefined
@@ -274,6 +274,143 @@ function og_ui_add_users_submit($form, &$form_state) {
+  if (count($field_names) > 1) {
+   $form['og_user']['field_name'] = array(
+      '#type' => 'select',
+      '#title' => t('Field name'),
+      '#options' => $field_names,
+      '#default_value' => $field_name,
+      '#description' => t('Select the field name, the group membership should be registered in.'),
+      '#ajax' => array(
+        'callback' => 'og_ui_admin_add_user_ajax_callback',
+        'wrapper' => 'og-ui-field-name',
+      ),
+    );

This will cause OG-membership's bundle to change. Not sure how Drupal deals with that (in terms of cleaning up fileds that don't exist in the different bundle).

+++ b/og_ui/og_ui.admin.incundefined
@@ -274,6 +274,143 @@ function og_ui_add_users_submit($form, &$form_state) {
+ * Validate handler; Edit membership in  group.

Extra space "in group"

+++ b/og_ui/og_ui.admin.incundefined
@@ -274,6 +274,143 @@ function og_ui_add_users_submit($form, &$form_state) {
+  if (!$account) {
+    form_set_error('name', t('You have entered an invalid user name.'));
+    return;

We'll probably won't need this on edit memberships. See above comment about the auto-complete.

Jody Lynn’s picture

Status:Needs work» Needs review
FileSize
9.28 KB
PASSED: [[SimpleTest]]: [MySQL] 780 pass(es). View

I removed the ability to edit the account of the membership as well as to change its bundle.

Also addressed other review items above.

amitaibu’s picture

When I try to edit the "Request Message" of any group-member it doesn't change the value -- does it work for you?

Also, I think it would be nicer is we would be redirected back to the "People" tab after editing the membership.

Jody Lynn’s picture

FileSize
9.53 KB
PASSED: [[SimpleTest]]: [MySQL] 780 pass(es). View

I added the destination setting to the view.

I brought back the field editing functionality by putting back $og_,membership->save(). Failed to test last time.

amitaibu’s picture

Status:Needs review» Fixed

Awesome! committed, thanks.

Status:Fixed» Closed (fixed)

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