Results 1 to 2 of 2

Thread: Query Issue

  1. #1
    Join Date
    Nov 2016
    Posts
    2

    Unanswered: Query Issue

    Hi

    I am using WordPress v. 4.7 and using a plugin, I was able to add a custom field (meta key) and display it on the Users page.

    - wpcf-status

    Now I need to create a query that displays a list of Users who are assigned the role of Customer (a custom role I created)
    and whose Status = 'Active'.

    I am able to get the first part of the query done and this works.

    However, I have no idea how to add in code that only gets results for Customers who Status = Active

    $sql = "SELECT ID, display_name FROM wp_users
    INNER JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id
    WHERE wp_usermeta.meta_key = 'wp_capabilities'
    AND (wp_usermeta.meta_value LIKE '%Customer%') ";

  2. #2
    Join Date
    Oct 2007
    Posts
    162
    Provided Answers: 9
    how about "AND Status = 'Active'" ???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •