Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • @thomasplevy
    For Open Registration it is working fine
    I would add it to free checkout (https://lifterlms.com/docs/checkout-free-access-plans/)
    I made the code what allow me to do that:
    After below code in class.llms.person.handler.php

    $voucher = get_option( 'lifterlms_voucher_field_' . $screen . '_visibility', '' );
            if ( 'registration' === $screen && 'hidden' !== $voucher ) {
    
                $toggleable = apply_filters( 'llms_voucher_toggleable', ( 'required' === $voucher ) ? false : true );
                $voucher_label = __( 'Have a voucher?', 'lifterlms' );
                if ( $toggleable ) {
                    $voucher_label = '<a class="llms-voucher-toggle" id="llms-voucher-toggle" href="#">' . $voucher_label . '</a>';
                    add_action( 'wp_print_footer_scripts', array( __CLASS__, 'voucher_toggle_script' ) );
                }
    
                $fields[] = array(
                    'columns' => 12,
                    'id' => self::$meta_prefix . 'voucher',
                    'label' => $voucher_label,
                    'last_column' => true,
                    'placeholder' => __( 'Voucher Code', 'lifterlms' ),
                    'required' => ( 'required' === $voucher ) ? true : false,
                    'style' => $toggleable ? 'display: none;' : '',
                    'type'  => 'text',
                );
            }

    I added:

    if ( 'checkout' === $screen && !$uid) {
    
    			$toggleable = apply_filters( 'llms_voucher_toggleable', ( 'required' === 'required' ) ? false : true );
    			$voucher_label = __( '<p>Custom text</p>', 'lifterlms' );
    			if ( $toggleable ) {
    				$voucher_label = '<a class="llms-voucher-toggle" id="llms-voucher-toggle" href="#">' . $voucher_label . '</a>';
    				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'voucher_toggle_script' ) );
    			}
    
    			$fields[] = array(
    				'columns' => 12,
    				'id' => self::$meta_prefix . 'voucher',
    				'label' => $voucher_label,
    				'last_column' => true,
    				'placeholder' => __( 'Voucher Code', 'lifterlms' ),
    				'required' => true,
    				'style' => $toggleable ? 'display: none;' : '',
    				'type'  => 'text',
    			);
    
    		}

    I just wonder how to inject it by LifterLMS Customizations

    @thomasplevy
    Thanks for replay
    For open registration I made this somehow work by requesting voucher code what can be retrieved by signup through subscription to site.
    I having a problem with free course registration – how I can add restriction like for open registration where user need to poses voucher code to pass this registration?

    @thomasplevy
    I’ve updated to PHP7 – lifter starting without my code changes THANKS 🙂

    One question is (I expect answer no – but I need to make myself sure) – is those functions were important from DB update procedure, should I do anything since I have now Lifter code without changes?

    Not full code added – sorry for that

    	public function has_description() {
    		//return ( 'yes' === $this->get( 'description_enabled' ) && ! empty( $this->get( 'content' ) ) );
    		return true;
    	}
    
    	/**
    	 * Determine if a featured image is enabled and not empty
    	 * @return   bool
    	 * @since    3.16.0
    	 * @version  3.16.0
    	 */
    	public function has_image() {
    // 		$img = $this->get( 'image' );
    // 		if ( is_array( $img ) ) {
    // 			if ( ! empty( $img['enabled'] ) && ( ! empty( $img['id'] ) || ! empty( $img['src'] ) ) ) {
    // 				return ( 'yes' === $img['enabled'] );
    // 			}
    // 		}
     		return false;
    	}
    
    	/**
    	 * Determine if a featured video is enabled & not empty
    	 * @return   bool
    	 * @since    3.16.0
    	 * @version  3.16.0
    	 */
    	public function has_video() {
     //		return ( 'yes' === $this->get( 'video_enabled' ) && ! empty( $this->get( 'video_src' ) ) );
           return false;
    	}
    przembar

    (@przembar)

    @justinwi I think that @thomasplevy need to add this to https://trello.com/b/egC72ZZS/lifterlms-feature-requests-public-voting so we can vote 🙂

    @thomasplevy can you add gist for having history for course description too? Or just variable name if the code is same as for lessons

    BTW @thomasplevy revisions for lessons works for me very well and helped a lot in course development and collaboration

    WOW Thanks – that was really fast answer and super easy thing to do – following your explanation and code.
    For reference: I need to point out that I need to click update in lesson edit view to enable revision history and then last change is available with all revision options.
    One more question:
    Does lessons are revisioned even if I cannot see that by default?

    • This reply was modified 2 years, 1 month ago by przembar.
Viewing 7 replies - 1 through 7 (of 7 total)