Skip to:

BP_User_Query vs. WP_User_Query

  • jerkerfejjan


    Hi, I have used BuddyPress fore some time, and it works fore my customers needs. But earlier I was trying to do a simple query (bp user query) to find all “teachers” that had the right xprofile_query field_name with value. It almost works well. I have the query on a local server with only 4 “teachers” and the same on a public server with 13000 “teachers” the result is the same. If I use this query for array:

    $lararsusers = array(
    ‘role’ => ‘contributor’,
    ‘orderby’ => ‘first_name’,
    ‘order’ => ‘DESC’,
    ‘xprofile_query’ => array(
    ‘relation’ => ‘AND’,
    ‘field_name’ => ‘Samkoppling’,
    ‘value’ => $kolladenna,
    ‘compare’ => ‘LIKE’
    $users = new BP_User_Query($lararsusers);

    The result with BP_User_Query will always be that I will miss some user, even on the local server with only 4 teachers I will only get 3. But if I change BP_User_Query to WP_User_Query I will find everyone that I am looking for, no misstakes, but the query takes to long if I run it on the public server with 13000 teachers.

    Is there anyone who can help me, something is wrong.
    I´m most thankful for help.

  • You must be logged in to reply to this topic.
Skip to toolbar