CoursePress is not redirecting to student dashboard

I have course press installed. I believe that the students after login, should be sent to their dashboard on the front end but that isn't happening. Instead, they get the backend. also, when I allow for previews of the course, the preview link doesn't do anything. The custom redirect on the student login is my priority, if I can get it to work. I'm using a child theme for the course press pro theme. I disabled very plugin except for CPP and still couldn't get things working. I had to re enable divi builder so the site looks ok again but even with every plugin disabled I couldn't get the custom redirect.

FTP credentials already sent!

  • Panos

    Hey there mcdg03 ,

    Regarding the issue not redirecting to student dashboard, I could also replicate.

    We'll have a closer look on this, until it's fix the following snippet should be fixing this:

    add_action( 'login_redirect', function( $redirect_to, $request, $user  ){
    
    	return CoursePress_Core::get_slug( 'student_dashboard', true );
    
    }, 10, 3 );

    Simply copy paste the above code in your child theme's functions.php (or a mu-plugin).

    Thanks!

  • mcdg03

    Thank you. That worked. Student logins now redirect correctly.
    I noticed a few other strange occurrences within Coursepress.
    1. preview buttons do not open to the previews
    2. Some section descriptions are filled in with repeated nonsense code:"<" before and after the genuine text. when I delete it, it doesn't stay deleted and repopulates.
    3. I cannot delete those sections either in order to rebuild them. I click the "delete section" text, confirm in the popup that I do want to delete the section but unit loads in unchanged i.e. the section is not deleted.

    I'm beginning to wonder if there isn't an issue with the databases? However, I can add new material and in general, the plugin is operating sufficiently well for me to stay using it until there is some clarity.

    Thank you so much for the assistance so far.

  • Panos

    Hi mcdg03 ,

    Glad it worked

    1. Could you please specify which preview links you are talking about ?

    2. It seems that the text was pasted, and when pasted it contained some broken markup with it as in some cases it has for eg:
    mp;lt;div class="post-header"&

    I have cleared the ones I saw and then I saved unit. I would recommend though to go through them once to double check in case I missed any

    In case you are copying text with html markup, I would suggest to switch the wordpress editor to Text mode first and then paste the text.

    3. I did not test deleting a section on your site, but I could not replicate this issue in any of my sites, units and sections were created and deleted as expected. Please let me know if you need us to have a closer look on this.

    Cheers!

  • mcdg03

    Thank you. Interestingly, I deleted the extra code from the text view (i.e. the code) rather than the visual editor but it just repopulated so maybe there was something else going on yesterday. I will pay better attention to copy and paste in future!

    The preview I refer to is an inbuilt "Free preview" setting in course press. Courses>Course setup>Step 2 - Course Details>Course structure - Free preview.

    Firstly when I go to this section, Coursepress pro (CPP) has defaulted to having all the course available for preview. i.e. all the boxes under "Free Preview" are ticked. However, even if ticked, it doesn't show in the front end. That is strange but ok. If I click either "next" or "update," it does then populate the frontend with "preview" links but none of them work.

    Likewise, if I choose a few preview items i.e. untick everything and re-tick the few items that would be ok to preview, and then click update, the preview function does not work.

    Instead, on the frontend, a link "Preview" appears under the name of the course unit on the course description page. Clicking on the link only reloads the course description page. It does not show any of the material for previewing.

    I am ok with not having previews for this course but for another course, it may be needed. Maybe there is something else I need to do? If there is, I cannot find anything in any of the CPP set up instructions that could assist with it. If someone can point me to fuller instructions, I'll be happy to follow them but it seems like a no-brainer. Tick the items I want available for preview in the backend, update, then click on the "preview" links in the frontend to view the materials when logged out, yes?

    I solved the deleting issue. My error. One must delete all modules in a unit before attempting to delete the unit.

    Question: should I just uninstall course press pro and then reinstall it? And rebuild the course? Could that possibly solve the issues? I'm happy to do so.

  • Panos

    Hey there mcdg03 ,

    If I understood correctly the remaining issue is the preview page. I did notice something weird there and have already reported to developer and will be taken care of!

    In case you need a workaround for now you can replace file
    wp-content/plugins/coursepress/2.0/admin/view/steps/step-2.php

    with the one attached here (you will have to unzip before replacing), and then re-save that step for each course. Not sure about this, but it seems you might need to re-save that step if you add any new section or unit.

    Hope this helps !