• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP Discuss

Wordpress Research & Analytic

  • Submit
  • Disclaimers
  • About
  • DMCA
  • Privacy Policy
  • Contact

September 27, 2019 by [post_author_posts_link_outside_loop] Leave a Comment

Get user count based on multiple meta key values?

I am trying to count all of the users meeting multiple criteria. I have tried so many different things and cannot get it to work. Any help is much appreciated. Thank you.

add_shortcode('pbe_storecount', 'pbe_shopcounts'); function pbe_shopcounts($atts) { $atts = shortcode_atts( array( 'state'   => '', 'metakey'   => 'Group', 'metavalue' => do_shortcode('[display_name]'), 'userrole'  => '', ), $atts ); $getQuarter = do_shortcode('[usermeta key="current_quarter" user="717"]'); if ($getQuarter == '1'){ $currentQuarter = 'ranker_q1'; } elseif ($getQuarter == '2'){ $currentQuarter = 'ranker_q1_89'; } elseif ($getQuarter == '3'){ $currentQuarter = 'ranker_q1_90'; } elseif ($getQuarter == '4'){ $currentQuarter = 'ranker_q1_91'; } else { $currentQuarter = ''; } $user_ids = get_users( $args ); $args = array ( 'role__in'    => wp_parse_list( $atts['userrole'] ), 'fields'      => 'ID',  // retrieve just the IDs 'count_total' => false, // no need for FOUND_ROWS() 'meta_query' => array( 'relation' => 'AND', array( 'meta_key'     => $atts['metakey'], 'meta_value'   => $atts['metavalue'], 'meta_compare' => '=', ), array( 'meta_key'       => $currentQuarter, 'meta_value'     => 'High', 'meta_compare' => '=', ), ) ); return 'There are <strong>' . count( $user_ids ) . ' High Performers</strong> for ' . $atts['metavalue'] . ' in ' . $atts['state'] . ';} 

  • Plant Based Protein Supplements Market 2019: Global Analysis, Share, Trends, Application Analysis and Forecast To 2024
  • The Economic Value of Digital Identity
  • Nearly $18B on the line for Indiana in 2020 census count
  • We need evidence-based decision making
  • 10 Tips to Increase User Engagement for Your E-commerce Website
  • Lilo's End User Guide on how to Recover from a Google Penalty
  • The Pegulas' bid for Rand Capital wins some key support
  • Housing a key part of vision for Downtown Lafayette
  • How the hackers got in; Tech companies caught between user convenience, damage to their brands
  • Cajun Cannabis owner faces three felonies, multiple drug charges
Get user count based on multiple meta key values? have 295 words, post on wordpress.stackexchange.com at September 27, 2019. This is cached page on WP Discuss. If you want remove this page, please contact us.

Primary Sidebar

RSS Recent Stories

  • 7 Best Auction Plugins for WordPress (2021)
  • 6 Top Grammar Checkers For WordPress
  • How to Hide a Mobile Menu in WordPress (Beginner’s Guide)
  • 10+ Free MailChimp WordPress Plugins to Increase Optins
  • The Month in WordPress: February 2021

Sponsored Links

  • Phú Quốc authority wants to bring ’troublesome’ Russian girl to mainland
Copyright © 2021 WP Discuss. Power by Wordpress.