Skip Navigation

[Résolu] Infinite scroll "load more" works only for logged in users

This support ticket is created Il y a 2 années et 1 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 réponses, has 2 voix.

Last updated by Ido Angel Il y a 2 années et 1 mois.

Assigned support staff: Christian Cox.

Auteur
Publications
#1888549

Hey,

Here:

hidden link

the "load more" button doesn't work if a user isn't logged in, but does work if logged in.

thx!

#1888799

Okay I can't replicate this on a simple test site with a similar setup. However, the Load More pagination button hack isn't expected to work correctly on all sites:
https://toolset.com/forums/topic/infinite-scroll-load-more-button/

We have a feature request for adding a true "load more" button for infinite scrolling views, and it is gaining traction for an upcoming release. Do you have a staging site set up where we can temporarily deactivate some other plugins and activate a default theme to run additional tests?

#1888811

Hey c!
Current site is staging, still not on air so you can run tests on it
Thx!
Ido

#1888893
Screen Shot 2020-12-28 at 10.43.54 AM.png

For some reason, admin-ajax.php requests are being redirected to the dashboard page when the User is logged out. I haven't been able to pin it down to some specific cause yet. Any ideas? I'm still investigating.

#1888929

Hmmm... the only reason I can think of is this function:

function ts_lockout_dashboard() {
    if ( is_admin() && !current_user_can('administrator') ) {
        wp_redirect( home_url( '/dashboard/' ) );
        die();
    }
}
add_action('init', 'ts_lockout_dashboard');

And it's probably it. When I disable it, it works. It's supposed to prevent users from accessing the dashboard. Is there anything wrong in it?
Thanks!

#1888931

Ok got it. Replaced it with this:

 add_action( 'init', 'blockusers_init' ); function blockusers_init() { if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { wp_redirect( home_url() ); exit; } }

Thx!!!