Simple Author Box - Version 2.42

Version Description

  • 2021-07-19
  • more bug fixes
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 Simple Author Box
Version 2.42
Comparing to
See all releases

Code changes from version 2.41 to 2.42

Files changed (3) hide show
  1. readme.txt +6 -2
  2. simple-author-box.php +1 -1
  3. template/template-sab.php +143 -200
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: WebFactory
3
  Tags: author box, responsive author box, author profile fields, author social icons, author bio, author description, author profile, post author, guest author, guest posts, guest author box, block
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
- Tested up to: 5.7
7
- Stable tag: 2.41
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -49,6 +49,10 @@ Add a responsive author box with social icons to any post. Great author box for
49
 
50
  == Changelog ==
51
 
 
 
 
 
52
  = 2.41 =
53
  * 2021-07-15
54
  * Minor bug fixes
3
  Tags: author box, responsive author box, author profile fields, author social icons, author bio, author description, author profile, post author, guest author, guest posts, guest author box, block
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
+ Tested up to: 5.8
7
+ Stable tag: 2.42
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
49
 
50
  == Changelog ==
51
 
52
+ = 2.42 =
53
+ * 2021-07-19
54
+ * more bug fixes
55
+
56
  = 2.41 =
57
  * 2021-07-15
58
  * Minor bug fixes
simple-author-box.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Simple Author Box
4
  * Plugin URI: https://wpauthorbox.com/
5
  * Description: Adds a responsive author box with social icons on any post.
6
- * Version: 2.41
7
  * Author: WebFactory Ltd
8
  * Author URI: https://www.webfactoryltd.com/
9
  * Requires: 4.6
3
  * Plugin Name: Simple Author Box
4
  * Plugin URI: https://wpauthorbox.com/
5
  * Description: Adds a responsive author box with social icons on any post.
6
+ * Version: 2.42
7
  * Author: WebFactory Ltd
8
  * Author URI: https://www.webfactoryltd.com/
9
  * Requires: 4.6
template/template-sab.php CHANGED
@@ -1,233 +1,176 @@
1
  <?php
2
 
3
- if ( isset($sabox_options['sab_colored']) && '1' == $sabox_options['sab_colored'] ) {
4
- $sabox_color = 'sabox-colored';
5
  } else {
6
- $sabox_color = '';
7
  }
8
 
9
- if ( isset($sabox_options['sab_web_position'] ) && '0' != $sabox_options['sab_web_position'] ) {
10
- $sab_web_align = 'sab-web-position';
11
  } else {
12
- $sab_web_align = '';
13
  }
14
 
15
- if ( isset($sabox_options['sab_web_target']) && '1' == $sabox_options['sab_web_target'] ) {
16
- $sab_web_target = '_blank';
17
  } else {
18
- $sab_web_target = '_self';
19
  }
20
 
21
- if ( isset($sabox_options['sab_web_rel'] ) && '1' == $sabox_options['sab_web_rel'] ) {
22
- $sab_web_rel = 'rel="nofollow"';
23
  } else {
24
- $sab_web_rel = '';
25
  }
26
 
27
- $sab_author_link = sprintf( '<a href="%s" class="vcard author" rel="author" itemprop="url"><span class="fn" itemprop="name">%s</span></a>', esc_url( get_author_posts_url( $sabox_author_id ) ), esc_html( get_the_author_meta( 'display_name', $sabox_author_id ) ) );
28
 
29
- $author_description = apply_filters( 'sab_user_description', get_the_author_meta( 'description' ,$sabox_author_id), $sabox_author_id );
30
 
