lifterlms icon indicating copy to clipboard operation
lifterlms copied to clipboard

Add an `exclude` paramters to llmsSelect2 dropdowns to allow exclusion of specific posts from selection

Open thomasplevy opened this issue 3 years ago • 0 comments

The ajax-powered select2 dropdowns for posts exist, primarily, to allow selection of pages for various settings.

It would be useful to provide a way to exclude pages from a dropdown in specific scenarios, for example with our add-ons we can avoid collisions like the one encountered in https://github.com/gocodebox/lifterlms-groups/issues/145 where the group directory page was set to be the same page as the student dashboard page.

With an exclude parameter we can ensure that this can't happen by setting the exclude parameter of the groups option to disallow selection of pages already configured by something in the core plugin.

This does get a little mind-hurty if we want to consider the best way to extend this...

For example, after selecting the student dashboard page, that page should not be available for the groups directory (or the student directory in social learning).

But how do we ensure that the reverse can't happen? IE how do we prevent the groups directory from being selected as the student dashboard page?

We could attach a filter to the excludes list so that each add-on can determine what pages should be excluded globally from page selectors... But we need to ensure that in doing so we don't prevent the page from being selected from itself. A second parameter on the filter of the option name could be used to ensure we don't filter the page out from it's currently selected option...

thomasplevy avatar Jun 08 '21 16:06 thomasplevy