PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / trunk
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress vtrunk
4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Widgets / UserPanel.php
wp-user-avatar / src / Widgets Last commit date
Form.php 11 months ago Init.php 5 years ago TabbedWidget.php 4 years ago TabbedWidgetDependency.php 1 year ago UserPanel.php 2 years ago index.php 5 years ago
UserPanel.php
116 lines
1 <?php
2
3 namespace ProfilePress\Core\Widgets;
4
5 class UserPanel extends \WP_Widget
6 {
7 public function __construct()
8 {
9 parent::__construct(
10 'pp_user_panel_widget',
11 esc_html__('ProfilePress User Panel', 'wp-user-avatar'),
12 array(
13 'description' => esc_html__('Display currently logged in user\'s avatar and links to logout and edit the profile.', 'wp-user-avatar'),
14 ),
15 array('width' => 400, 'height' => 350)// Args
16 );
17 }
18
19 /**
20 * Display Widget.
21 *
22 * @param array $args
23 * @param array $instance
24 */
25 public function widget($args, $instance)
26 {
27 if ( ! is_user_logged_in()) return;
28
29 $edit_profile_label = ! empty($instance['edit_profile_label']) ? sanitize_text_field($instance['edit_profile_label']) : esc_html__('Edit your Profile', 'wp-user-avatar');
30 $logout_label = ! empty($instance['logout_label']) ? sanitize_text_field($instance['logout_label']) : esc_html__('Log Out', 'wp-user-avatar');
31
32 echo $args['before_widget'];
33
34 $user_data = wp_get_current_user();
35 ?>
36
37 <div class="pp-user-panel">
38 <?php
39 do_action('ppress_before_user_panel_widget');
40
41 if (empty($instance['remove_avatar']) || $instance['remove_avatar'] != 'on') {
42 echo '<a href="' . ppress_profile_url() . '">';
43 echo '<div class="pp-tab-widget-avatar">';
44 echo get_avatar($user_data->ID, 500);
45 echo '</div>';
46 echo '</a>';
47 }
48 ?>
49 <h3 class="pp-user-panel-title">
50 <?php printf(__('Welcome %s', 'wp-user-avatar'), ucfirst($user_data->display_name)); ?>
51 </h3>
52 <br/>
53 <p>
54 <a class="pp-tabbed-btn pp-tabbed-btn-inverse" href="<?php echo ppress_edit_profile_url(); ?>"><?= $edit_profile_label ?></a>
55 </p>
56 <p>
57 <a class="pp-tabbed-btn pp-tabbed-btn-inverse" href="<?php echo wp_logout_url(); ?>"><?= $logout_label ?></a>
58 </p>
59 <?php do_action('ppress_after_user_panel_widget'); ?>
60 </div>
61 <?php
62 echo $args['after_widget'];
63 }
64
65
66 public function form($instance)
67 {
68 $title = ! empty($instance['title']) ? sanitize_text_field($instance['title']) : esc_html__('User Panel', 'wp-user-avatar');
69 $remove_avatar = ! empty($instance['remove_avatar']) ? sanitize_text_field($instance['remove_avatar']) : '';
70 $edit_profile_label = ! empty($instance['edit_profile_label']) ? sanitize_text_field($instance['edit_profile_label']) : esc_html__('Edit your Profile', 'wp-user-avatar');
71 $logout_label = ! empty($instance['logout_label']) ? sanitize_text_field($instance['logout_label']) : esc_html__('Log Out', 'wp-user-avatar');
72 ?>
73 <p>
74 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
75 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>">
76 </p>
77
78 <p>
79 <input class="widefat" id="<?php echo $this->get_field_id('remove_avatar'); ?>" name="<?php echo $this->get_field_name('remove_avatar'); ?>" type="checkbox" value="on" <?php checked($remove_avatar, 'on'); ?>>
80 <label for="<?php echo $this->get_field_id('remove_avatar'); ?>"><?php _e('Check to remove user profile picture from panel.'); ?></label>
81 </p>
82
83 <p>
84 <label for="<?php echo $this->get_field_id('edit_profile_label'); ?>"><?php _e('Label for "edit profile" link:'); ?></label>
85 <input class="widefat" id="<?php echo $this->get_field_id('edit_profile_label'); ?>" name="<?php echo $this->get_field_name('edit_profile_label'); ?>" type="text" value="<?php echo esc_attr($edit_profile_label); ?>">
86 </p>
87
88 <p>
89 <label for="<?php echo $this->get_field_id('logout_label'); ?>"><?php _e('Label for logout link:'); ?></label>
90 <input class="widefat" id="<?php echo $this->get_field_id('logout_label'); ?>" name="<?php echo $this->get_field_name('logout_label'); ?>" type="text" value="<?php echo esc_attr($logout_label); ?>">
91 </p>
92
93 <?php
94 }
95
96 /**
97 * Sanitize widget form values as they are saved.
98 *
99 * @param array $new_instance Values just sent to be saved.
100 * @param array $old_instance Previously saved values from database.
101 *
102 * @return array Updated safe values to be saved.
103 * @see WP_Widget::update()
104 *
105 */
106 public function update($new_instance, $old_instance)
107 {
108 $instance = array();
109 $instance['title'] = ( ! empty($new_instance['title'])) ? strip_tags($new_instance['title']) : '';
110 $instance['remove_avatar'] = ( ! empty($new_instance['remove_avatar'])) ? strip_tags($new_instance['remove_avatar']) : '';
111 $instance['edit_profile_label'] = ( ! empty($new_instance['edit_profile_label'])) ? strip_tags($new_instance['edit_profile_label']) : '';
112 $instance['logout_label'] = ( ! empty($new_instance['logout_label'])) ? strip_tags($new_instance['logout_label']) : '';
113
114 return $instance;
115 }
116 }