PluginProbe
wpForo Forum / 3.1.4
wpForo Forum v3.1.4
3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 All 137 releases
wpforo / blocks / profile / render.php

render.php in wpForo Forum 3.1.4, at blocks/profile/render.php

119 lines 7.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if( ! defined( 'ABSPATH' ) ) exit;
3
4 /**
5 * @var array $attributes The block attributes.
6 * @var string $content The block default content.
7 * @var WP_Block $block The block instance.
8 */
9
10 $instance = wp_parse_args( $attributes, [
11 'title' => __( 'My Profile', 'wpforo' ),
12 'title_guest' => __( 'Join Us!', 'wpforo' ),
13 'hide_avatar' => false,
14 'hide_name' => false,
15 'hide_notification' => false,
16 'hide_data' => false,
17 'hide_buttons' => false,
18 'hide_for_guests' => false,
19 ] );
20
21 $display_widget = ! ( ! is_user_logged_in() ) || ! wpfval( $instance, 'hide_for_guests' );
22 if( $display_widget ) {
23 $class = 'wpf-' . wpforo_setting( 'styles', 'color_style' );
24 ?>
25 <div id="wpf-widget-profile" class="wpforo-block-profile wpforo-widget-wrap <?php echo esc_attr( $class ); ?>">
26 <?php if( wpfval( $instance, 'title' ) && is_user_logged_in() ) : ?>
27 <h3 class="widget-title"><?php echo apply_filters( 'widget_title', $instance['title'] ); ?></h3>
28 <?php elseif( ! is_user_logged_in() ) : ?>
29 <?php $title_guest = wpfval( $instance, 'title_guest' ) ? wpfval( $instance, 'title_guest' ) : apply_filters( 'wpforo_profile_widget_guest_title', __( 'Join Us!', 'wpforo' ) ); ?>
30 <h3 class="widget-title"><?php echo apply_filters( 'widget_title', $title_guest ); ?></h3>
31 <?php endif; ?>
32
33 <div class="wpforo-widget-content">
34 <?php $member = WPF()->current_user; ?>
35 <div class="wpf-prof-wrap">
36 <?php if( is_user_logged_in() ): wp_enqueue_script( 'wpforo-widgets-js' ); ?>
37 <div class="wpf-prof-header">
38 <?php if( ! wpfval( $instance, 'hide_avatar' ) && wpforo_setting( 'profiles', 'avatars' ) ): ?>
39 <div class="wpf-prof-avatar">
40 <?php echo wpforo_user_avatar( $member, 80 ); ?>
41 </div>
42 <?php endif; ?>
43 <?php if( ! wpfval( $instance, 'hide_name' ) ): ?>
44 <div class="wpf-prof-info">
45 <div class="wpf-prof-name">
46 <?php WPF()->member->show_online_indicator( $member['userid'] ) ?>
47 <?php echo wpfval( $member, 'display_name' ) ? esc_html( $member['display_name'] ) : esc_html( urldecode( (string) $member['nicename'] ) ) ?>
48 <?php if( function_exists( 'wpforo_is_anonymous_mask_member' ) && ! wpforo_is_anonymous_mask_member( $member ) ) {
49 wpforo_member_nicename( $member, '@' );
50 } ?>
51 </div>
52 </div>
53 <?php endif; ?>
54 <?php if( ! wpfval( $instance, 'hide_notification' ) && wpforo_setting( 'notifications', 'notifications' ) ): ?>
55 <div class="wpf-prof-alerts">
56 <?php WPF()->activity->bell( 'wpf-widget-alerts' ); ?>
57 </div>
58 <?php endif; ?>
59 </div>
60 <?php if( ! wpfval( $instance, 'hide_notification' ) && wpforo_setting( 'notifications', 'notifications' ) ): ?>
61 <div class="wpf-prof-notifications" style="flex-basis: 100%;">
62 <?php wpforo_notifications() ?>
63 </div>
64 <?php endif; ?>
65 <?php if( ! wpfval( $instance, 'hide_data' ) ): ?>
66 <div class="wpf-prof-content">
67 <?php do_action( 'wpforo_wiget_profile_content_before', $member ); ?>
68 <div class="wpf-prof-data">
69 <div class="wpf-prof-rating">
70 <?php echo in_array( $member['groupid'], wpforo_setting( 'rating', 'rating_title_ug' ) ) ? '<span class="wpf-member-title wpfrt">' . esc_html(
71 $member['rating']['title']
72 ) . '</span>' : ''; ?>
73 <?php wpforo_member_badge( $member ); ?>
74 </div>
75 <?php wpforo_member_title( $member, true, '', '', [ 'rating-title' ] ); ?>
76 </div>
77 <?php do_action( 'wpforo_wiget_profile_content_after', $member ); ?>
78 </div>
79 <?php endif; ?>
80 <?php endif; ?>
81 <div class="wpf-prof-footer">
82 <?php do_action( 'wpforo_wiget_profile_footer_before', $member ); ?>
83 <?php if( is_user_logged_in() ): ?>
84 <?php if( ! wpfval( $instance, 'hide_buttons' ) ): ?>
85 <div class="wpf-prof-buttons">
86 <?php WPF()->tpl->member_buttons( $member, 'wpforo\widgets\Profile' ) ?>
87 <?php if( ! wpforo_is_bot() ) : ?>
88 <a href="<?php echo wpforo_logout_url() ?>" class="wpf-logout"
89 title="<?php wpforo_phrase( 'Logout' ) ?>">
90 <svg height="12" width="12" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
91 <path fill="currentColor"
92 d="M497 273L329 441c-15 15-41 4.5-41-17v-96H152c-13.3 0-24-10.7-24-24v-96c0-13.3 10.7-24 24-24h136V88c0-21.4 25.9-32 41-17l168 168c9.3 9.4 9.3 24.6 0 34zM192 436v-40c0-6.6-5.4-12-12-12H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h84c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12H96c-53 0-96 43-96 96v192c0 53 43 96 96 96h84c6.6 0 12-5.4 12-12z"/>
93 </svg>
94 </a>
95 <?php endif ?>
96 </div>
97 <?php endif; ?>
98 <?php elseif( ! wpforo_is_bot() ): ?>
99 <div class="wpf-prof-loginout">
100 <a href="<?php echo wpforo_login_url(); ?>" class="wpf-button">
101 <svg height="12" width="12" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
102 <path fill="currentColor"
103 d="M416 448h-84c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h84c17.7 0 32-14.3 32-32V160c0-17.7-14.3-32-32-32h-84c-6.6 0-12-5.4-12-12V76c0-6.6-5.4-12-12-12h84c53 0 96 43 96 96v192c0 53-43 96-96 96zm-47-201L201 79c-15-15-41-4.5-41 17v96H24c-13.3 0-24 10.7-24 24v96c0 13.3 10.7 24 24 24h136v96c0 21.5 26 32 41 17l168-168c9.3-9.4 9.3-24.6 0-34z"/>
104 </svg> <?php wpforo_phrase( 'Login' ) ?></a> &nbsp;
105 <a href="<?php echo wpforo_register_url(); ?>" class="wpf-button">
106 <svg height="12" width="12" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">
107 <path fill="currentColor"
108 d="M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM504 312V248H440c-13.3 0-24-10.7-24-24s10.7-24 24-24h64V136c0-13.3 10.7-24 24-24s24 10.7 24 24v64h64c13.3 0 24 10.7 24 24s-10.7 24-24 24H552v64c0 13.3-10.7 24-24 24s-24-10.7-24-24z"/>
109 </svg> <?php wpforo_phrase( 'Register' ) ?></a>
110 </div>
111 <?php endif; ?>
112 <?php do_action( 'wpforo_wiget_profile_footer_after', $member ); ?>
113 </div>
114 </div>
115 </div>
116 </div>
117 <?php
118 }
119