boonebgorges / buddypress-docs

GNU General Public License v3.0
106 stars 44 forks source link

Associated Group section doesn't show for some users #700

Closed levycarneiro closed 3 years ago

levycarneiro commented 3 years ago

Hello!

We have a site with BuddyBoss and BuddyPress Docs. When adding a new doc via going to a Group then Docs tab, some users can't see the whole "Associated Group" section (with the Group dropdown). They can still create a document but can't set which Group to associate it to.

How to fix this? I couldn't find any permission settings in the BuddyPress Docs plugin settings.

Thanks!

boonebgorges commented 3 years ago

Here are the relevant checks in the template file:

https://github.com/boonebgorges/buddypress-docs/blob/130328dc3000d22c35e642950b10b8a17454cfd7/includes/templates/docs/single/edit.php#L83

So the three things to check are:

  1. bp_is_active( 'groups' ) - I assume that you have the Groups component activated :-D
  2. current_user_can( 'bp_docs_manage', $doc_id ) - When you are creating a new Doc, this should return true for all members. The relevant lines are https://github.com/boonebgorges/buddypress-docs/blob/130328dc3000d22c35e642950b10b8a17454cfd7/includes/caps.php#L54 and https://github.com/boonebgorges/buddypress-docs/blob/master/includes/integration-groups.php#L1796
  3. apply_filters( 'bp_docs_allow_associated_group', true ) - You may have a plugin disabling this for certain users.

Narrowing this down will help.

dcavins commented 3 years ago

Are the docs associated with the group correctly even when the group association box isn't visible? Are you using the "BP docs in groups" plugin?

I ask because there have been several requests on the WP support forum for exactly the behavior you describe, where only elevated users can select a group and the group is selected "automatically" for most users.

levycarneiro commented 3 years ago

Are the docs associated with the group correctly even when the group association box isn't visible?

Docs created by the affected users will still be created but they fall into some type of "root" location, not associated with a Group.

Are you using the "BP docs in groups" plugin?

No.

levycarneiro commented 3 years ago

Found the issue: the affected users were on a wordpress role different from everybody else on the site. Probably this role was customized and didn't have the needed permission. Issue solved now. Thanks!

boonebgorges commented 3 years ago

Awesome!