diff --git a/includes/modules/CourseAuthor/CourseAuthor.jsx b/includes/modules/CourseAuthor/CourseAuthor.jsx
index 4359f4b..80bcb2b 100644
--- a/includes/modules/CourseAuthor/CourseAuthor.jsx
+++ b/includes/modules/CourseAuthor/CourseAuthor.jsx
@@ -67,6 +67,14 @@ class CourseAuthor extends Component {
},
]);
+ // remove default padding below avatar and name
+ additionalCss.push([
+ {
+ selector: `${wrapper} a`,
+ declaration: `padding: 0`,
+ },
+ ])
+
if (avatar_size) {
additionalCss.push([
{
@@ -189,6 +197,15 @@ class CourseAuthor extends Component {
]);
}
+ if( props.avatar_border_radius ) {
+ additionalCss.push([
+ {
+ selector: img_selector,
+ declaration: `border-radius: ${props.avatar_border_radius}`
+ },
+ ]);
+ }
+
return additionalCss;
}
@@ -196,7 +213,7 @@ class CourseAuthor extends Component {
//conditionally render
if (props.profile_picture === "on") {
return (
-
+
- -
+
-
{this.authorAvatar(this.props)}
{this.authorName(this.props)}
diff --git a/includes/modules/CourseAuthor/CourseAuthor.php b/includes/modules/CourseAuthor/CourseAuthor.php
index 3b4f7da..48e0207 100644
--- a/includes/modules/CourseAuthor/CourseAuthor.php
+++ b/includes/modules/CourseAuthor/CourseAuthor.php
@@ -57,6 +57,7 @@ public function init() {
);
$author_selector = '%%order_class%% .tutor-single-course-author-meta .tutor-single-course-author-name';
+ $author_avatar = '%%order_class%% .tutor-single-course-author-meta .tutor-single-course-avatar .tutor-avatar';
$this->advanced_fields = array(
'fonts' => array(
'author_label_text' => array(
@@ -79,6 +80,16 @@ public function init() {
'tab_slug' => 'advanced',
'toggle_slug' => 'author_name_text',
),
+
+ 'author_image' => array(
+ 'label' => esc_html__( 'Avatar', 'tutor-lms-divi-modules' ),
+ 'css' => array(
+ 'main' => $author_avatar . ' span',
+ ),
+ 'hide_text_align' => true,
+ 'tab_slug' => 'advanced',
+ 'toggle_slug' => 'author_image',
+ )
),
'box_shadow' => array(
@@ -92,7 +103,15 @@ public function init() {
// 'margin_padding' => false,
'text' => false,
'borders' => false,
- 'background' => false,
+ 'background' => array(
+ 'css' => array(
+ 'main' => $author_avatar . ' span',
+ ),
+ 'settings' => array(
+ 'tab_slug' => 'advanced',
+ 'toggle_slug' => 'author_image'
+ )
+ ),
'filters' => false,
'animation' => false,
'transform' => false,
@@ -222,6 +241,23 @@ public function get_fields() {
),
'mobile_options' => true,
),
+ 'avatar_border_radius' => array(
+ 'label' => esc_html__( 'Border Radius', 'tutor-lms-divi-modules' ),
+ 'type' => 'range',
+ 'option_category' => 'layout',
+ 'default_unit' => 'px',
+ 'default' => '100px',
+ 'range_settings' => array(
+ 'min' => '1',
+ 'max' => '100',
+ 'step' => '1',
+ ),
+ 'tab_slug' => 'advanced',
+ 'toggle_slug' => 'author_image',
+ 'show_if' => array(
+ 'profile_picture' => 'on',
+ ),
+ ),
// author avatar settings in advanced tab end
);
@@ -307,6 +343,18 @@ public function render( $attrs, $content, $render_slug ) {
),
)
);
+
+ // remove default padding below avatar and name.
+ ET_Builder_Element::set_style(
+ $render_slug,
+ array(
+ 'selector' => $wrapper . ' a',
+ 'declaration' => sprintf(
+ 'padding: 0;'
+ ),
+ )
+ );
+
if ( '' !== $avatar_size ) {
ET_Builder_Element::set_style(
$render_slug,
@@ -519,6 +567,20 @@ public function render( $attrs, $content, $render_slug ) {
);
}
+ // set avatar border radius
+ if ( '' !== $this->props['avatar_border_radius'] ) {
+ ET_Builder_Element::set_style(
+ $render_slug,
+ array(
+ 'selector' => $img_selector,
+ 'declaration' => sprintf(
+ 'border-radius : %1s',
+ esc_html( $this->props['avatar_border_radius'] )
+ )
+ )
+ );
+ }
+
$output = self::get_content( $this->props );
// Render empty string if no output is generated to avoid unwanted vertical space.
diff --git a/includes/templates/course/author.php b/includes/templates/course/author.php
index 0a5be05..bbfe019 100644
--- a/includes/templates/course/author.php
+++ b/includes/templates/course/author.php
@@ -15,15 +15,22 @@