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

Problem with backticks in queries #2

Closed
xgat opened this issue Jan 4, 2017 · 4 comments
Closed

Problem with backticks in queries #2

xgat opened this issue Jan 4, 2017 · 4 comments

Comments

@xgat
Copy link

xgat commented Jan 4, 2017

Hi,
MySql (5.5.53/Linux) complains about backtics in queries, e.g. this is the error I get when opening page "Membership Levels":

WordPress database error Unknown column 'mlg.group' in 'field list' for query SELECTmlg.groupFROM wp_pmpro_membership_levels_groups mlg WHERElevel= -1

I had to remove all backticks in pmpro-multiple-memberships-per-user/includes/functions.php to make it work.
Thank you

@dchenk
Copy link
Contributor

dchenk commented Jan 8, 2017

I'm getting the same exact error!
Can you please explain in more detail what's going on?

@xgat
Copy link
Author

xgat commented Jan 8, 2017

Hi,
mysql doesn't like backticks in queries, to make the plugin work open pmpro-multiple-memberships-per-user/includes/functions.php with a text editor and remove all occurrences of `.
E.g. the following string
"SELECT `mlg.group` FROM {$wpdb->pmpro_membership_levels_groups} mlg WHERE `level` = %d"
should be replaced with
"SELECT mlg.group FROM {$wpdb->pmpro_membership_levels_groups} mlg WHERE level = %d"
Bye

@dchenk
Copy link
Contributor

dchenk commented Feb 6, 2017

In the file includes/functions.php there are two instances where the backticks on "mlg.group" are causing errors. I had to remove both, and I suspect such backticks also caused an error for me just now when the plugin allowed a user to register for a second level in the group where they're only allowed one level at a time. The plugin was supposed to cancel the user's membership to the previous level.

Please fix this asap! Thanks a lot.

@eighty20results
Copy link
Contributor

Pull request to resolve this issue: #5

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

3 participants