-
Author
Tagged: search, ajax, filters, back button
-
July 10, 2014 at 18:51 #22318AdamParticipant
If you perform a search from /Members, view a profile, use the back button to return to /Members, the last set of results is still displaying, but clicking on page 2, 3 etc. shows members outside of the originally selected filters.
e.g.
* visit meetmindful.com/members
* click ‘Search’
* choose sex: ‘Female’; age ’20’ to: ’30’;
* submit Search
* Click on someone’s profile
* Use the ‘back’ button to return to the Members page
* Observe search parameters still in addressbar (good)
* Observe “Your search returned *** results” (good)
* Click page 2
* Observe members outside of age range displaying, for exampleI know the pagination uses AJAX. It seems to be ignoring the parameters selected in the search form / in the address bar?
July 10, 2014 at 18:52 #22319AdamParticipantNote: simply running a search and clicking page 2, 3, etc works fine. This problem only occurs if you leave the members page and use ‘back’ button to return.
July 11, 2014 at 18:44 #22420AbeKeymasterWell yes since the pagination is done by AJAX that back button will return you to the members page on page 1
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.July 11, 2014 at 18:50 #22421AdamParticipant@abe yes that is expected. The back button returns me to page 1. But after that, if I click on page 2, page 2 should show members according to the filters. It even says “Your search found xxx”, etc.
In other words, it we need to check for search-form selections/filters every time page 2, 3 etc is clicked.
July 14, 2014 at 15:51 #22533AbeKeymasterI see what you mean.. we will see why this happens.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.July 22, 2014 at 20:07 #23247AdamParticipantHi @abe – We’re implementing a radius-based postal-code filter on our /members page, and having some trouble with the AJAX results on pages 2, 3, etc, as well.
While we’re working on this problem we may arrive at a solution for the first issue mentioned here. And if so, we’ll pass it along.
July 25, 2014 at 21:29 #23665AdamParticipantadding ‘no-ajax’ to the pagination div to disable AJAX seems the best course of action for now.
We would like to re-enable it when possible!
August 22, 2014 at 23:55 #26435AdamParticipant@abe any progress on this? I’d love to be able to re-enable ajax on the members page.
We re-designed the discovery process a bit,
http://www.meetmindful.com/members/ (I believe you have a free account already..)I noticed when adding no-ajax to disable ajax browsing, the ‘Favorites’ tab pagination breaks.
(Favorites is my modified version of the followers plugin.)
THe pagination still points to a /wp-admin/ajax.php address, and the page errors out with a simple ‘0’. I imagine this is because the ajax URL is wp-admin/admin-ajax.php.
Anyway, this means I have to disable the ‘Favorites’ tab entirely until this is worked out, or switch to enabling ajax on the members page and dealing with the other bug that loses search parameters after viewing a profile and hitting ‘back’ (topic of thread.)
Thoughts?
August 25, 2014 at 20:57 #26563AdamParticipantI found that ‘no-ajax’ needs to be applied to the .item-list.search list div in the members loop as well.
When this is done, clicking on the tab to switch to ‘friends’ (or in my case ‘following’ or ‘favorites’) will point to the user’s profile, with their friends/followers/favorites loaded, depending on whatever /path/ you have assigned for this filter/loop.
So this allows me to show my users’ favorites again, but we’d still love if we can actually use AJAX, which is being prevented by the bug that does not retain search filters after visiting a profile and hitting ‘back’.
Perhaps we could solve this by saving all search params in cookies and checking for the values of those cookies every time a pagination link is clicked, when AJAX browsing is enabled??
August 28, 2014 at 01:18 #26877AbeKeymasterI will do some research next week on this and hopefully come with a solution.
I really like how your site evolved. I look very good. Congrats.
We will build a small showcase section on Sweetdate Themeforest page. Can we include also your site there?Cheers
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.August 28, 2014 at 01:23 #26879AdamParticipantThanks!
Yes, you can include our site there.
I would be happy to test any patches for you, if needed. We have about 1,500 users.
August 28, 2014 at 01:30 #26880AbeKeymasterGreat, I wish you many many users 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.October 2, 2014 at 20:48 #30479AdamParticipanthi @Abe,
Is there no hope on enabling AJAX for member’s browsing? 🙁
meetmindful.com/members
the two bugs:
1) viewing a profile, returning to /members, and paging->forward after a search loses the search parameters.2) without a search (simply visiting /members) you can only page-forward 1 or 2 times. On page the extra ‘0’ on the end of the response breaks the page. (Happens with AJAX-driven friends lists too)
October 8, 2014 at 13:18 #31067AbeKeymasterhi @Adam
I got an idea an I am working on this today. Will keep you posted 😉PS. What have you used for the zip code nearby search?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.October 8, 2014 at 13:22 #31068AbeKeymasterYour other problem must come from something on your side since I can’t reproduce it on the demo
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.October 8, 2014 at 17:33 #31097AbeKeymasterin /wp-content/themes/sweetdate/custom_buddypress/_inc/global.js around line 714 add after:
COPY CODEjq('html, body').animate({ scrollTop: jq(".item-list-tabs").offset().top }, 500);
this:
COPY CODEif (object == 'members') { window.history.pushState(null, null, jq(target).attr('href')); }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.October 9, 2014 at 05:24 #31143AdamParticipantHi Abe,
This works better but I think there’s another piece that needs a fix.
With the update you provided, I can perform a search, move to page 2, view a profile, click the back-button, and then move to page 3, and the results still match my query.
However, after page 2 the pagination links change to /admin-ajax.php?page=X.
So if I view another profile and then use the back-button to return to this page, I the blank-page and ‘0’ response.
It seems if we can maintain the proper URL on the pagination links at all times, this issue will be fully resolved! Any ideas?
October 9, 2014 at 17:04 #31194AbeKeymasterIt might something on your end since on the demo site it does not happen. try to update buddypress or the theme.
seventhqueen.com/demo/sweetdatewp/membersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.October 9, 2014 at 18:36 #31204AdamParticipantIt probably is – I’ll keep looking!
However, on your demo site, the URL doesn’t update with any upage information. So when I view a member on page 3, and then go “Back”, it goes back to the beginning?
October 9, 2014 at 19:09 #31210AbeKeymasterI haven’t implemented it yet on the demo
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 19, 2014 at 16:18 #35969adamParticipanthi @adam – you’re an awesome developer/designer. any interest in helping me with my site http://www.couplefriends.com? even if you have just a little time to spare it would be appreciated. i can pay. you can email me at emailadamrose at gmail.com thanks! -adam
January 21, 2015 at 02:17 #42826AdamParticipant@abe I’m still working on this issue.
Should bp_filter_request use the bp-members-search cookie (contains query string) when using AJAX on the members search?
I found:
bp-members-search is set when executing search. It contains search params/query string.
When viewing a user profile, bp-members-search is deleted (???)
When going back to search results, with bp-members-search gone, the next page of results *loses* the query information.Desperate for help here!
I’m going to duplicate the cookie information into my own cookie, then re-set it into bp-members-search when viewing profiles. But my query string also has new information (“zipradius” for example,) and Im trying to figure out how to use bp_filter_request to include my custom params.
January 23, 2015 at 13:19 #43165AbeKeymaster@meetmindful have you tried to update to latest theme version available? the back button should go back to the page and the GET parameters in the link should be preserved. On our demo it behaves right.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.January 23, 2015 at 20:18 #43242rweissParticipantI’m wondering if this issue is due to child-theme function.php adaptations?
For example, although this is a different issue, do we still need this in the child theme functions?
/* Birthday to age in profile page */
bp_get_the_profile_field_value();
add_filter(‘bp_get_the_profile_field_value’, ‘kleo_age_field’,10,3);
function kleo_age_field($value, $type, $id) {
$age_field = sq_option(‘bp_age_field’);
if ($age_field == $id) {
$value = xprofile_get_field_data($id);
$diff = time() – strtotime($value);
$age = floor($diff / (365*60*60*24));
$value = sprintf( _n( ‘%s year’, ‘%s years’, $age, ‘buddypress’ ), $age );
}
return $value;
}I’m uploading my child-theme functions.php so you can see it. I’m just wondering if the cause of what Adam is seeing (which I am also dealing with) is caused by old adaptations done in that file.
January 23, 2015 at 20:20 #43244rweissParticipantI guess i can’t upload php files. I saved it as a text file
Attachments:
You must be logged in to view attached files.January 24, 2015 at 10:13 #43306AdamParticipant@abe I’ve updated to 2.8 and the field_x parameters work after using BACK.
However, I have a another field (‘zipradius’; radius from provided ZIP code) and the &zipradius=x value is ignored. Could you help me trace how the ajax ‘next’ or ‘2,3,4’) links work?
Do they get parameters from a cookie, or directly from GET? I can’t pin down the code that actually requests page 2,3,4 and passes the search parameters.
January 27, 2015 at 21:48 #43646AbeKeymasterthe links are generated by BuddyPress and they should take what is in the GET parameters
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.January 28, 2015 at 06:30 #43716AdamParticipantI’m noticing the only way this works is if I stay on BP 2.0.1 and put ‘no-ajax’ on all of the ‘pagination’ divs.
Upgrade to BP2.1.1 = perform search and page ‘2’ does not use GET parameter ‘zipradius’
With either 2.0.1 or BP2.1.1, removing ‘no-ajax’ from ‘pagination’ DIV = URLs change to /admin-ajax.php?upage=2 or 3
-
AuthorPosts
You must be logged in to reply to this topic.