0 && function_exists('aksrt_get_user_vip_level')) { $level = (int) aksrt_get_user_vip_level($user_id); } // Already top tier — no upsell entry on float rail. if ($level >= 2) { return ''; } // Prefer admin title; fallback by upgrade vs open. $admin_title = trim((string) ($item['text'] ?? '')); if ($admin_title !== '') { $title = $admin_title; } else { $title = $level === 1 ? __('升级会员', 'aksrt') : __('开通会员', 'aksrt'); } $icon = trim((string) ($item['icon'] ?? '')); $icon_html = aksrt_icon_markup($icon); if ($icon_html === '') { $icon_html = aksrt_icon_markup('fa fas fa-gem'); } // Logged-in: open modal. Guest: open login. $cls = $user_id > 0 ? 'float-btn pay-vip nowave' : 'float-btn signin-loader nowave'; $style = []; if (!empty($item['color'])) { $style[] = '--this-color:' . esc_attr((string) $item['color']); } if (!empty($item['bg'])) { $style[] = '--this-bg:' . esc_attr((string) $item['bg']); } // Default VIP accent when admin left color empty. if (empty($item['color'])) { $style[] = '--this-color:#f5a623'; } $style_attr = $style ? ' style="' . implode(';', $style) . '"' : ''; // Prefer upgrading one tier when already VIP1. $target_level = $user_id > 0 ? max(1, min(2, $level + 1)) : 1; $vip_level_attr = $user_id > 0 ? ' vip-level="' . esc_attr((string) $target_level) . '" data-vip-level="' . esc_attr((string) $target_level) . '"' : ''; return '' . $icon_html . ''; } endif;