Opened 10 years ago
Closed 10 years ago
#5812 closed defect (bug) (fixed)
BP_Group_Extension::_register() should only run if there is a valid group ID
Reported by: | r-a-y | Owned by: | r-a-y |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Groups | Keywords: | has-patch |
Cc: |
Description
In #4785 some work was done to overhaul the access and visibility control for group tabs.
However, if there is no group ID, BP_Group_Extension::_register() should not continue as it runs a few DB queries to check access and visibility.
To test, navigate to a user page and check the queries that are run.
Attachments (1)
Change History (6)
#2
@
10 years ago
I doubt there will be unforeseen issues, but it's possible - there may be plugins that analyze the available BP_Group_Extension extension on each pageload, and leaving them half-initialized could be a problem for them.
A more conservative approach is to bail at the beginning of user_meets_access_condition()
if $this->group_id
is empty. Will that take care of the db queries?
#3
@
10 years ago
A more conservative approach is to bail at the beginning of user_meets_access_condition() if $this->group_id is empty. Will that take care of the db queries?
Yup, that works. However, there is a backward compatibility block before that, which does a groups_get_group()
call. (It doesn't run for me at the moment, but just wanted to list that.)
Could the group ID check go at the very beginning of the setup_access_settings()
method?
01.patch
bails out of theBP_Group_Extension::_register()
method if there is no valid group ID. I'm hoping there aren't any unforeseen issues with doing this.