Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bp_docs_get_default_access_options filters are not respected when a group is selected. #703

Open
dcavins opened this issue Jan 6, 2022 · 1 comment

Comments

@dcavins
Copy link
Collaborator

dcavins commented Jan 6, 2022

Filtering default doc settings via the filter bp_docs_get_default_access_options works as expected when the doc is not group-related. However, if you choose to associate the new doc with a group, the filter isn't effective. I believe the issue is the first line in bp_docs_access_options_helper() where the type is set to raw when a group_id is passed.
https://github.com/boonebgorges/buddypress-docs/blob/master/includes/templatetags.php#L1160

I wonder if that check shouldn't be "set type to raw when a doc_id is passed"? Maybe "raw" should never be used here? Or maybe there is a reason that the group_id would matter here. I'm not sure. :)

This issue was pointed out here:
https://wordpress.org/support/topic/how-do-i-set-the-default-permissions-for-a-group-doc/

@boonebgorges
Copy link
Owner

For reference, here's where the 'raw' call for groups was introduced d58c868 It's not clear to me why I went this route, either from the changeset or from the associated issue #414.

The main purpose of 'raw', if I'm understanding bp_docs_get_doc_settings() correctly, is to prevent the saved settings from being parsed with the defaults. But I'm not sure why you'd ever want to do that, since it would leave empty values.

@dcavins If you want to experiment with removing the 'raw' call, please feel free. Based on #414, you'd want to check whether the default settings are working properly with private/hidden groups, to avoid a regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants