Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sort by xprofile field on Members page

  • @aendrew

    Member

    Hi there,

    I’ve created a custom profile field called “Company”, which I ultimately need the option to sort by alphabetically on the member list page. Ideally, this would be an option in the “Order by” dropdown on /members/.

    Is there any way to do this without hacking bp-core-classes.php? I’ve thought about adding code around line 144 like so:

    if ( ‘company’ == $type )
    $sql = “AND pd.field_id = 2”;

    and at line ~190:

    case ‘company’:
    $sql[] = “ORDER BY pd.value ASC”;

    Thanks!

    Note that I don’t want to search for it so much as sort by it; I’m basically using this page as a roster of organization members.

    Would it make more sense to do companies as groups, then do some language file overrides renaming “Group” to “Company”, etc.?

    Thanks!

    -Æ.

Viewing 8 replies - 1 through 8 (of 8 total)
  • @xberserker

    Participant

    I’m looking to do something similar. I want to sort members by who has the most points. Any direction would be helpful.

    Here is the sql when points are logged:

    ‘ global $wpdb;
    $wpdb->query(“INSERT INTO `”.CPDB.”` (`id`, `uid`, `type`, `source`, `points`, `timestamp`)
    VALUES (NULL, ‘”.$uid.”‘, ‘”.$type.”‘, ‘”.$source.”‘, ‘”.$points.”‘, “.time().”);”);’

    @xberserker

    Participant

    @aendrew Did you have any luck with this?

    @xberserker

    Participant

    @remotedevice

    Participant

    anyone figured this out?

    @xberserker

    Participant

    Nothing yet :(

    @aendrew

    Member

    Apologies for kinda abandoning this thread. Thanks for finding me that post, xberserker; I’ll give that a shot!

    Cheers!

    @mistercyril

    Participant

    Hello guys,

    I’m interested in doing the same thing. Have you figured out a way of doing this without writing an SQL query?

    I would be ok with hard coding the field I need to sort by.

    My current query looks like this (default buddypress) but how can I have it look for a specific field value?
    `$queryString = “type=alphabetical&action=alphabetical&per_page=150”;`

    In WordPress I would use this `orderby=field_name` but thats not doing anything here…

    Any help would be greatly appreciated,

    Thanks,
    C.

    @cparkinson

    Member

    Hi

    I need to sort the members directory to. I want to do it by Membership Level from the Membership plugin, but being able to do it by any profile field would be a start. I’ll look into modifying ‘BP Profile Search’ as suggested in the thread Tosh linked to.

    thanks,
    C

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Sort by xprofile field on Members page’ is closed to new replies.
Skip to toolbar