Skip to:
Content
Pages
Categories
Search
Top
Bottom

Members directory sorting not working

  • @hahvensa

    Participant

    Hello, I have a problem with members directory. The dropdown select “members-order-by” with the options “active”, “newest”, “alphabetical” is not working. The search works and ajax works but not the select. What could be the problem?

    The select works great on activity page (www.innovaatiomestarit.fi/aktiviteetti) but not on the members page (www.innovaatiomestarit.fi/pelaajat/)

    I have WP 3.5.1 and BuddyPress 1.7.2 which I updated about a week ago from previous version. I think this was working in previous version. I have a child theme of this theme http://themeid.com/responsive-theme/ with buddypress theme.

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

    Participant

    Similar issue –

    After upgrading Buddypress to the latest version of 1.7.2, the “sort alphabetically” is no longer working when viewing the list of members:
    http://www.eastportlandchamberofcommerce.com/business-directory

    It’s not working when you view all members, search results, or when choosing to view members in categories. In members-loop.php, here’s the line of code that has worked up until now:

    <?php if ( bp_has_members( bp_ajax_querystring('members').'&type=alphabetical&per_page=500' ) ) : ?>

    On another note, our programmer has posted this issue twice here since Monday, but her post has not appeared visible to her or to me, or presumably, to others. (Budddypress user, Dzynit) – Any ideas why that’s happening?

    @cyber49

    Participant

    @hahvensa – My programmer, a member of this forum, is unable to have her replies go live or be shown in her history, so after reading your post she had an idea and fixed it – she asked me to post this –

    we don’t use the dropdown select box, but while troubleshooting I put it back on and it doesn’t work for us either. I don’t know a solution to that since we don’t need it.

    On the alphabetical issue: I finally found a way to make it work. I had to edit a core buddypress file though. bp-core/bp-core-classes.php on line 253, I changed from $sql['orderby'] = "ORDER BY u.display_name";
    to
    $sql['orderby'] = "ORDER BY u.user_login";

    Of course this only works for us because we chose to use the business names as the people’s usernames. The sorting by display name, although should work, shows the list out of order. I can’t figure out why, but the core file edit has solved the problem. That will be frustrating on upgrades, but at least it now works.

    Before the upgrade, we were sorting by display name and it worked fine, and this sounds like a workaround – Using buddypress for a chamber of commerce seemed like a good idea at the time, and overall we’ve been pretty happy, but is there any paid support somewhere?

    @hahvensa

    Participant

    Thanks for information!

    My problem had actually a very simple answer. I had an overlaying div that was overlaying the selection and of course the drop down didn’t work. I was looking for something more complicated 😀 So ajax is working on members directory also.

    I hope you’ll find an answer to your problem too 🙂

    @henrywright-1

    Member

    @cyber49 the ajax functionality when searching, filtering or using the pagination is heavily reliant on the HTML markup in members/member-loop.php and members/index.php

    If any of the page elements have been modified or deleted then you’ll hit problems. If you have customised any of these two files then perhaps try starting with a fresh install and add in your customisations gradually to see where the problem is introduced. This approach is laborious but it worked for me.


    @hahvensa
    glad you resolved your issue.

    @chland

    Participant

    Check the value of the “bp-xprofile-fullname-field-name” entry in the WordPress “wp_options”-table.

    SELECT * FROM wp_options WHERE option_name LIKE 'bp-xprofile-fullname-field-name'

    Its value should match the name of the profile field containing the Member-Name. Usually the same as whats returned by

    SELECT name FROM wp_bp_xprofile_fields WHERE id = 1

    If the value in bp-xprofile-fullname-field-name is invalid (for example: in my case it contained “Name” but I renamed the first profile field to “Lastname, Firstname”), BuddyPress goes bonkers and tries to execute an invalid SQL-query resulting in an empty memberlist.

    The main problem is the code located in “plugins\buddypress\bp-core\bp-core-classes.php” around line 260:

    				} else {
    					$fullname_field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", bp_xprofile_fullname_field_name() ) );
    
    					$this->uid_name = 'user_id';
    					$sql['select']  = "SELECT DISTINCT u.{$this->uid_name} as id FROM {$bp->profile->table_name_data} u";
    					$sql['where'][] = "u.field_id = {$fullname_field_id}";
    					$sql['orderby'] = "ORDER BY u.value";
    					$sql['order']   = "ASC";
    				}
    

    $fullname_field_id is empty if the value in bp-xprofile-fullname-field-name points to an non-existing fieldname.

    Hope this helps others with the same problem.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Members directory sorting not working’ is closed to new replies.
Skip to toolbar