31
- if ( '' != $author_description || isset($sabox_options['sab_no_description'] ) && '0' == $sabox_options['sab_no_description'] ) { // hide the author box if no description is provided
32
 
33
- $show_guest_only = ( get_post_meta( get_the_ID(), '_disable_sab_author_here', true ) ) ? get_post_meta( get_the_ID(), '_disable_sab_author_here', true ) : "false";
34
-
35
- if ( $show_guest_only != "on" ) {
36
-
37
- echo '<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">'; // start saboxplugin-wrap div
38
-
39
- if(!isset($sabox_options['sab_show_latest_posts'])){
40
- $sabox_options['sab_show_latest_posts'] = false;
41
- }
42
 
43
- if(!isset($sabox_options['sab_show_custom_html'])){
44
- $sabox_options['sab_show_custom_html'] = false;
45
- }
46
 
47
- if ('1' == $sabox_options['sab_show_latest_posts'] || '1' == $sabox_options['sab_show_custom_html']) {
48
- echo '<div class="saboxplugin-tabs-wrapper">';
49
- echo '<ul>';
50
- echo '<li class="active" data-tab="about">About the Author</li>';
51
- if ('1' == $sabox_options['sab_show_latest_posts']) {
52
- echo '<li data-tab="latest_posts">Latest posts</li>';
53
- }
54
- if ('1' == $sabox_options['sab_show_custom_html']) {
55
- echo '<li data-tab="other">Other</li>';
56
- }
57
- echo '</div>';
58
- }
59
 
60
- echo '<div class="saboxplugin-tab saboxplugin-tab-about">';
61
-
62
- // author box gravatar
63
- echo '<div class="saboxplugin-gravatar">';
64
- $custom_profile_image = get_the_author_meta( 'sabox-profile-image', $sabox_author_id );
65
- if ( '' != $custom_profile_image ) {
66
- $mediaid = attachment_url_to_postid( $custom_profile_image );
67
- $alt = $mediaid ? get_post_meta( $mediaid, '_wp_attachment_image_alt', true ) : '';
68
-
69
-
70
- $link = null;
71
- $nofollow = '';
72
- if ( isset( $sabox_options['sab_author_link'] ) ) {
73
- if ( 'author-page' == $sabox_options['sab_author_link'] ) {
74
-
75
- $link = get_user_meta( $sabox_author_id, 'sab_box_link', true );
76
- if(empty($link))
77
- $link = get_author_posts_url( $sabox_author_id );
78
-
79
- } elseif ( 'author-website' == $sabox_options['sab_author_link'] ) {
80
- if ( isset( $sabox_options['sab_author_link_noffolow'] ) && '1' == $sabox_options['sab_author_link_noffolow'] ) {
81
  $nofollow = ' rel="nofollow"';
82
  }
83
-
84
- $link = get_the_author_meta( 'user_url', $sabox_author_id );
85
- }
86
- }
87
 
88
- if($link != null)
89
- echo "<a $nofollow href='".$link."'>";
90
-
91
- echo '<img src="' . esc_url( $custom_profile_image ) . '" width="' . $sabox_options['sab_avatar_size'] . '" height="' . $sabox_options['sab_avatar_size'] . '" alt="' . esc_attr( $alt ) . '" itemprop="image">';
92
-
93
- if($link != null)
94
- echo "</a>";
95
-
96
- } else {
97
- echo get_avatar( get_the_author_meta( 'user_email', $sabox_author_id ), $sabox_options['sab_avatar_size'], '', '', array('extra_attr' => 'itemprop="image"') );
98
- }
99
-
100
- echo '</div>';
101
-
102
- // author box name
103
- echo '<div class="saboxplugin-authorname">';
104
- echo apply_filters( 'sabox_author_html', $sab_author_link, $sabox_options, $sabox_author_id );
105
- if ( is_user_logged_in() && get_current_user_id() == $sabox_author_id ) {
106
- echo '<a class="sab-profile-edit" target="_blank" href="' . get_edit_user_link() . '"> ' . esc_html__( 'Edit profile', 'simple-author-box' ) . '</a>';
107
- }
108
- echo '</div>';
109
-
110
- // author box description
111
- echo '<div class="saboxplugin-desc">';
112
- echo '<div itemprop="description">';
113
-
114
- $author_description = wptexturize( $author_description );
115
- $author_description = wpautop( $author_description );
116
- echo wp_kses_post( $author_description );
117
- if ( '' == $author_description && is_user_logged_in() && $sabox_author_id == get_current_user_id() ) {
118
- echo '<a target="_blank" href="' . admin_url() . 'profile.php?#wp-description-wrap">' . esc_html__( 'Add Biographical Info', 'simple-author-box' ) . '</a>';
119
- }
120
- echo '</div>';
121
- echo '</div>';
122
-
123
- if ( is_single() || is_page() ) {
124
- if ( get_the_author_meta( 'user_url' ) != '' && '1' == $sabox_options['sab_web'] ) { // author website on single
125
- echo '<div class="saboxplugin-web ' . esc_attr( $sab_web_align ) . '">';
126
- echo '<a href="' . esc_url( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '" target="' . esc_attr( $sab_web_target ) . '" ' . $sab_web_rel . '>' . esc_html( Simple_Author_Box_Helper::strip_prot(get_the_author_meta( 'user_url', $sabox_author_id )) ) . '</a>';
127
- echo '</div>';
128
- }
129
- }
130
-
131
-
132
- if ( is_author() || is_archive() ) {
133
- if ( get_the_author_meta( 'user_url' ) != '' ) { // force show author website on author.php or archive.php
134
- echo '<div class="saboxplugin-web ' . esc_attr( $sab_web_align ) . '">';
135
- echo '<a href="' . esc_url( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '" target="' . esc_attr( $sab_web_target ) . '" ' . $sab_web_rel . '>' . esc_html( Simple_Author_Box_Helper::strip_prot(get_the_author_meta( 'user_url', $sabox_author_id )) ) . '</a>';
136
- echo '</div>';
137
- }
138
- }
139
-
140
- // author box clearfix
141
- echo '<div class="clearfix"></div>';
142
-
143
- // author box social icons
144
- $author = get_userdata( $sabox_author_id );
145
- $show_social_icons = apply_filters( 'sabox_hide_social_icons', true, $author );
146
-
147
-
148
- if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
149
- echo '<div class="sab-edit-settings">';
150
- echo '<a target="_blank" href="' . admin_url() . 'themes.php?page=simple-author-box">' . esc_html__( 'Settings', 'simple-author-box' ) . '<i class="dashicons dashicons-admin-settings"></i></a>';
151
- echo '</div>';
152
- }
153
-
154
- $show_email = isset($sabox_options['sab_email'] ) && '0' == $sabox_options['sab_email'] ? false : true;
155
- $social_links = Simple_Author_Box_Helper::get_user_social_links( $sabox_author_id, $show_email );
156
-
157
- if ( empty( $social_links ) && is_user_logged_in() && $sabox_author_id == get_current_user_id() ) {
158
- echo '<a target="_blank" href="' . admin_url() . 'profile.php?#sabox-social-table">' . esc_html__( 'Add Social Links', 'simple-author-box' ) . '</a>';
159
- }
160
-
161
- if ( isset($sabox_options['sab_hide_socials']) && '0' == $sabox_options['sab_hide_socials'] && $show_social_icons && ! empty( $social_links ) ) { // hide social icons div option
162
- echo '<div class="saboxplugin-socials ' . esc_attr( $sabox_color ) . '">';
163
-
164
- foreach ( $social_links as $social_platform => $social_link ) {
165
-
166
- if ( 'user_email' == $social_platform ) {
167
- $social_link = 'mailto:' . antispambot( $social_link );
168
- }
169
-
170
- if ( 'whatsapp' == $social_platform ) {
171
- $social_link = 'https://wa.me/' . $social_link;
172
- }
173
-
174
- if ( 'phone' == $social_platform ) {
175
- $social_link = 'tel:' . $social_link;
176
- }
177
-
178
- if ( 'telegram' == $social_platform ) {
179
- $social_link = 'https://t.me/' . $social_link;
180
- }
181
-
182
- if ( 'skype' == $social_platform ) {
183
- $social_link = 'skype:' . $social_link.'?call';
184
- }
185
-
186
- if ( ! empty( $social_link ) ) {
187
- echo Simple_Author_Box_Helper::get_sabox_social_icon( $social_link, $social_platform );
188
- }
189
  }
190
-
191
- echo '</div>';
192
- }
193
 
194
-
195
-
196
-
197
- echo '</div>'; // about tab
198
-
199
- echo '<div class="saboxplugin-tab saboxplugin-tab-latest_posts" style="display:none">';
200
- $latest_posts = get_posts(array(
201
- 'author' => $sabox_author_id,
202
- 'orderby' => 'post_date',
203
- 'order' => 'DESC',
204
- 'posts_per_page' => 3
205
- ));
206
- if (!empty($latest_posts)) {
207
- echo '<ul>';
208
- foreach ($latest_posts as $latest_post) {
209
- echo '<li><a href="' . get_permalink($latest_post->ID) . '">' . $latest_post->post_title . '</a></li>';
210
- }
211
- echo '</ul>';
212
  } else {
213
- echo 'You do not have any posts.';
214
  }
 
215
  echo '</div>';
216
 
217
- echo '<div class="saboxplugin-tab saboxplugin-tab-other" style="display:none">';
218
-
219
- $author_html = get_user_meta($sabox_author_id, 'sab_box_author_html', true);
220
- if(!empty($sabox_options['sab_tab_custom_html_body'])){
221
- echo str_ireplace('%%author_html%%', $author_html, $sabox_options['sab_tab_custom_html_body']);
222
- } else if (false != $author_html) {
223
- echo $author_html;
224
- } else {
225
- echo '<i>Set your Author Custom HTML Tab Content on your <a href="' . admin_url('profile.php') . '#sabox-custom-profile-image" target="_blank" class="clickable">Profile page</a></i>';
226
  }
227
  echo '</div>';
228
 
229
- } // end of social icons
230
- echo '</div>'; // end of saboxplugin-wrap div
231
-
232
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ if (isset($sabox_options['sab_colored']) && '1' == $sabox_options['sab_colored']) {
4
+ $sabox_color = 'sabox-colored';
5
  } else {
6
+ $sabox_color = '';
7
  }
8
 
9
+ if (isset($sabox_options['sab_web_position']) && '0' != $sabox_options['sab_web_position']) {
10
+ $sab_web_align = 'sab-web-position';
11
  } else {
12
+ $sab_web_align = '';
13
  }
14
 
15
+ if (isset($sabox_options['sab_web_target']) && '1' == $sabox_options['sab_web_target']) {
16
+ $sab_web_target = '_blank';
17
  } else {
18
+ $sab_web_target = '_self';
19
  }
20
 
21
+ if (isset($sabox_options['sab_web_rel']) && '1' == $sabox_options['sab_web_rel']) {
22
+ $sab_web_rel = 'rel="nofollow"';
23
  } else {
24
+ $sab_web_rel = '';
25
  }
26
 
27
+ $sab_author_link = sprintf('<a href="%s" class="vcard author" rel="author" itemprop="url"><span class="fn" itemprop="name">%s</span></a>', esc_url(get_author_posts_url($sabox_author_id)), esc_html(get_the_author_meta('display_name', $sabox_author_id)));
28
 
29
+ $author_description = apply_filters('sab_user_description', get_the_author_meta('description', $sabox_author_id), $sabox_author_id);
30
 
31
+ if ('' != $author_description || isset($sabox_options['sab_no_description']) && '0' == $sabox_options['sab_no_description']) { // hide the author box if no description is provided
32
 
33
+ $show_guest_only = (get_post_meta(get_the_ID(), '_disable_sab_author_here', true)) ? get_post_meta(get_the_ID(), '_disable_sab_author_here', true) : "false";
 
 
 
 
 
 
 
 
34
 
35
+ if ($show_guest_only != "on") {
 
 
36
 
37
+ echo '<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">'; // start saboxplugin-wrap div
38
+
39
+ echo '<div class="saboxplugin-tab">';
 
 
 
 
 
 
 
 
 
40
 
41
+ // author box gravatar
42
+ echo '<div class="saboxplugin-gravatar">';
43
+ $custom_profile_image = get_the_author_meta('sabox-profile-image', $sabox_author_id);
44
+ if ('' != $custom_profile_image) {
45
+ $mediaid = attachment_url_to_postid($custom_profile_image);
46
+ $alt = $mediaid ? get_post_meta($mediaid, '_wp_attachment_image_alt', true) : '';
47
+
48
+
49
+ $link = null;
50
+ $nofollow = '';
51
+ if (isset($sabox_options['sab_author_link'])) {
52
+ if ('author-page' == $sabox_options['sab_author_link']) {
53
+
54
+ $link = get_user_meta($sabox_author_id, 'sab_box_link', true);
55
+ if (empty($link))
56
+ $link = get_author_posts_url($sabox_author_id);
57
+ } elseif ('author-website' == $sabox_options['sab_author_link']) {
58
+ if (isset($sabox_options['sab_author_link_noffolow']) && '1' == $sabox_options['sab_author_link_noffolow']) {
 
 
 
59
  $nofollow = ' rel="nofollow"';
60
  }
 
 
 
 
61
 
62
+ $link = get_the_author_meta('user_url', $sabox_author_id);
63
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  }
 
 
 
65
 
66
+ if ($link != null)
67
+ echo "<a $nofollow href='" . $link . "'>";
68
+
69
+ echo '<img src="' . esc_url($custom_profile_image) . '" width="' . $sabox_options['sab_avatar_size'] . '" height="' . $sabox_options['sab_avatar_size'] . '" alt="' . esc_attr($alt) . '" itemprop="image">';
70
+
71
+ if ($link != null)
72
+ echo "</a>";
 
 
 
 
 
 
 
 
 
 
 
73
  } else {
74
+ echo get_avatar(get_the_author_meta('user_email', $sabox_author_id), $sabox_options['sab_avatar_size'], '', '', array('extra_attr' => 'itemprop="image"'));
75
  }
76
+
77
  echo '</div>';
78
 
79
+ // author box name
80
+ echo '<div class="saboxplugin-authorname">';
81
+ echo apply_filters('sabox_author_html', $sab_author_link, $sabox_options, $sabox_author_id);
82
+ if (is_user_logged_in() && get_current_user_id() == $sabox_author_id) {
83
+ echo '<a class="sab-profile-edit" target="_blank" href="' . get_edit_user_link() . '"> ' . esc_html__('Edit profile', 'simple-author-box') . '</a>';
 
 
 
 
84
  }
85
  echo '</div>';
86
 
87
+ // author box description
88
+ echo '<div class="saboxplugin-desc">';
89
+ echo '<div itemprop="description">';
90
+
91
+ $author_description = wptexturize($author_description);
92
+ $author_description = wpautop($author_description);
93
+ echo wp_kses_post($author_description);
94
+ if ('' == $author_description && is_user_logged_in() && $sabox_author_id == get_current_user_id()) {
95
+ echo '<a target="_blank" href="' . admin_url() . 'profile.php?#wp-description-wrap">' . esc_html__('Add Biographical Info', 'simple-author-box') . '</a>';
96
+ }
97
+ echo '</div>';
98
+ echo '</div>';
99
+
100
+ if (is_single() || is_page()) {
101
+ if (get_the_author_meta('user_url') != '' && '1' == $sabox_options['sab_web']) { // author website on single
102
+ echo '<div class="saboxplugin-web ' . esc_attr($sab_web_align) . '">';
103
+ echo '<a href="' . esc_url(get_the_author_meta('user_url', $sabox_author_id)) . '" target="' . esc_attr($sab_web_target) . '" ' . $sab_web_rel . '>' . esc_html(Simple_Author_Box_Helper::strip_prot(get_the_author_meta('user_url', $sabox_author_id))) . '</a>';
104
+ echo '</div>';
105
+ }
106
+ }
107
+
108
 
109
+ if (is_author() || is_archive()) {
110
+ if (get_the_author_meta('user_url') != '') { // force show author website on author.php or archive.php
111
+ echo '<div class="saboxplugin-web ' . esc_attr($sab_web_align) . '">';
112
+ echo '<a href="' . esc_url(get_the_author_meta('user_url', $sabox_author_id)) . '" target="' . esc_attr($sab_web_target) . '" ' . $sab_web_rel . '>' . esc_html(Simple_Author_Box_Helper::strip_prot(get_the_author_meta('user_url', $sabox_author_id))) . '</a>';
113
+ echo '</div>';
114
+ }
115
+ }
116
+
117
+ // author box clearfix
118
+ echo '<div class="clearfix"></div>';
119
+
120
+ // author box social icons
121
+ $author = get_userdata($sabox_author_id);
122
+ $show_social_icons = apply_filters('sabox_hide_social_icons', true, $author);
123
+
124
+
125
+ if (is_user_logged_in() && current_user_can('manage_options')) {
126
+ echo '<div class="sab-edit-settings">';
127
+ echo '<a target="_blank" href="' . admin_url() . 'themes.php?page=simple-author-box">' . esc_html__('Settings', 'simple-author-box') . '<i class="dashicons dashicons-admin-settings"></i></a>';
128
+ echo '</div>';
129
+ }
130
+
131
+ $show_email = isset($sabox_options['sab_email']) && '0' == $sabox_options['sab_email'] ? false : true;
132
+ $social_links = Simple_Author_Box_Helper::get_user_social_links($sabox_author_id, $show_email);
133
+
134
+ if (empty($social_links) && is_user_logged_in() && $sabox_author_id == get_current_user_id()) {
135
+ echo '<a target="_blank" href="' . admin_url() . 'profile.php?#sabox-social-table">' . esc_html__('Add Social Links', 'simple-author-box') . '</a>';
136
+ }
137
+
138
+ if (isset($sabox_options['sab_hide_socials']) && '0' == $sabox_options['sab_hide_socials'] && $show_social_icons && !empty($social_links)) { // hide social icons div option
139
+ echo '<div class="saboxplugin-socials ' . esc_attr($sabox_color) . '">';
140
+
141
+ foreach ($social_links as $social_platform => $social_link) {
142
+
143
+ if ('user_email' == $social_platform) {
144
+ $social_link = 'mailto:' . antispambot($social_link);
145
+ }
146
+
147
+ if ('whatsapp' == $social_platform) {
148
+ $social_link = 'https://wa.me/' . $social_link;
149
+ }
150
+
151
+ if ('phone' == $social_platform) {
152
+ $social_link = 'tel:' . $social_link;
153
+ }
154
+
155
+ if ('telegram' == $social_platform) {
156
+ $social_link = 'https://t.me/' . $social_link;
157
+ }
158
+
159
+ if ('skype' == $social_platform) {
160
+ $social_link = 'skype:' . $social_link . '?call';
161
+ }
162
+
163
+ if (!empty($social_link)) {
164
+ echo Simple_Author_Box_Helper::get_sabox_social_icon($social_link, $social_platform);
165
+ }
166
+ }
167
+
168
+ echo '</div>';
169
+ } // sab_socials
170
+
171
+ echo '</div>'; // sabox-tab
172
+
173
+ } // show guest only
174
+ echo '</div>'; // end of saboxplugin-wrap div
175
+
176
+ }