Can someone give me an example query please which would return the username if they have current membership?
(Outside of wordpress)
User register on WP website, pays via S2member.
They download OpenVPN client
Enter login details which they chose on WP/S2member signup
OpeVPN script checks auth against MySQL database.
I have this working on a standard WP install (no s2member) as I had modified the MySQL table to add new rows (vpn_enabled). Then it was simple query to check username & vpn_enabled = 1 as all of this was on 1 row in wp_users.
but its complicated as wp_usermeta has loads of rows for each user and I guess this is where I check if they have s2membership.
Please can somebody help with this.
$openvpn_user is passed to the script from elsewhere.
Obviously this DOESNT work as this is the result of lots of failed attempts, I am not super great with MySQL.
this is the sort of thing I need please:
$userresult = $wpdb->get_var( "SELECT meta_value FROM wp_usermeta WHERE wp_capabilities LIKE '%s2member_level1%' AND user_login = '$openvpn_user';" );
End result should just return the username…(if they have valid membership).
Or if there’s an easier way…? It would be great if there was a field in wp_users which I could checked against.
Thank you.