Skip to content

Commit

Permalink
Merge pull request #22 from themeum/ibrahim
Browse files Browse the repository at this point in the history
wpml conflict,translation,add to cart , lesson edit issue fixed
  • Loading branch information
ibrahim-kardi authored Jun 22, 2023
2 parents 5fd17b1 + 1726ad4 commit 2bc70c1
Show file tree
Hide file tree
Showing 17 changed files with 266 additions and 235 deletions.
2 changes: 1 addition & 1 deletion classes/AssetsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public static function set_default_template() {
$elementorData = file_get_contents( ETLMS_DIR_PATH . '/assets/layout/default.json' );
$elementorData = json_decode( $elementorData, true );
update_post_meta( $postID, '_elementor_controls_usage', $elementorData['controls'] );
update_post_meta( $postID, '_elementor_data', $elementorData['layout'] );
update_post_meta( $postID, '_elementor_data', json_encode( $elementorData['layout'] ) );
update_post_meta( $postID, $meta_key, 'yes' );
}
}
Expand Down
19 changes: 17 additions & 2 deletions classes/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace TutorLMS\Elementor;

use Elementor\Elements_Manager;
use TUTOR\User;

defined( 'ABSPATH' ) || die();

Expand All @@ -37,15 +38,29 @@ public function i18n() {
load_plugin_textdomain( 'tutor-lms-elementor-addons' );
}


public function init() {

$this->load_files();

// Plugin row meta
// Plugin row meta.
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
// Register custom category
// Register custom category.
add_action( 'elementor/elements/categories_registered', array( $this, 'add_category' ) );

add_filter(
'tutor_has_lesson_content',
function( $bool ) {
// Check if user is privileged.
$roles = array( User::ADMIN, User::INSTRUCTOR );
if ( ! User::has_any_role( $roles ) ) {
return $bool;
} else {
return true;
}
}
);

AddonsManager::init();
AssetsManager::init();
Template::instance();
Expand Down
22 changes: 12 additions & 10 deletions includes/addons/CourseCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function register_content_controls() {
),
),
'default' => 'row',
'prefix_class' => self::$prefix_class_layout . '%s',
'prefix_class' => self::$prefix_class_layout . '%s',
'toggle' => false,
'selectors' => array(
'{{WRAPPER}} .etlms-course-categories' => 'flex-direction: {{VALUE}};',
Expand Down Expand Up @@ -128,7 +128,7 @@ protected function register_content_controls() {
),
),
'selectors' => array(
'{{WRAPPER}} .etlms-course-categories' => 'gap: {{SIZE}}{{UNIT}};'
'{{WRAPPER}} .etlms-course-categories' => 'gap: {{SIZE}}{{UNIT}};',
),
)
);
Expand Down Expand Up @@ -258,23 +258,25 @@ protected function render() {
$course_categories = get_tutor_course_categories();
}

if ( is_array( $course_categories ) && count( $course_categories ) ) : $item = 1; ?>
if ( is_array( $course_categories ) && count( $course_categories ) ) :
$item = 1; ?>
<div class="etlms-course-categories tutor-meta">
<span class="tutor-meta-key"><?php esc_html_e('Categories', 'tutor'); ?></span>
<span class="tutor-meta-key"><?php esc_html_e( 'Categories', 'tutor-lms-elementor-addons' ); ?></span>
<span>
<?php
$category_links = array();
foreach ( $course_categories as $course_category ) :
$category_name = $course_category->name;
$category_link = get_term_link($course_category->term_id);
$category_links[] = wp_sprintf( '<a href="%1$s">%2$s</a>', esc_url( $category_link ), esc_html( $category_name ) );
foreach ( $course_categories as $course_category ) :
$category_name = $course_category->name;
$category_link = get_term_link( $course_category->term_id );
$category_links[] = wp_sprintf( '<a href="%1$s">%2$s</a>', esc_url( $category_link ), esc_html( $category_name ) );
endforeach;
echo implode(', ', $category_links);
echo implode( ', ', $category_links );
?>
</span>
</div>
<?php else : ?>
<?php if ( $this->is_elementor_editor() ) :
<?php
if ( $this->is_elementor_editor() ) :
esc_html_e( 'Please add category from Tutor course builder', 'tutor-lms-elementor-addons' );
endif;
endif;
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"homepage": "https://github.com/themeum/tutor-lms-elementor-addons#readme",
"devDependencies": {
"gulp": "^3.9.1",
"gulp": "^4.0.2",
"gulp-clean": "^0.4.0",
"gulp-clean-css": "^4.3.0",
"gulp-cssnano": "^2.1.3",
Expand All @@ -36,5 +36,8 @@
"gulp-wp-pot": "^2.4.3",
"gulp-zip": "^4.2.0",
"sass": "^1.44.0"
},
"dependencies": {
"gulp-update-version": "^1.0.2"
}
}
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Contributors: themeum
Donate link: https://www.themeum.com
Tags: lms, elearning, learning management system, course, education, elementor addons for lms, elearning elementor addons, tutor lms, online courses
Requires at least: 5.3
Tested up to: 6.1
Tested up to: 6.2.2
Requires PHP: 7.4
Stable tag: 2.0.7
Stable tag: 2.0.8
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -141,6 +141,12 @@ You can post on the support section of this plugin or use the contact form at th
10. Intelligent Preview Modes

