diff --git a/assets/css/frontend/widget-batch5.css b/assets/css/frontend/widget-batch5.css
index f5a9e291..6058af4e 100644
--- a/assets/css/frontend/widget-batch5.css
+++ b/assets/css/frontend/widget-batch5.css
@@ -122,7 +122,7 @@
height: 100%;
object-fit: cover;
}
-.aksrt-user-card__vip {
+.aksrt-user-card__avatar-wrap > .aksrt-vip-badge {
position: absolute;
right: -5px;
bottom: -3px;
@@ -130,20 +130,14 @@
display: inline-flex;
align-items: center;
justify-content: center;
- min-width: 28px;
+ width: 28px;
height: 28px;
- padding: 3px;
- border: 2px solid var(--surface-1, #fff);
- border-radius: 50%;
- background: var(--surface-1, #fff);
- box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
+ max-width: none;
+ padding: 0;
line-height: 1;
}
-.aksrt-user-card__vip .aksrt-vip-badge {
- width: 100%;
- height: 100%;
-}
-.aksrt-user-card__vip .aksrt-vip-badge__icon {
+.aksrt-user-card__avatar-wrap > .aksrt-vip-badge .aksrt-vip-badge__icon {
+ display: block;
width: 100%;
height: 100%;
max-width: 100%;
diff --git a/assets/img/avatar-default.png b/assets/img/avatar-default.png
deleted file mode 100644
index 6240118a..00000000
Binary files a/assets/img/avatar-default.png and /dev/null differ
diff --git a/assets/img/widgets-original.png b/assets/img/widgets-original.png
deleted file mode 100644
index 675e95e4..00000000
Binary files a/assets/img/widgets-original.png and /dev/null differ
diff --git a/src/Widgets/WidgetUserCard.php b/src/Widgets/WidgetUserCard.php
index f9d22957..323f5382 100644
--- a/src/Widgets/WidgetUserCard.php
+++ b/src/Widgets/WidgetUserCard.php
@@ -10,6 +10,8 @@ namespace AKSRT\Widgets;
defined('ABSPATH') || exit;
class WidgetUserCard extends \WP_Widget {
+ private const DEFAULT_COVER_FILE = 'assets/img/person_background.png';
+
public function __construct() {
parent::__construct(
'aksrt_user_card',
@@ -61,7 +63,7 @@ class WidgetUserCard extends \WP_Widget {
}
if ($user_id <= 0) {
- $this->render_guest($show_cover, $loged_title);
+ $this->render_guest($show_cover, $loged_title, $this->get_guest_cover_url($instance));
if ($affix['class'] !== '') {
echo '';
}
@@ -104,9 +106,9 @@ class WidgetUserCard extends \WP_Widget {
if (!is_string($bio) || $bio === '') {
$bio = (string) $user->description;
}
- $cover = (string) get_user_meta($user_id, 'aksrt_cover', true);
+ $cover = (string) get_user_meta($user_id, 'aksrt_background_image', true);
if ($cover === '') {
- $cover = (string) get_user_meta($user_id, 'custom_avatar_cover', true);
+ $cover = $this->get_default_cover_url();
}
$post_count = count_user_posts($user_id, 'post', true);
@@ -138,23 +140,7 @@ class WidgetUserCard extends \WP_Widget {
echo '
';
if ($show_cover) {
- if ($cover !== '') {
- echo '
' . $checkin_html . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- } else {
- // Prefer site default cover image when available.
- $default_cover = '';
- if (class_exists('\AKSRT\Settings\Settings') && method_exists('\AKSRT\Settings\Settings', 'get_user_cover_default')) {
- $default_cover = (string) \AKSRT\Settings\Settings::get_user_cover_default();
- }
- if ($default_cover === '' && function_exists('get_theme_mod')) {
- $default_cover = (string) get_theme_mod('aksrt_user_cover', '');
- }
- if ($default_cover !== '') {
- echo '
' . $checkin_html . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- } else {
- echo '
' . $checkin_html . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- }
- }
+ echo '
' . $checkin_html . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} elseif ($checkin_btn !== '') {
echo '
' . $checkin_btn . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
@@ -165,7 +151,7 @@ class WidgetUserCard extends \WP_Widget {
echo '
 . ')
';
echo '
';
if ($vip_badge !== '') {
- echo '' . $vip_badge . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ echo $vip_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
echo '';
echo '' . $name_html . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -207,7 +193,7 @@ class WidgetUserCard extends \WP_Widget {
echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
- private function render_guest(bool $show_cover, string $loged_title): void {
+ private function render_guest(bool $show_cover, string $loged_title, string $cover): void {
$login = function_exists('aksrt_get_login_url') ? aksrt_get_login_url() : wp_login_url();
$register = function_exists('aksrt_get_register_url') ? aksrt_get_register_url() : wp_registration_url();
$default_avatar = function_exists('get_avatar_url')
@@ -226,15 +212,7 @@ class WidgetUserCard extends \WP_Widget {
echo '';
if ($show_cover) {
- $default_cover = '';
- if (class_exists('\AKSRT\Settings\Settings') && method_exists('\AKSRT\Settings\Settings', 'get_user_cover_default')) {
- $default_cover = (string) \AKSRT\Settings\Settings::get_user_cover_default();
- }
- if ($default_cover !== '') {
- echo '
';
- } else {
- echo '
';
- }
+ echo '
';
}
echo '
';
echo '
';
@@ -272,6 +250,11 @@ class WidgetUserCard extends \WP_Widget {
+
+
+