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

Code improvement on BuddyPress detection #511

Closed
Mte90 opened this issue Apr 28, 2018 · 5 comments · Fixed by #515
Closed

Code improvement on BuddyPress detection #511

Mte90 opened this issue Apr 28, 2018 · 5 comments · Fixed by #515
Assignees
Labels
Status: Has PR This issue has an open pull request Type: Enhancement Improvements existing features or code

Comments

@Mte90
Copy link
Contributor

Mte90 commented Apr 28, 2018

immagine

As I can see in every page there is this query, but there isn't Buddypress in my installation.

immagine

AS I can see on

$load_integrations = apply_filters( 'lifterlms_integrations', array(

the class are defined maybe they are executed on every page.

There is the request https://github.com/gocodebox/lifterlms/blob/master/includes/abstracts/llms.abstract.integration.php#L125 maybe we can add a check in the classes with detect the plugin like for

if ( class_exists( 'bbPress' ) && 'yes' === get_option( 'llms_integration_bbpress_enabled', 'no' ) ) {
inside every class.
In the meantime we can disable with an hook and save a query in every page, in all the pages of the site.

@Mte90 Mte90 mentioned this issue Apr 28, 2018
@thomasplevy
Copy link
Contributor

This are the queries that happen in all the pages (in this case in the website homepage) maybe we can do something to do only when required?

Let's track this as a separate issue please

@thomasplevy
Copy link
Contributor

I see that also this query run in all the pages on

lifterlms/includes/class.llms.query.php

Line 121 in 2a36f21

  	'person-logout' => get_option( 'lifterlms_logout_endpoint', 'person-logout' ), 

but this value is required in the code?

Please open this as a new issue as well please

@Mte90
Copy link
Contributor Author

Mte90 commented Apr 28, 2018

Opened other two tickets and cleaned this one

@thomasplevy
Copy link
Contributor

Opened other two tickets and cleaned this one

Thanks!

@thomasplevy
Copy link
Contributor

@Mte90 check #515 for me please, this will flip the is_installed() and is_enabled() checks on integration classes which will prevent the DB call (made by is_enabled()) when the integration is loaded by first using is_installed() to check for the existence of the integration dependencies

With BuddyPress: https://github.com/gocodebox/lifterlms/blob/master/includes/integrations/class.llms.integration.buddypress.php#L108

With bbPress: https://github.com/gocodebox/lifterlms/blob/master/includes/integrations/class.llms.integration.bbpress.php#L229

Etc...

Let me know if that helps!

@thomasplevy thomasplevy added Type: Enhancement Improvements existing features or code Status: Has PR This issue has an open pull request labels Apr 28, 2018
@thomasplevy thomasplevy self-assigned this Apr 28, 2018
thomasplevy pushed a commit that referenced this issue Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Has PR This issue has an open pull request Type: Enhancement Improvements existing features or code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants