After some investigations my issue comes from my function.php file.
I have a function which allows me to redirect towards home page if you are not administrator :
add_action(‘admin_init’, ‘no_mo_dashboard’);
function no_mo_dashboard() {
if (!current_user_can(‘manage_options’) && $_SERVER[‘DOING_AJAX’] != ‘/wp-admin/admin-ajax.php’) {
wp_redirect(home_url()); exit;
}
}
Now my issue is : how keep this process and your process ?
I you have any ideas ?
Thanks,
Plugin Author
Bob
(@prasunsen)
So is it failing on ajax request?
In fact, I don’t know AJAX.
I just looked for a function to hide the dashboard for all users except administrator. But when I have used it, the namaste payment process was modified.
So now I look for an other function which will be able to hide dashboard and won’t change namaste payement process.
For my understanding, why the namaste payment process is modified with this function ?
Is it possible to go towards paypal payment page just after click on the enroll button without display the popup ?
Thanks,
Plugin Author
Bob
(@prasunsen)
The function sends ajax request to figure out the amount. So the plugin needs Ajax to be working. From your explanation it sounds like it isn’t working.
I am not sure this part of your code is correct:
&& $_SERVER[‘DOING_AJAX’] != ‘/wp-admin/admin-ajax.php’
One of the suggestions here might be better:
https://premium.wpmudev.org/forums/topic/disable-user-dashboard-at-wp-admin
function no_mo_dashboard() {
if (!current_user_can('manage_options' ) && !(defined('DOING_AJAX') && DOING_AJAX)) {
wp_redirect(home_url()); exit;
}
}
I don’t know everything either so it may or may not help.
Thanks for your precious help, that worked !