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
  •  | 
  •  

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.

有帮助吗?

解决方案

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);
许可以下: CC-BY-SA归因
scroll top