User topics-created pagination
-
Just updated to 2.2 and had a run around to make sure everything is still compatible with my theme, and all is perfect apart from the pagination on each users profile.
The permalink to numbered pages is /users/admin/page/2/ and returns a 404, when on this forum the permalink looks like /users/admin/topics/page/2/
I’m guessing that updating bbPress is not the cause, as my site is too new to know if it was previously working – but I’m very grateful if you can help put me in the right direction for a fix!
Thanks.
– using latest bbPress & WordPress, toolbox theme + child bbPress Twenty Ten 1.1 overide
-
I fixed this issue by re-saving my permalinks.
I’ve tried re-saving both my Permalinks and Forum settings and I’m still having issues.
My settings are:
Common Settings
Post nameArchive Slugs
Forums base – forums
Topics base – topicsMaybe some caching plugin is keeping the rewrite rules option persistent somewhere? Resaving permalinks should fix this right up.
Disabled my cache plugin and re-saved permalink and forum settings with no luck.
I’ve scanned my custom code to see if there’s a custom hook I’ve played with in the past that’s overwriting it – but can’t find anything.
Here’s the problem page: http://www.ratsclan.com/users/admin/
I haven’t got a fix for you though hopefully @jjj can do some magic.
The issue relates to how your user profiles /users/admin/ are including ‘recent topics’ on that same page rather than the default bbPress /users/admin/topics/, thus if you go to /users/admin/topics/page/2/ everything is perfect.
In your custom template file user-details.php you have added lines 16-33 but this is causing bbPress to generate the pagination links for the current /user/admin/ URL.
I know I have found the problem, but a solution, nope, I’m stuck, my PHP skills are not quite there yet 😉
References: Changeset 4322 and /includes/topics/template-tags.php#242 bbp_is_single_user_topics pretty permalinks.
Your site is awesome to say the least and I see you have pimped it…
Thanks for my diagnosis Stephen – that’s a massive help.
The site is so new that I’m not sure anyone other than myself has even used a second page. So there’s no rush. I’ll try to work on a fix this upcoming weekend.
Thank you for your kind words, I’m glad you like the design! 🙂
Not be the most elegant solution, but it’ll have to do for now:
//redirect user profile topic permalinks to fix pagination, as we have topics embedded on profiles
function rats_redirect_user_pagination( $pagination ) {
// Get bbPress
$bbp = bbpress();
if (bbp_is_single_user() && is_array($pagination) && isset($pagination['base']) ) {
//if topics has not been included in the url yet
$check_topic = strpos($pagination['base'], '/topics/page/');
if($check_topic === false) {
$pagination['base'] = str_replace('/page/','/topics/page/', $pagination['base']);
}
}
//return pagination array
return $pagination;
}
add_action('bbp_topic_pagination', 'rats_redirect_user_pagination', 99, 1 );
That’s one way to do it, sure. Either way, you’ll need something like that if you want to keep the old style profiles around. Nice work.
- You must be logged in to reply to this topic.