• Resolved klonerom

    (@klonerom)


    Hey,

    I have an issue in payment process. When I click on enrollment button the window “Payment for course” is displayed but the content is my home page and not the payment button.
    So student can not pay to enroll in courses.

    For information, when I have desactivated all my plugins the behaviour is identical.

    My version of namaste LMS is the last one : 1.5.5

    Have you any ideas where issue comes from ?

    Thanks,

    https://www.ads-software.com/plugins/namaste-lms/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter klonerom

    (@klonerom)

    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?

    Thread Starter klonerom

    (@klonerom)

    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.

    Thread Starter klonerom

    (@klonerom)

    Thanks for your precious help, that worked !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘window of "Payment for course" display my home page’ is closed to new replies.