== Changelog ==
= 2.0.8 - 6 June, 2023

*Fix: Fixed Lesson edit issue, ensuring smooth editing functionality.
*Fix: Resolved Add to Cart issue.
*Fix: Addressed WPML conflicting issue.
*Fix: Resolved language Translation issue.

= 2.0.7 - 25 January, 2023

Expand Down
14 changes: 7 additions & 7 deletions templates/course/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ function truncate( $text, $length = 100, $ending = '...', $exact = true, $consid
}
}

$excerpt = tutor_get_the_excerpt();
$is_enabled = get_tutor_option( 'enable_course_about' );
$string = $excerpt;
$limit = 100;
$has_show_more = false;
$excerpt = tutor_get_the_excerpt();
$is_enabled = get_tutor_option( 'enable_course_about' );
$string = $excerpt;
$limit = 100;
$has_show_more = false;

if ( strlen( $string ) > $limit ) {
$has_show_more = true;
Expand All @@ -111,7 +111,7 @@ function truncate( $text, $length = 100, $ending = '...', $exact = true, $consid

<?php if ( ! empty( $excerpt ) && $is_enabled ) : ?>
<div class='etlms-course-about tutor-mb-48'>
<div class='<?php echo $has_show_more ? "tutor-toggle-more-content tutor-toggle-more-collapsed" : "" ?>' <?php echo $has_show_more ? "data-tutor-toggle-more-content data-toggle-height='200' style='height: 200px;'" : "" ?>>
<div class='<?php echo $has_show_more ? 'tutor-toggle-more-content tutor-toggle-more-collapsed' : ''; ?>' <?php echo $has_show_more ? "data-tutor-toggle-more-content data-toggle-height='200' style='height: 200px;'" : ''; ?>>
<?php
if ( \Elementor\Plugin::instance()->editor->is_edit_mode() && empty( $excerpt ) ) {
echo '<span style="margin: 5px">' . esc_html__( 'Please add data from the course editor', 'tutor-lms-elementor-addons' ) . '</span>';
Expand All @@ -130,7 +130,7 @@ function truncate( $text, $length = 100, $ending = '...', $exact = true, $consid
<?php if ( $has_show_more ) : ?>
<a href="#" class="tutor-btn-show-more tutor-btn tutor-btn-ghost tutor-mt-32" data-tutor-toggle-more=".tutor-toggle-more-content">
<span class="tutor-toggle-btn-icon tutor-icon tutor-icon-plus tutor-mr-8" area-hidden="true"></span>
<span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor' ); ?></span>
<span class="tutor-toggle-btn-text"><?php esc_html_e( 'Show More', 'tutor-lms-elementor-addons' ); ?></span>
</a>
<?php endif; ?>
</div>
Expand Down
12 changes: 6 additions & 6 deletions templates/course/add-to-cart-edd.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*/

$product_id = tutor_utils()->get_course_product_id();
$download = new EDD_Download( $product_id );
$download = new EDD_Download( $product_id );

if ($download->ID) {
if ( $download->ID ) {
echo edd_get_purchase_link( array( 'download_id' => $download->ID ) );
} else {
?>
<p class="tutor-alert-warning">
<?php _e('Please make sure that your EDD product exists and valid for this course', 'tutor'); ?>
</p>
<p class="tutor-alert-warning">
<?php _e( 'Please make sure that your EDD product exists and valid for this course', 'tutor-lms-elementor-addons' ); ?>
</p>
<?php
}
}
12 changes: 6 additions & 6 deletions templates/course/add-to-cart-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
<?php
} else {
?>
<form action="<?php echo esc_url( apply_filters( 'tutor_course_add_to_cart_form_action', get_permalink( get_the_ID() ) ) ); ?>" method="post" enctype="multipart/form-data">
<button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-btn-block tutor-mt-24 tutor-add-to-cart-button">
<span class="btn-icon tutor-icon-cart-filled"></span>
<span><?php echo esc_html( $product->single_add_to_cart_text() ); ?></span>
</button>
</form>
<form action="<?php echo esc_url( apply_filters( 'tutor_course_add_to_cart_form_action', get_permalink( get_the_ID() ) ) ); ?>?add-to-cart=<?php echo esc_attr( $product->get_id() ); ?>" method="post" enctype="multipart/form-data">
<button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-btn-block tutor-mt-24 tutor-add-to-cart-button">
<span class="btn-icon tutor-icon-cart-filled"></span>
<span><?php echo esc_html( $product->single_add_to_cart_text() ); ?></span>
</button>
</form>
<?php
}
} else {
Expand Down
62 changes: 31 additions & 31 deletions templates/course/carousel/parts/info.php
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<?php
global $post, $authordata;
$profile_url = tutor_utils()->profile_url( $authordata->ID, true );
$course_categories = get_tutor_course_categories();
$show_avatar = $settings['course_carousel_avatar_settings'];
$show_author = $settings['course_carousel_author_settings'];
$show_categories = $settings['course_carousel_category_settings'];
$profile_url = tutor_utils()->profile_url( $authordata->ID, true );
$course_categories = get_tutor_course_categories();
$show_avatar = $settings['course_carousel_avatar_settings'];
$show_author = $settings['course_carousel_author_settings'];
$show_categories = $settings['course_carousel_category_settings'];
?>

<?php if ( $show_avatar || $show_author || $show_categories ) : ?>
<div class="tutor-meta tutor-mt-auto">
<?php if ( $show_avatar ) : ?>
<div>
<a href="<?php echo $profile_url; ?>" class="tutor-d-flex">
<?php echo tutor_utils()->get_tutor_avatar( $post->post_author ); ?>
</a>
</div>
<?php endif; ?>
<?php if ( $show_avatar ) : ?>
<div>
<a href="<?php echo $profile_url; ?>" class="tutor-d-flex">
<?php echo tutor_utils()->get_tutor_avatar( $post->post_author ); ?>
</a>
</div>
<?php endif; ?>

<div>
<?php if ( $show_author ) : ?>
<span class="etlms-course-author-meta tutor-meta-key"><?php esc_html_e('By', 'tutor') ?></span>
<a class="etlms-course-author-meta tutor-meta-value" href="<?php echo $profile_url; ?>"><?php esc_html_e(get_the_author()); ?></a>
<?php endif; ?>
<div>
<?php if ( $show_author ) : ?>
<span class="etlms-course-author-meta tutor-meta-key"><?php esc_html_e( 'By', 'tutor-lms-elementor-addons' ); ?></span>
<a class="etlms-course-author-meta tutor-meta-value" href="<?php echo $profile_url; ?>"><?php esc_html_e( get_the_author() ); ?></a>
<?php endif; ?>

<?php if( $show_categories && ( !empty( $course_categories ) && is_array( $course_categories ) && count( $course_categories ) ) ) : ?>
<span class="etlms-course-category-meta tutor-meta-key"><?php esc_html_e('In', 'tutor'); ?></span>
<?php
$category_links = array();
foreach ( $course_categories as $course_category ) :
$category_name = $course_category->name;
$category_link = get_term_link($course_category->term_id);
$category_links[] = wp_sprintf( '<a class="etlms-course-category-meta tutor-meta-value" href="%1$s">%2$s</a>', esc_url( $category_link ), esc_html( $category_name ) );
endforeach;
echo implode(', ', $category_links);
?>
<?php endif; ?>
</div>
<?php if ( $show_categories && ( ! empty( $course_categories ) && is_array( $course_categories ) && count( $course_categories ) ) ) : ?>
<span class="etlms-course-category-meta tutor-meta-key"><?php esc_html_e( 'In', 'tutor-lms-elementor-addons' ); ?></span>
<?php
$category_links = array();
foreach ( $course_categories as $course_category ) :
$category_name = $course_category->name;
$category_link = get_term_link( $course_category->term_id );
$category_links[] = wp_sprintf( '<a class="etlms-course-category-meta tutor-meta-value" href="%1$s">%2$s</a>', esc_url( $category_link ), esc_html( $category_name ) );
endforeach;
echo implode( ', ', $category_links );
?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
Loading

0 comments on commit 2bc70c1

Please sign in to comment.