Created
June 23, 2019 09:54
-
-
Save mahfelwp/a10f901314a8c12d6d394ab5e5694efa to your computer and use it in GitHub Desktop.
Verified users count shortcode in Youzer plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function yz_verified_users_count_shortcode( $atts = null ){ | |
global $wpdb; | |
// Get Args. | |
$args = shortcode_atts( | |
array( | |
'verified' => 'on', | |
), $atts, 'yz_verified_users_count' ); | |
$request = "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = 'yz_account_verified' AND meta_value = '{$args["verified"]}'"; | |
$users = $wpdb->get_col( $request ); | |
return count($users); | |
} | |
add_shortcode( 'yz_verified_users_count', 'yz_verified_users_count_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment