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

Add class_exists() check for classes (e.g. Fe_Stop_Emails) #17

Open
salcode opened this issue Aug 20, 2019 · 0 comments
Open

Add class_exists() check for classes (e.g. Fe_Stop_Emails) #17

salcode opened this issue Aug 20, 2019 · 0 comments

Comments

@salcode
Copy link
Owner

salcode commented Aug 20, 2019

If you have the stop-emails.php file in /mu-plugins/ and have the plugin activated you get the following fatal error.

Fatal error: Cannot declare class Fe_Stop_Emails, because the name is already in use in /public_html/wp-content/plugins/stop-emails/stop-emails.php on line 90

I suspect we'll need to wrap our class definitions inside a bool check that the classes do NOT already exist.

e.g. the following should work

if (
    ! class_exists( 'Fe_Stop_Emails_Fake_PHPMailer' ) &&
    ! class_exists( 'Fe_Stop_Emails' )
) {
   ....
}
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

1 participant