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

Revise wo_ap_et_access_token_for_user #61

Open
mrwpress opened this issue Mar 13, 2022 · 0 comments
Open

Revise wo_ap_et_access_token_for_user #61

mrwpress opened this issue Mar 13, 2022 · 0 comments

Comments

@mrwpress
Copy link

function wo_ap_et_access_token_for_user() {
global $wpdb;

$current_user = get_current_user_id();
$check        = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}oauth_access_tokens WHERE user_id ={$current_user}" );

return $check;

}

Needs to be:

function wo_ap_et_access_token_for_user() {
global $wpdb;

$current_user = get_current_user_id();
$query        = "SELECT * FROM {$wpdb->prefix}oauth_access_tokens WHERE user_id = %d";
$query        = $wpdb->prepare( $query, $current_user );
return $wpdb->get_row( $query );

}

NOTE: The prepare() method of $wpdb ensures security of the query.

https://developer.wordpress.org/reference/classes/wpdb/prepare/

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