How to allow users programatically to post and view posts regardless of they are trusted contact or not in drupal commons

drupal.stackexchange https://drupal.stackexchange.com/questions/212492

  •  12-12-2020
  •  | 
  •  

Question

All is in the title, actually users can only posts privately to theirs trusted contacts and sees posts of trusted contacts. I don't need such restriction in my project and want to bypassing this restriction so all users except anonymous can posts and see posts.

That beeing said, I don't wanna change they way groups works, so if group is private all posts in the group should stay private.

I've searched in commons_trusted_contacts module and I can't figure out where this is been handle. I've tried to set group_content_access value to 1 in database (1|Public - accessible to all site users) but this doesn't seems to be the way.

Was it helpful?

Solution

I found out that commons_trusted_contacts module is setting content access as private while posting for trusted contacts, which add post to user group so that only user's trusted contacts sees posts.

In order to post regardless of users are trusted contact or not, I've changed value of group_content_access to public. This way posts are not assigned to any group so it's visible for all users. In database, gid is then set to 0 instead of uid representing user group.

Bellow the line I've changed

$wrapper->group_content_access->set(OG_CONTENT_ACCESS_PRIVATE);

to

$wrapper->group_content_access->set(OG_CONTENT_ACCESS_PUBLIC);
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top