Is there a way to redirect users to dashboard after purchase?

Is there a way to redirect users to their dashboard after they purchase a course or, to edit the order confirmation page to include a link to start learning. I'm finding customers are confused when they purchase a course, on how to get started. Thanks.

  • Ivan Shulev
    • The Bug Hunter

    Hey Meagan ,

    I hope you are having a nice day so far!

    I'm afraid your question will require some further digging and I will have to call our SLS support team (coding experts).

    Either me or someone else will post an update here.

    Please keep in mind that the response might take a bit longer.

    Thank you for your understanding and I wish you an awesome day ahead!


  • Panos
    • SLS

    Hi Meagan ,

    In order to redirect users to their dashboard you can add the following snippet at your child theme's functions.php file:

    add_action( 'init', 'wpmudev_redirect_to_cp_account_filter' );
    function wpmudev_redirect_to_cp_account_filter(){
    	add_filter( 'mp_order/status_url', 'wpmudev_redirect_to_cp_account', 2, 10 );
    function wpmudev_redirect_to_cp_account( $url, $order ){
    	return CoursePress::instance()->get_student_dashboard_slug( true );

    I would prefer editing the order page, as it confirms payment to customer/student. You could try this by adding the following at your child theme's functions.php file:

    add_action( 'init', 'wpmudev_mp_order_details_filter' );
    function wpmudev_mp_order_details_filter(){
    	add_filter( 'mp_order/details', 'wpmudev_mp_order_details', 2, 10 );
    function wpmudev_mp_order_details( $html, $order ){
    	$new_html = '
    		<!-- MP Single Order Details -->
    		<section id="mp-single-order-details" class="mp_orders">
    			<div class="mp_order_details">
    				<div class="mp_order">' .
    	        $order->header( false ) .
    	        '</div><!-- end mp_order -->';
    	$order_items = get_post_meta( $order->ID, 'mp_cart_items' );
    	$order_items = $order_items[0];
    	$course_items_html = '';
    	foreach( $order_items as $product_id => $product ){
    		$args = array(
    		    'meta_key' => 'mp_product_id',
    		    'meta_value' => $product_id,
    		    'post_type' => 'course',
    		    'post_status' => 'any',
    		    'posts_per_page' => 1
    		$courses = get_posts($args);
    		if( !empty( $courses ) ){
    			foreach( $courses as $course ){
    				$course_items_html .='
    				<div class="mp_orders">
    					<div class="mp_course_item mp_order_detail">
    						<a href="'.get_permalink( $course->ID ).'">
    							' .
    							sprintf(__('View course <strong>%s</strong>', $mp), $course->post_title)
    			        		 . '
    					</div><!-- end mp_course_item -->
    	if( $course_items_html != '' ){
    		$new_html .= '
    		<div class="mp_order">
    		<h3 class="mp_order_head">'. __( 'Courses', 'mp' ) .'</h3>
    	$new_html .='
    				<div class="mp_order_address">' .
    	        $order->get_addresses() . '
    				</div><!-- end mp_order_address -->
    	$new_html .= '
    			</div><!-- end mp_order_details -->
    		</section><!-- end mp-single-order-details -->';
    	return $new_html;

    Hope this helps!

    Kind regards,

  • Panos
    • SLS

    Hi Meagan ,

    I also tried with latest version as Nastia mentioned :slight_smile:

    In case it doesn't work for you after updating I would need to have a closer look and try it out on your installation. For this I would need to provide ftp access by sending ftp and admin credentials.

    You can send that privately through our contact form:

    Select "I have a different question?" for your topic - this and the subject line ensure that it gets assigned to me.

    Send in:Subject: "Attn: Panos Lyrakis"

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP credentials
    (and port if required)

    - link back to this thread for reference
    - any other relevant urls


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.