I cannot for the life of me get the button to display for any other role. Nothing in permissions or og access seems to govern this. I have tried various random actions: disabling and re-enabling 'Commons Search Solr User' module, reverting (or at least trying to revert) the Commons Trusted Contacts feature.

The Field Instances and Message type areas of the feature refuse to revert to default, though.

Perhaps this isn't a bug and I'm just looking in the wrong place to get this working or there is some clash in the setup of my modules.

Any leads will be gratefully followed...

Comments

albertosouza’s picture

Component: Miscellaneous » Groups

This is a bug in commons_groups

To reproduce:

  1. login with admin
  2. access: /admin/config/group/permissions/user/user
  3. save ( dont need to edit )
  4. login as normal user
  5. go to a randon user profile
  6. trusted contact button not appears

The code with bug probably are:

File commons_groups.module line 12

/**
 * Implements hook_og_permission_alter().
 */
function commons_groups_og_permission_alter(&$perms) {
  // We set these values programatically based
  // on the value of field_og_subscribe_settings, so we disable them in the UI.
  $perms['subscribe']['roles'] = array();
  $perms['subscribe']['title'] = t('Contribute to the group');
  $perms['subscribe']['description'] = t('This value is set automatically based on the "Group Privacy Settings" field.');
  $perms['subscribe without approval']['roles'] = array();
  $perms['subscribe without approval']['title'] = t('Contribute to the group without approval');
  $perms['subscribe without approval']['description'] = t('This value is set automatically based on the "Group Privacy Settings" field.');
}

I needed more time to solve this problem but is necessary to ensure that commons_groups permissions mechanism only applies to the content type groups and keep the possibility of creating other types of groups as groups of courses or research groups

timfelix’s picture

Issue summary: View changes

Hi.
I've been struggling with this for days.
not sure if it helps but giving 'Administer Organic groups permissions' causes the button to show for those users.
Any pointers would be really appreciated.

timfelix’s picture

I found a fix for my problem:

somehow the 'og permissions' had changed for the 'OG User - User'
so on this page:
admin/config/group/permissions/user/user
for 'Contribute to the group', the checkbox for 'non-member' should be checked but disabled.
However, mine was unchecked but disabled.

I had to temporarily remove the commons_groups_og_permission_alter() function in commons_groups.module to allow me to check this box. then disable the checkbox again by putting in the function again.

This made the 'add as trusted contact' button reappear on user profiles.

timfelix’s picture

StatusFileSize
new76.41 KB

see

agileware’s picture

We had to run a database query to fix this problem. It's a bug in Drupal Commons - and a pretty big one. I didn't work on the fix myself, but will ask internally if there is a patch available.

devin carlson’s picture

Version: 7.x-3.3 » 7.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new4.25 KB

It looks like there are three issues here:

  • commons_groups_og_permission_alter() is being used to "disable" the subscribe and subscribe without approval permissions but it is really just hiding the checkboxes on the permissions page. If a user submits the form, the permissions receive a different value (no one receives permissions).
  • The code requires that non-members have the subscribe permission and nobody has the subscribe without approval permission but actually attempts to remove both permissions for all users in commons_groups_og_permission_alter().
  • Both permissions are not featurized but cannot be set through the UI and require certain values, so if they somehow receive the wrong value they won't show up as overridden and users won't have a way to revert them to their default values.

The attached patch stops commons_groups_og_permission_alter() from attempting to alter the roles associated with each permission, properly removes the permissions from the permissions form and featurizes the required permissions.

devin carlson’s picture

Status: Needs review » Fixed

Retested #6 with a fresh and an existing Commons site and verified that the subscribe and subscribe without approval permissions were properly disabled and that running the update function properly fixed the permissions on existing sites.

Committed #6 to Commons 7.x-3.x.

  • Commit 10152af on 7.x-3.x by Devin Carlson:
    Issue #2087933 by Devin Carlson: Fixed trusted contacts button not...

Status: Fixed » Closed (fixed)

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