Redirect to lesson #1 after user click 'take this course'

Themes Forums Academy WordPress Theme Redirect to lesson #1 after user click 'take this course'

  • Author
    Posts
  • #36996
    themex
    themex
    Member

    You must be signed in and verified as a buyer of this theme to view replies by the support staff. Register Now →

    #37003

    dionhorton
    Member

    Im having a hard time adding it after line 919. It just gives me a error message once I test it. Any ideas?

    #37005

    dionhorton
    Member

    Im using version 2.15 and just want to redirect to lesson #1 page after they click ‘take this course’ button on course page.

    #37008
    themex
    themex
    Member

    You must be signed in and verified as a buyer of this theme to view replies by the support staff. Register Now →

    #37009

    dionhorton
    Member

    I did the same thing and keep getting this error message once I test it on my website.
    Warning: Missing argument 2 for ThemexCourse::getLessons(), called in /home2/dionhorton/public_html/wp-content/themes/academy/framework/classes/themex.course.php on line 922 and defined in /home2/dionhorton/public_html/wp-content/themes/academy/framework/classes/themex.course.php on line 1064

    Warning: Cannot modify header information – headers already sent by (output started at /home2/dionhorton/public_html/wp-content/themes/academy/framework/classes/themex.course.php:1064) in /home2/dionhorton/public_html/wp-includes/pluggable.php on line 1174

    #37013
    themex
    themex
    Member

    You must be signed in and verified as a buyer of this theme to view replies by the support staff. Register Now →

    #37021

    dionhorton
    Member

    Perfect,that worked. Thank you

    #39713

    nwpastry
    Member

    Hi,
    Changing this codes work perfectly, but if the course has no lessons, redirects me to somewhere else. Is there any way to redirect to the course page or a specific page if the course has no lessons?

    I’ve used the following code in academy/sidebar-profile.php file:

    line 22:
    <?php ThemexCourse::refresh($ID, true); ?>

    line 28:

    <h4 class=”nomargin”><a>ID); ?>”><?php echo get_the_title($ID); ?></a></h4>

    #39714

    nwpastry
    Member

    Also, I would need to redirect to the first lesson after a course is paid. Is there any way to do that? Of course, the same here, if the course has no lessons, redirect them to a specific page or to the course page.

    Thanks

    #39720
    themex
    themex
    Member

    You must be signed in and verified as a buyer of this theme to view replies by the support staff. Register Now →

    #39722

    nwpastry
    Member

    Hi,
    Great! Thank you, where I have to put that code that you sent me?

    Thanks

    #39734
    themex
    themex
    Member

    You must be signed in and verified as a buyer of this theme to view replies by the support staff. Register Now →

    #39741

    nwpastry
    Member

    Hi,
    I tried to put it after line 920 in academy/framework/classes/themex.course.php file, but it is not working. I think that I had different order of the functions there. Between which lines of code I have to put it?

    I have this functions right now, but it is not working.

    	public static function redirectCourse() {
    
    		$ID=ThemexCore::getRewriteRule('redirect');
    
    		
    
    		if(!empty($ID)) {
    
    			$post=get_post($ID);
    
    			
    
    			if(!empty($post)) {
    
    				if($post->post_type=='plan') {
    
    					self::subscribeUser($post->ID, get_current_user_id());					
    
    				} else if($post->post_type=='course') {
    
    					self::addUser($post->ID, get_current_user_id());
    
    				}
    
    	if(self::$data['status']=='free') {
    	self::$data['lessons']=self::getLessons($ID, 0);
    	if(!empty(self::$data['lessons'])) {
    		$redirect=get_permalink(self::$data['lessons'][0]->ID);
    	} else {
    		$redirect=get_permalink(self::$data['ID']);
    	}
    }
    
    			}
    
    			wp_redirect(SITE_URL);
    
    			exit();
    
    		}
    
    	}
    
    #39757
    themex
    themex
    Member

    You must be signed in and verified as a buyer of this theme to view replies by the support staff. Register Now →

    #39768

    nwpastry
    Member

    Great, but that code is for the woocommerce function. Right now I’m talking about this code to send the user to the course page if there is no lessons. Where I have to put it? Because if I put it after the line that you told me, it is not working.

    if(self::$data['status']=='free') {
    	self::$data['lessons']=self::getLessons($ID, 0);
    	if(!empty(self::$data['lessons'])) {
    		$redirect=get_permalink(self::$data['lessons'][0]->ID);
    	} else {
    		$redirect=get_permalink(self::$data['ID']);
    	}
    }
    #39779
    themex
    themex
    Member

    You must be signed in and verified as a buyer of this theme to view replies by the support staff. Register Now →

    #39789

    nwpastry
    Member

    I have 2.10 version. I tried with differents free courses and premium courses that have no lessons and it is not working. I have all my courses without lessons in a category and they all should be premium (I’ve changed some of them to “free” to try the code). I put that code in the correct place, but it is not working. I also tried changing “free” to “premium” on the code that you told me, but it’s also without working.

    All my courses that have no lessons are redirect to the last post on my blog when I click on their titles in my profile right sidebar. What should I do?

    #39814
    themex
    themex
    Member

    You must be signed in and verified as a buyer of this theme to view replies by the support staff. Register Now →

    #39816

    nwpastry
    Member

    Hi,
    I think that maybe I explain it wrong. I need this:
    1) A user go to My Profile page
    2) The user clicks on the course title in the right sidebar
    3) If the course has classes, when the user clicks on the title goes to the first class (this works with the code that appears on the firsts posts in this issue)
    4) If the course is without classes, when the user clicks on the title, there in the right sidebar of their profile page, goes to the course page (THIS IS WHAT IS NOT WORKING AND I NEED A CODE FOR THIS)

    Thank you

    #39817
    themex
    themex
    Member

    You must be signed in and verified as a buyer of this theme to view replies by the support staff. Register Now →

Viewing 20 posts - 21 through 40 (of 42 total)

You must be logged in to reply to this topic.