Notifications
Clear all

Script [Solved] Refer to the latest unread post without redirection

9 Posts
3 Users
1 Reactions
1,786 Views
Posts: 9
Topic starter
(@mouette)
Active Member
Joined: 4 years ago
Posted by: @robert

And don't care about the page ID. It doesn't need page ID, it'll redirect and open correct post in correct page with post-id only. Just make sure the red marked options are enabled and try to click the links of topics. You'll see that all works fine, and it goes to correct post with the correct page (even if the page number doesn't exist in the URL).

Hi, 

I see that the redirection of the page is the native functionality to go to the last unread post.

Unfortunately, this redirection can be really slow sometimes, users are really not satisfied with this feature, and I understand them.

Is there an evolution planned on this point so that the link goes directly to the right page of a topic?

It is not possible to calculate from the recent.php page where the post will be located according to the number of posts per page and the date of the post?

8 Replies
Robert
Posts: 10591
Admin
(@robert)
Support Team
Joined: 9 years ago

The redirection only works if the topic has more than one pages of replies. However, you can switch to the direct link generation with this hook code. Put it in the functions.php file of your current active WordPress theme or install the Code Snippets plugin and insert the code as a new code snippet. Then go to Dashboard > Forums > Dashboard admin page and click the [Delete all caches] button.

add_filter('wpforo_build_direct_unread_post_url', '__return_true');

 

7 Replies
(@mouette)
Joined: 4 years ago

Active Member
Posts: 9

@robert thank a lot for your answer!!

Honestly I don't understand why this is not by default in the forum???

(@mouette)
Joined: 4 years ago

Active Member
Posts: 9

@robert  bad news, it seems that this solution doesn't work with IOS 

Any idea please?

Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10591

@mouette,

The solution is not depended on OS, that has zero relation to your iOS.

So I don't have other advice here. If it works then it should work on all OS's, just make sure your login status is the same, and you don't have cache. This is all.

 Bono
(@bono)
Joined: 4 years ago

Active Member
Posts: 10

@robert Hello

after adding the code in your first reply, we don't have any problem with Chrome (PC and Mobile)

But, we have somes troubles on Firefox and iOs, when a topic is divided in pages, the rediction is on the top of the last page, but not on the last post wanted

Do you have any idea about this trouble ? any other feedbacks ?

Thanksss in advance for your help

(@mouette)
Joined: 4 years ago

Active Member
Posts: 9

@robert I think it is an issue link to the navigator, not to the OS

The issue is there with Opera too.

Since there is a redirection from the top of the page to the last unread message, I think there is an issue with a JS function which is not available for some browser, don't you?

Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10591

@bono,

I'd look at this issue if you provide with some video showing the issue.

 Bono
(@bono)
Joined: 4 years ago

Active Member
Posts: 10

@robert Thanks for your answer, We found and fixed the problem

I give you the part of code below in wpf-assets\js\front-end.js :

The first line in bold, the fix (with just before the code in comments which was not working), and the second one in bold the code which was not reached

 

$wpf(document).ready(function($) {
    var wpforo_wrap = $('#wpforo-wrap');

    var scroll_to;
    //var exreg = new RegExp('\/' + wpforo.template_slugs['postid'] + '\/(\\d+)\/?$', 'i');
    //var match = location.pathname.match(exreg);
    var match = location.hash.match(/^#post-(\d+)$/);
    if(match){
        scroll_to = $('#post-' + match[1]);
    }else{
        //scroll_to = $("#m_, .wpforo-members-content, .wpforo-search-content", wpforo_wrap);
    }
    ifscroll_to !== undefined && scroll_to.length ){
        $('html, body').scrollTop(scroll_to.offset().top - 25);
    }