Posted: December 6, 2017 at 7:44 pm
Hi, I am using EE4 and Calendar Add-on. I have created a page using the calendar shortcode [ESPRESSO_CALENDAR]. The calendar is loading successfully only when I am logged in as Administrator. I get the spinning wheel on all other cases, logged out or logged in as Subscriber. Thanks in advance for your help. Patrick |
|
Hi Patrick, This sounds like there’s some code on your website (or a plugin setting) that’s restricting wp-admin/admin-ajax.php to all non-admin requests. Are there any security plugins set up or any code snippets added to a custom functions plugin or .htaccess file to lock down the wp-admin? |
|
Thanks for this quick reply ! I deactivated the Wordfence plugin and still get the spinning wheel when trying to load Calendar. I do have a snippet to restrict backend access to admin users but I can’t see why it would block access to wp-admin/admin-ajax.php. Here’s the code : add_action( ‘admin_init’, ‘restrict_admin’, 1 ); I am also hiding WordPress menu items and admin bar from non-admin users : //* Hide WordPress backend pages for non admin users //* Hide WordPress admin bar for non admin users I did checked other plugins but neither seems to interfere at first glance. Maybe I should dig further ? Waiting for your reply. Regards. Patrick |
|
And by the way, I am using the Genesis framework if that could help in some sort… |
|
Hi Josh, me again ! You were right ! I deactivate the restrict admin function and the spinning wheel is gone ! I am sure there is a way to add a condition statement to allow the wp-admin/admin-ajax.php file to be accessible without compromising the restriction requirement ? |
|
It’s your restrict_admin function, where you have:
You need to check if its an ajax request:
Note that wp_doing_ajax() was introduced in WP 4.7.0 |
|
Thank you Tony ! It works ! Hope that does not create a breach where a non-admin could access the admin area, although I have disabled all menus for non-admin users. Not sure 100% what I am doing at this point. Guest I’ll need to evaluate all access cases. |
|
Can I ask why the above is necessary? WordPress doesn’t allow access without specific capabilities already, I don’t see a need for the above other than to check if a user has the administrator role (which is really the incorrect use case for |
|
I am building a membership site with different user permissions. Some users will have no capabilities (not even read capability) and will have access to a limited number of member’s pages, while others will have custom predefined capabilities that will allow them to access additional front end member’s pages. I want to prevent (most) non-admin users from seeing the WordPress admin screen when they are logging in through the WordPress login screen (/wp-admin or /wp-login) instead of my custom front end login form. The ps_remove_menus() function will allow me to customize admin menu sidebar for Contributors, Editors and Events Administrators (the conditional statement is not yet defined and is presented for test purposes). The remove_admin_bar() function may now be useless as all cases are managed through either the ps_remove_menus() function or the restrict_admin() function. Hope that clarifies things (a little !)… Please feel free to ask any other questions as I appreciate being challenged on my work. I only have intermediate level PHP programming skills ! |
|
The support post ‘Spinning wheel on non-admin lo’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.