• Resolved antinopol

    (@antinopol)


    There are suggestions to improve the code after line 115 in the file ../plugins/masterstudy-lms-learning-management-system/stm-lms-templates/lesson/curriculum.php

    The problem with the current code is that when using the Russian language, the correct endings of words are not formed with a different number of questions. Moreover, the code, which I propose to replace, is already used in the theme on the course page in the “Curriculum” section and forms words well with different endings depending on the number of questions.

    <div class="stm-curriculum-item__meta">
    	<?php if( !empty( $quiz_info[ 'progress' ] ) ): ?>
    <?php echo intval( $quiz_info[ 'progress' ] ) ?>%
    <?php else:
    $questions = get_post_meta($curriculum_item, 'questions', true);
    if(!empty($questions)){
    	//New correct code
    	$meta = sprintf(_n(
    		'%s question',
    		'%s questions',
    		count(explode(',', $questions)),
    		'masterstudy-lms-learning-management-system'
    	), count(explode(',', $questions)));
    	if(!empty($meta)){
    		echo wp_kses_post($meta);
    	}
    	//Сurrent code
    	//$questions_array = explode(',', $questions);
    	//if(!empty($questions_array)){
    	//    echo sprintf(esc_html__('%s questions', 'masterstudy-lms-learning-management-system'), count($questions_array));
    	//}
    }
    ?>
    <?php endif; ?>
    
    <?php if( $lesson_style === 'classic' && $lesson_type !== 'stream' && $lesson_type !== 'zoom_conference' && !empty( $meta ) ): ?>
    <?php echo esc_html( $meta ); ?>
    <?php endif; ?>
    </div>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @antinopol

    Thank you for reaching out to us!

    Please note that we are not experts in grammar rather in writing code. Also, plugins can be translated into different languages with their own grammar rules and we can not change core code only for one language.

    If this code is working for you, you are free to use it. However, please add this customization by using the Child theme in order not to lose your changes during the plugin update.

    Feel free to contact us in case of any other questions.

    regards

    Thread Starter antinopol

    (@antinopol)

    I agree with you, but in this case, to display the same information, you use different code in different places.

    Therefore, I advise you to use whichever version of the code works best for other languages and makes your plugin better for users.

    Plugin Support mgordonStylemixThemes

    (@mgordon7)

    Thank you for your feedback! We really appreciate your diligence!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Improving plugin code’ is closed to new replies.