Skip to:
Content
Pages
Categories
Search
Top
Bottom

trying to fetch members by type using the BP function

  • @sdwebdesignffm

    Participant

    Hello,
    I need help with a customization.

    We need to pull all members of specific types. And using BP pro addon to create member type. Please provide us code sample to pull users by member type.

    Thanks and regards,
    Steffen

Viewing 5 replies - 1 through 5 (of 5 total)
  • @shanebp

    Moderator

    @sdwebdesignffm

    Participant

    Hi,
    Thank you very much for the help, but I have seen and apply the same function but it is only fetches few members, here is the code:

    $q = new BP_User_Query(array(‘member_type__in’ => [‘company’]));
    $users = is_array($q->results) ? array_values($q->results) : array();

    Do you have any idea what is wrong?

    Thanks and regards,
    Steffen

    @sdwebdesignffm

    Participant

    It only fetches few members, but from user dashboard we can see we have a lot more members of type ‘company’, can you please help us why only few (5 members) are being pulled?

    @shanebp

    Moderator

    If members have never logged in, they will not have an activity timestamp and will not appear in the Members list on the front end.

    This code will add that timestamp for all users.
    https://gist.github.com/shanebp/b73343e9c9a6509d2bbc47de80c881c1

    @sdwebdesignffm

    Participant

    Thank you very much! That fixed the issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar