User Profile Picture - Version 2.2.0

Version Description

  • Released 2019-05-12
  • Added template tags for displaying an author box
Download this release

Release Info

Developer ronalfy
Plugin Icon 128x128 User Profile Picture
Version 2.2.0
Comparing to
See all releases

Code changes from version 2.1.3 to 2.2.0

languages/metronet-profile-picture.pot CHANGED
@@ -21,23 +21,23 @@ msgstr ""
21
  msgid "Author Details"
22
  msgstr ""
23
 
24
- #: src/gutenberg/class-gutenberg.php:207
25
  msgid "Latest Posts"
26
  msgstr ""
27
 
28
- #: src/gutenberg/class-gutenberg.php:299, src/gutenberg/class-gutenberg.php:355, src/js/gutenberg/main.js:211, src/js/gutenberg/profile-legacy.js:438, src/js/gutenberg/profile.js:1059, src/js/gutenberg/profile.js:1232
29
  msgid "View Posts"
30
  msgstr ""
31
 
32
- #: src/gutenberg/class-gutenberg.php:304, src/gutenberg/class-gutenberg.php:360, src/js/gutenberg/profile.js:1077, src/js/gutenberg/profile.js:1252
33
  msgid "View Website"
34
  msgstr ""
35
 
36
- #: src/gutenberg/class-gutenberg.php:328, src/js/gutenberg/profile.js:1144
37
  msgid "View all posts by"
38
  msgstr ""
39
 
40
- #: src/gutenberg/class-gutenberg.php:332, src/js/gutenberg/profile.js:629, src/js/gutenberg/profile.js:1153
41
  msgid "Website"
42
  msgstr ""
43
 
@@ -373,18 +373,26 @@ msgstr ""
373
  msgid "Remove Profile Image"
374
  msgstr ""
375
 
376
- #: src/metronet-profile-picture.php:746
377
  msgid "You must be able to upload files."
378
  msgstr ""
379
 
380
- #: src/metronet-profile-picture.php:750, src/metronet-profile-picture.php:783, src/metronet-profile-picture.php:809, src/metronet-profile-picture.php:845
381
  msgid "User not found."
382
  msgstr ""
383
 
384
- #: src/metronet-profile-picture.php:754
385
  msgid "User not owner."
386
  msgstr ""
387
 
388
- #: src/metronet-profile-picture.php:818, src/metronet-profile-picture.php:852
389
  msgid "Profile picture not found."
390
  msgstr ""
 
 
 
 
 
 
 
 
21
  msgid "Author Details"
22
  msgstr ""
23
 
24
+ #: src/gutenberg/class-gutenberg.php:207, src/metronet-profile-picture.php:1050
25
  msgid "Latest Posts"
26
  msgstr ""
27
 
28
+ #: src/gutenberg/class-gutenberg.php:299, src/gutenberg/class-gutenberg.php:355, src/js/gutenberg/main.js:211, src/js/gutenberg/profile-legacy.js:438, src/js/gutenberg/profile.js:1059, src/js/gutenberg/profile.js:1232, src/metronet-profile-picture.php:1088, src/metronet-profile-picture.php:1144
29
  msgid "View Posts"
30
  msgstr ""
31
 
32
+ #: src/gutenberg/class-gutenberg.php:304, src/gutenberg/class-gutenberg.php:360, src/js/gutenberg/profile.js:1077, src/js/gutenberg/profile.js:1252, src/metronet-profile-picture.php:1093, src/metronet-profile-picture.php:1149
33
  msgid "View Website"
34
  msgstr ""
35
 
36
+ #: src/gutenberg/class-gutenberg.php:328, src/js/gutenberg/profile.js:1144, src/metronet-profile-picture.php:1117
37
  msgid "View all posts by"
38
  msgstr ""
39
 
40
+ #: src/gutenberg/class-gutenberg.php:332, src/js/gutenberg/profile.js:629, src/js/gutenberg/profile.js:1153, src/metronet-profile-picture.php:1121
41
  msgid "Website"
42
  msgstr ""
43
 
373
  msgid "Remove Profile Image"
374
  msgstr ""
375
 
376
+ #: src/metronet-profile-picture.php:755
377
  msgid "You must be able to upload files."
378
  msgstr ""
379
 
380
+ #: src/metronet-profile-picture.php:759, src/metronet-profile-picture.php:792, src/metronet-profile-picture.php:818, src/metronet-profile-picture.php:854
381
  msgid "User not found."
382
  msgstr ""
383
 
384
+ #: src/metronet-profile-picture.php:763
385
  msgid "User not owner."
386
  msgstr ""
387
 
388
+ #: src/metronet-profile-picture.php:827, src/metronet-profile-picture.php:861
389
  msgid "Profile picture not found."
390
  msgstr ""
391
+
392
+ #: src/metronet-profile-picture.php:1049
393
+ msgid "Author"
394
+ msgstr ""
395
+
396
+ #: src/metronet-profile-picture.php:1051
397
+ msgid "Author Information"
398
+ msgstr ""
metronet-profile-picture.php CHANGED
@@ -4,14 +4,14 @@ Plugin Name: User Profile Picture
4
  Plugin URI: http://wordpress.org/extend/plugins/metronet-profile-picture/
5
  Description: Use the native WP uploader on your user profile page.
6
  Author: Ronald Huereca
7
- Version: 2.1.3
8
  Requires at least: 3.5
9
  Author URI: https://www.mediaron.com
10
  Contributors: ronalfy
11
  Text Domain: metronet-profile-picture
12
  Domain Path: /languages
13
  */
14
- define( 'METRONET_PROFILE_PICTURE_VERSION', '2.1.3' );
15
  class Metronet_Profile_Picture {
16
 
17
  //private
@@ -980,3 +980,380 @@ function mt_profile_img( $user_id, $args = array() ) {
980
  return $post_thumbnail;
981
  }
982
  } //end mt_profile_img
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  Plugin URI: http://wordpress.org/extend/plugins/metronet-profile-picture/
5
  Description: Use the native WP uploader on your user profile page.
6
  Author: Ronald Huereca
7
+ Version: 2.2.0
8
  Requires at least: 3.5
9
  Author URI: https://www.mediaron.com
10
  Contributors: ronalfy
11
  Text Domain: metronet-profile-picture
12
  Domain Path: /languages
13
  */
14
+ define( 'METRONET_PROFILE_PICTURE_VERSION', '2.2.0' );
15
  class Metronet_Profile_Picture {
16
 
17
  //private
980
  return $post_thumbnail;
981
  }
982
  } //end mt_profile_img
983
+
984
+ /**
985
+ * mt_author_box
986
+ *
987
+ * Adds a profile author box
988
+ *
989
+ * @since 2.2.0
990
+ *
991
+ * @param int $user_id INT - The user ID for the user to retrieve the profile for
992
+ * @param array $attributes See defaults in function for all attributes
993
+ *
994
+ * @return string User profile box if user exists
995
+ *
996
+ */
997
+ function mt_author_box( $user_id = 0, $attributes = array() ) {
998
+ $user = get_user_by( 'id', $user_id );
999
+ if ( false === $user ) {
1000
+ return '';
1001
+ }
1002
+ $defaults = array(
1003
+ 'theme' => 'regular', /* can be 'regular', 'compact', 'profie', or 'tabbed' */
1004
+ 'profileAvatarShape' => 'square', /* Can be 'square' or 'rounded' */
1005
+ 'padding' => 10,
1006
+ 'border' => 1,
1007
+ 'borderRounded' => 5,
1008
+ 'borderColor' => '#000000',
1009
+ 'profileBackgroundColor' => '#FFFFFF',
1010
+ 'profileTextColor' => '#000000',
1011
+ 'showName' => true,
1012
+ 'showTitle' => false,
1013
+ 'fontSize' => 18,
1014
+ 'profileName' => $user->data->display_name,
1015
+ 'profileTitle' => '',
1016
+ 'avatarSize' => 150,
1017
+ 'profileImgURL' => get_avatar_url( $user_id, isset( $attributes['avatarSize'] ) ? $attributes['avatarSize'] : 150 ),
1018
+ 'headerFontSize' => 24,
1019
+ 'showDescription' => true,
1020
+ 'showSocialMedia' => true,
1021
+ 'profileContent' => get_user_meta( $user_id, 'description', true ),
1022
+ 'profileFontSize' => 18,
1023
+ 'showViewPosts' => true,
1024
+ 'profileURL' => get_author_posts_url( $user_id ),
1025
+ 'website' => '', /* Needs to be a URl */
1026
+ 'showWebsite' => false,
1027
+ 'showPostsWidth' => '100%', /* ignored if website is not empty and true */
1028
+ 'profileViewPostsBackgroundColor' => '#cf6d38',
1029
+ 'profileViewPostsTextColor' => '#FFFFFF',
1030
+ 'buttonFontSize' => 16,
1031
+ 'profileWebsiteBackgroundColor' => '#333333',
1032
+ 'profileWebsiteTextColor' => '#FFFFFF',
1033
+ 'profileLinkColor' => '#000000',
1034
+ 'showSocialMedia' => false,
1035
+ 'socialWordPress' => '',
1036
+ 'socialFacebook' => '',
1037
+ 'socialTwitter' => '',
1038
+ 'socialInstagram' => '',
1039
+ 'socialPinterest' => '',
1040
+ 'socialLinkedIn' => '',
1041
+ 'socialYouTube' => '',
1042
+ 'socialGitHub' => '',
1043
+ 'socialMediaOptions' => 'brand', /* can be brand or custom */
1044
+ 'socialMediaColors' => '#000000', /* Only applicable if socialMediaOptions is custom */
1045
+ 'profileCompactAlignment' => 'center', /* Can be left, center, or right */
1046
+ /* Tabbed Attributes */
1047
+ 'tabbedAuthorProfileTitle' => '',
1048
+ 'tabbedAuthorSubHeading' => '',
1049
+ 'tabbedAuthorProfile' => __( 'Author', 'metronet-profile-picture' ),
1050
+ 'tabbedAuthorLatestPosts' => __( 'Latest Posts', 'metronet-profile-picture' ),
1051
+ 'tabbedAuthorProfileHeading' => __( 'Author Information', 'metronet-profile-picture'),
1052
+ 'profileLatestPostsOptionsValue' => 'white', /* can be none, white, light, black, magenta, blue, green */
1053
+ 'profileTabColor' => '#333333',
1054
+ 'profileTabPostsColor' => '#333333',
1055
+ 'profileTabHeadlineColor' => '#333333',
1056
+ 'profileTabHeadlineTextColor' => '#FFFFFF',
1057
+ 'profileTabTextColor' => '#FFFFFF',
1058
+ 'profileTabPostsTextColor' => '#FFFFFF'
1059
+
1060
+ );
1061
+ $attributes = wp_parse_args( $attributes, $defaults );
1062
+ $min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1063
+ if( 'regular' === $attributes['theme'] || 'compact' === $attributes['theme'] || 'profile' === $attributes['theme'] ):
1064
+ ?>
1065
+ <div class="mpp-enhanced-profile-wrap mpp-block-profile <?php echo 'compact' === $attributes['theme'] ? esc_attr( $attributes['profileCompactAlignment'] ) : ''; ?> <?php echo esc_attr( $attributes['theme'] ); ?> <?php echo esc_attr( $attributes['profileAvatarShape'] ); ?>" style="<?php echo $attributes['padding'] > 0 ? 'padding: ' . esc_attr( $attributes['padding'] ) . 'px;' : ''?><?php echo $attributes['border'] > 0 ? 'border:' . esc_attr( $attributes['border'] ) . 'px solid ' . esc_attr( $attributes['borderColor'] ) . ';' : ''?><?php echo $attributes['borderRounded'] > 0 ? 'border-radius:' . esc_attr( $attributes['borderRounded'] ) . 'px;': ''?>background-color: <?php echo esc_attr( $attributes['profileBackgroundColor'] ) . ';'; ?> color: <?php echo esc_attr( $attributes['profileTextColor'] ) . ';' ?>">
1066
+ <div class="mpp-profile-gutenberg-wrap mt-font-size-<?php echo esc_attr( $attributes['profileFontSize'] ); ?>">
1067
+ <?php if( 'regular' === $attributes['theme']): ?>
1068
+ <div class="mpp-profile-image-wrapper">
1069
+ <div class="mpp-profile-image-square">
1070
+ <img class="profile-avatar" alt="avatar" src="<?php echo esc_url( $attributes['profileImgURL'] ); ?>" />
1071
+ </div>
1072
+ </div>
1073
+ <div class="mpp-content-wrap">
1074
+ <?php if ( $attributes['showName']):?>
1075
+ <h2 style="color:<?php echo esc_attr( $attributes['profileTextColor'] ); ?>; font-size: <?php echo esc_attr( $attributes['headerFontSize'] ) . 'px;'?>"><?php echo wp_kses_post( $attributes['profileName'] ); ?></h2>
1076
+ <?php endif; ?>
1077
+ <?php if ( $attributes['showTitle']):?>
1078
+ <p style="color:<?php echo esc_attr( $attributes['profileTextColor'] ); ?>"><?php echo wp_kses_post( $attributes['profileTitle'] ); ?></p>
1079
+ <?php endif; ?>
1080
+ <?php if ( $attributes['showDescription']):?>
1081
+ <div><?php echo wp_kses_post( $attributes['profileContent'] ); ?></div>
1082
+ <?php endif; ?>
1083
+ <?php if ( isset( $attributes['profileURL'] ) && strlen( $attributes['profileURL' ] ) > 0 ) :?>
1084
+ <div class="mpp-gutenberg-view-posts">
1085
+ <?php if ( $attributes['showViewPosts'] ): ?>
1086
+ <div class="mpp-profile-view-posts" style="background-color: <?php echo esc_attr( $attributes['profileViewPostsBackgroundColor'] ); ?>; color: <?php echo esc_attr( $attributes['profileViewPostsTextColor'] ); ?>; <?php ( '' != $attributes['website'] && $attributes['showWebsite'] ) ? '' : 'width:' . esc_attr( $attributes['showPostsWidth'] ) . ';' ?> font-size: <?php echo esc_attr( $attributes['buttonFontSize'] ); ?>px;">
1087
+ <a href="<?php echo esc_url( $attributes['profileURL'] ); ?>" style="background: <?php echo esc_attr( $attributes['profileViewPostsBackgroundColor'] ); ?>; color: <?php echo esc_attr( $attributes['profileViewPostsTextColor'] ); ?>">
1088
+ <?php esc_html_e( 'View Posts', 'metronet-profile-picture' ); ?></a>
1089
+ </div><!-- .mpp-profile-view-posts -->
1090
+ <?php endif; ?>
1091
+ <?php if ( '' != $attributes['website'] && $attributes['showWebsite'] ): ?>
1092
+ <div class="mpp-profile-view-website" style="background: <?php echo esc_attr( $attributes['profileWebsiteBackgroundColor'] ); ?>;color: <?php echo esc_attr( $attributes['profileWebsiteTextColor'] ); ?>; font-size: <?php echo esc_attr( $attributes['buttonFontSize'] ) ;?>px;">
1093
+ <a href="<?php echo esc_url( $attributes['website'] ) ?>" style="background: <?php echo esc_attr( $attributes['profileWebsiteBackgroundColor'] ); ?>; color: <?php echo esc_attr( $attributes['profileWebsiteTextColor'] ); ?>;"><?php esc_html_e( 'View Website', 'metronet-profile-picture' ); ?></a>
1094
+ </div><!-- .mpp-profile-view-website -->
1095
+ <?php endif; ?>
1096
+ </div><!-- .mpp-gutenberg-view-posts -->
1097
+ <?php endif; ?>
1098
+ </div><!-- .mpp-content-wrap -->
1099
+ <?php endif; /* End Regular Theme */ ?>
1100
+ <?php if( 'profile' === $attributes['theme'] ): ?>
1101
+ <?php if ( $attributes['showName'] ): ?>
1102
+ <h2 style="color: <?php echo esc_attr( $attributes['profileTextColor'] ); ?>; font-size: <?php echo esc_attr( $attributes['headerFontSize'] ) . 'px'; ?>"><?php echo wp_kses_post( $attributes['profileName'] ); ?></h2>
1103
+ <?php endif; ?>
1104
+ <div class="mpp-profile-image-wrapper">
1105
+ <div class="mpp-profile-image-square">
1106
+ <img src="<?php echo esc_url( $attributes['profileImgURL'] ); ?>" alt="avatar" class="profile-avatar" />
1107
+ </div>
1108
+ </div><!-- .mpp-profile-image-wrapper -->
1109
+ <?php if ( $attributes['showDescription'] ): ?>
1110
+ <div class="mpp-profile-text">
1111
+ <?php echo wp_kses_post( $attributes['profileContent'] ); ?>
1112
+ </div><!-- .mpp-profile-text -->
1113
+ <?php endif; ?>
1114
+ <div class="mpp-profile-meta" style="font-size: <?php echo esc_attr( $attributes['fontSize'] ); ?>px;">
1115
+ <?php if ( $attributes['showViewPosts'] ): ?>
1116
+ <div class="mpp-profile-link alignleft">
1117
+ <a href="<?php echo esc_url( $attributes['profileURL'] ); ?>" style="color: <?php echo esc_attr( $attributes['profileLinkColor'] ); ?>;"><?php esc_html_e( 'View all posts by', 'metronet-profile-picture' ); ?> <?php echo esc_html( $attributes['profileName'] ); ?></a>
1118
+ </div><!-- .mpp-profile-link -->
1119
+ <div class="mpp-profile-link alignright">
1120
+ <a href="<?php echo esc_url( $attributes['website'] ); ?>" style="color: <?php echo esc_attr( $attributes['profileLinkColor'] ); ?>">
1121
+ <?php esc_html_e( 'Website', 'metronet-profile-picture' ); ?>
1122
+ </a>
1123
+ </div><!-- .mpp-profile-link -->
1124
+ <?php endif; ?>
1125
+ </div><!-- .mpp-profile-meta -->
1126
+ <?php endif; /* End of profile theme */ ?>
1127
+ <?php if ( 'compact' === $attributes['theme'] ): ?>
1128
+ <?php if ( $attributes['showName'] ): ?>
1129
+ <h2 style="color: <?php echo esc_attr( $attributes['profileTextColor'] ); ?>; font-size: <?php echo esc_attr( $attributes['headerFontSize'] ) . 'px'; ?>"><?php echo wp_kses_post( $attributes['profileName'] ); ?></h2>
1130
+ <?php endif; ?>
1131
+ <div class="mpp-profile-image-wrapper">
1132
+ <div class="mpp-profile-image-square">
1133
+ <img src="<?php echo esc_url( $attributes['profileImgURL'] ); ?>" alt="avatar" class="profile-avatar" />
1134
+ </div>
1135
+ </div><!-- .mpp-profile-image-wrapper -->
1136
+ <?php if ( $attributes['showDescription'] ): ?>
1137
+ <div class="mpp-profile-text">
1138
+ <?php echo wp_kses_post( $attributes['profileContent'] ); ?>
1139
+ </div><!-- .mpp-profile-text -->
1140
+ <?php endif; ?>
1141
+ <div class="mpp-compact-meta">
1142
+ <?php if ( $attributes['showViewPosts'] ): ?>
1143
+ <div class="mpp-profile-view-posts" style="background: <?php echo esc_attr( $attributes['profileViewPostsBackgroundColor'] ); ?>; color: <?php echo esc_attr( $attributes['profileViewPostsTextColor'] ); ?>; width: 90%; margin: 0 auto 10px auto; font-size: <?php echo esc_attr( $attributes['buttonFontSize'] ); ?>px;">
1144
+ <a href="<?php echo esc_url( $attributes['profileURL'] ); ?>" style="color: <?php echo esc_attr( $attributes['profileViewPostsTextColor'] ); ?>; background: <?php echo esc_attr( $attributes['profileViewPostsBackgroundColor'] ); ?>;"><?php esc_html_e( 'View Posts', 'metronet-profile-picture' ); ?></a>
1145
+ </div><!-- .mpp-profile-view-posts -->
1146
+ <?php endif; ?>
1147
+ <?php if ( '' !== $attributes['website'] && $attributes['showWebsite'] ): ?>
1148
+ <div class="mpp-profile-view-website" style="background: <?php echo esc_attr( $attributes['profileWebsiteBackgroundColor'] ); ?>; color: <?php echo esc_attr( $attributes['profileWebsiteTextColor'] ); ?>; width: 90%; margin: 0 auto 0 auto; font-size: <?php echo esc_attr( $attributes['buttonFontSize'] ); ?>px;">
1149
+ <a href="<?php echo esc_url( $attributes['website'] ); ?>" style="color: <?php echo esc_attr( $attributes['profileWebsiteTextColor'] ); ?>; background: <?php echo esc_attr( $attributes['profileWebsiteBackgroundColor'] ); ?>;"><?php esc_html_e( 'View Website', 'metronet-profile-picture' ); ?></a>
1150
+ </div><!-- .mpp-profile-view-posts -->
1151
+ <?php endif; ?>
1152
+
1153
+ </div>
1154
+ <?php endif; /* Compact theme end */ ?>
1155
+ <?php if ( true == $attributes['showSocialMedia'] && ( 'regular' === $attributes['theme'] || 'compact' === $attributes['theme'] || 'profile' === $attributes['theme'] ) ) : ?>
1156
+ <?php echo mpp_get_social_icons( $attributes ); ?>
1157
+ <?php endif; ?>
1158
+ </div><!-- .mpp-profile-gutenberg-wrap -->
1159
+ </div><!-- .mpp-profile-wrap -->
1160
+ <?php endif; ?>
1161
+ <?php if ( 'tabbed' === $attributes['theme'] ): ?>
1162
+ <style>
1163
+ .mpp-author-tabbed ul.mpp-author-tabs li.active:after {
1164
+ border-top: 10px solid <?php echo esc_attr( $attributes['profileTabColor'] ); ?>;
1165
+ border-top-color: <?php echo esc_attr( $attributes['profileTabColor'] ); ?>;
1166
+ }
1167
+ .mpp-author-tabbed ul.mpp-author-tabs li.mpp-tab-posts.active:after {
1168
+ border-top: 10px solid <?php echo esc_attr( $attributes['profileTabPostsColor'] ); ?>;
1169
+ border-top-color: <?php echo esc_attr( $attributes['profileTabPostsColor'] ); ?>;
1170
+ }
1171
+ </style>
1172
+ <div class="mpp-author-tabbed tabbed <?php echo esc_attr( $attributes['profileAvatarShape'] ); ?> mpp-block-profile">
1173
+ <ul class="mpp-author-tabs">
1174
+ <li class="mpp-tab-profile active mpp-gutenberg-tab" data-tab="mpp-profile-tab" style="background: <?php echo esc_attr( $attributes['profileTabColor'] ); ?>; color: <?php echo esc_attr( $attributes['profileTabTextColor'] ); ?>;">
1175
+ <?php echo wp_kses_post( $attributes['tabbedAuthorProfile'] ); ?>
1176
+ </li>
1177
+ <li class="mpp-tab-posts mpp-gutenberg-tab" data-tab="mpp-latestposts-tab" style="background: <?php echo esc_attr( $attributes['profileTabPostsColor'] ); ?>; color: <?php echo esc_attr( $attributes['profileTabPostsTextColor'] ); ?>;">
1178
+ <?php echo wp_kses_post( $attributes['tabbedAuthorLatestPosts'] ); ?>
1179
+ </li>
1180
+ </ul>
1181
+ <div class="mpp-tab-wrapper" style="<?php echo $attributes['padding'] > 0 ? 'padding: ' . esc_attr( $attributes['padding'] ) . 'px;' : ''?><?php echo $attributes['border'] > 0 ? 'border:' . esc_attr( $attributes['border'] ) . 'px solid ' . esc_attr( $attributes['borderColor'] ) . ';' : ''?><?php echo $attributes['borderRounded'] > 0 ? 'border-radius:' . esc_attr( $attributes['borderRounded'] ) . 'px;': ''?>background-color: <?php echo esc_attr( $attributes['profileBackgroundColor'] ) . ';'; ?> color: <?php echo esc_attr( $attributes['profileTextColor'] ) . ';' ?>">
1182
+ <div class="mpp-tab-active mpp-profile-tab mpp-tab">
1183
+ <div class="mpp-author-social-wrapper">
1184
+ <div class="mpp-author-heading">
1185
+ <div class="mpp-author-profile-heading" style="background: <?php echo esc_attr( $attributes['profileTabHeadlineColor'] ); ?>; color: <?php echo esc_attr( $attributes['profileTabHeadlineTextColor'] ); ?>;">
1186
+ <?php echo wp_kses_post( $attributes['tabbedAuthorProfileHeading'] ); ?>
1187
+ </div><!-- .mpp-author-heading -->
1188
+ </div><!-- .mpp-author-social-wrapper -->
1189
+ <?php if( $attributes['showSocialMedia'] ): ?>
1190
+ <div class="mpp-author-social">
1191
+ <?php echo mpp_get_social_icons( $attributes ); ?>
1192
+ </div>
1193
+ <?php endif; ?>
1194
+ </div><!-- .mpp-author-social-wrapper -->
1195
+ <div class="mpp-profile-image-wrapper">
1196
+ <div class="mpp-profile-image-square">
1197
+ <img class="profile-avatar" alt="avatar" src="<?php echo esc_url( $attributes['profileImgURL'] ); ?>">
1198
+ <div class="mpp-author-profile-sub-heading">
1199
+ <?php echo wp_kses_post( $attributes['tabbedAuthorSubHeading'] ); ?>
1200
+ </div>
1201
+ </div><!-- .mpp-profile-image-square -->
1202
+ </div><!-- .mpp-profile-image-wrapper -->
1203
+ <div class="mpp-tabbed-profile-information">
1204
+ <?php if( $attributes['showTitle'] || '' !== $attributes['tabbedAuthorProfileTitle'] ): ?>
1205
+ <?php echo '<div>' . wp_kses_post( $attributes['tabbedAuthorProfileTitle'] ) . '</div>'; ?>
1206
+ <?php endif; ?>
1207
+ <?php if( $attributes['showName'] ): ?>
1208
+ <h2 style="color: <?php echo esc_attr( $attributes['profileTextColor'] ); ?>; font-size: <?php echo esc_attr( $attributes['headerFontSize'] ) . 'px;'; ?>"><?php echo wp_kses_post( $attributes['profileName'] ); ?></h2>
1209
+ <?php endif; ?>
1210
+ <?php if( $attributes['showDescription'] ): ?>
1211
+ <div class="mpp-profile-text mt-font-size-<?php echo esc_attr( $attributes['profileFontSize'] ); ?>">
1212
+ <?php echo wp_kses_post( $attributes['profileContent'] ); ?>
1213
+ </div>
1214
+ <?php endif; ?>
1215
+ </div><!-- .mpp-tabbed-profile-information -->
1216
+ </div><!-- first profile tab -->
1217
+ <div class="mpp-tabbed-latest-posts mpp-latestposts-tab mpp-tab">
1218
+ <?php
1219
+ $args = array(
1220
+ 'post_type' => 'post',
1221
+ 'post_status' => 'publish',
1222
+ 'author' => $user_id,
1223
+ 'orderby' => 'date',
1224
+ 'order' => 'DESC',
1225
+ 'posts_per_page' => 5
1226
+ );
1227
+ $posts = get_posts( $args );
1228
+ ?>
1229
+ <ul class="mpp-author-tab-content <?php echo esc_attr( $attributes['profileLatestPostsOptionsValue']); ?>">
1230
+ <?php
1231
+ foreach( $posts as $post ) {
1232
+ printf( "<li><a href='%s'>%s</a></li>", esc_url( get_permalink( $post->ID ) ), esc_html( $post->post_title ) );
1233
+ }
1234
+ ?>
1235
+ </ul>
1236
+ </div><!-- .mpp-tabbed-latest-posts -->
1237
+ </div><!-- mpp-tab-wrapper -->
1238
+ </div><!-- .mpp-author-tabbed -->
1239
+
1240
+ <?php endif; ?>
1241
+ <?php
1242
+ wp_enqueue_style( 'mpp_gutenberg', Metronet_Profile_Picture::get_plugin_url( '/css/front-end-gutenberg.css' ), array(), METRONET_PROFILE_PICTURE_VERSION, 'all' );
1243
+ wp_enqueue_script('mpp_gutenberg_tabs', Metronet_Profile_Picture::get_plugin_url('js/mpp-frontend'.$min_or_not.'.js'), array('jquery'), METRONET_PROFILE_PICTURE_VERSION, true);
1244
+ add_action( 'wp_footer', 'mpp_load_gutenblock_svgs' );
1245
+ echo ob_get_clean();
1246
+ }
1247
+ /**
1248
+ * mpp_get_social_icons
1249
+ *
1250
+ * Get social icons based on passed attributes
1251
+ *
1252
+ * @see mt_author_box for attribute valies
1253
+ *
1254
+ * @since 2.2.0
1255
+ *
1256
+ * @param array $attributes See defaults in function mt_author_box for all attributes
1257
+ *
1258
+ * @return string User social icons
1259
+ *
1260
+ */
1261
+ function mpp_get_social_icons( $attributes ) {
1262
+ ob_start();
1263
+ ?>
1264
+ <div class="mpp-social">
1265
+ <?php if( !empty( $attributes['socialFacebook'] ) ): ?>
1266
+ <a href="<?php echo esc_url( $attributes['socialFacebook'] ); ?>">
1267
+ <svg class="icon icon-facebook" role="img" style="<?php echo 'custom' === $attributes['socialMediaOptions'] ? 'fill:' . esc_attr( $attributes['socialMediaColors'] ) . ';': ''; ?>">
1268
+ <use href="#facebook"></use>
1269
+ </svg>
1270
+ </a>
1271
+ <?php endif; ?>
1272
+ <?php if( !empty( $attributes['socialTwitter'] ) ): ?>
1273
+ <a href="<?php echo esc_url( $attributes['socialTwitter'] ); ?>">
1274
+ <svg class="icon icon-twitter" role="img" style="<?php echo 'custom' === $attributes['socialMediaOptions'] ? 'fill:' . esc_attr( $attributes['socialMediaColors'] ) . ';': ''; ?>">
1275
+ <use href="#twitter"></use>
1276
+ </svg>
1277
+ </a>
1278
+ <?php endif; ?>
1279
+ <?php if( !empty( $attributes['socialInstagram'] ) ): ?>
1280
+ <a href="<?php echo esc_url( $attributes['socialInstagram'] ); ?>">
1281
+ <svg class="icon icon-instagram" role="img" style="<?php echo 'custom' === $attributes['socialMediaOptions'] ? 'fill:' . esc_attr( $attributes['socialMediaColors'] ) . ';': ''; ?>">
1282
+ <use href="#instagram"></use>
1283
+ </svg>
1284
+ </a>
1285
+ <?php endif; ?>
1286
+ <?php if( !empty( $attributes['socialPinterest'] ) ): ?>
1287
+ <a href="<?php echo esc_url( $attributes['socialPinterest'] ); ?>">
1288
+ <svg class="icon icon-pinterest" role="img" style="<?php echo 'custom' === $attributes['socialMediaOptions'] ? 'fill:' . esc_attr( $attributes['socialMediaColors'] ) . ';': ''; ?>">
1289
+ <use href="#pinterest"></use>
1290
+ </svg>
1291
+ </a>
1292
+ <?php endif; ?>
1293
+ <?php if( !empty( $attributes['socialLinkedIn'] ) ): ?>
1294
+ <a href="<?php echo esc_url( $attributes['socialLinkedIn'] ); ?>">
1295
+ <svg class="icon icon-linkedin" role="img" style="<?php echo 'custom' === $attributes['socialMediaOptions'] ? 'fill:' . esc_attr( $attributes['socialMediaColors'] ) . ';': ''; ?>">
1296
+ <use href="#linkedin"></use>
1297
+ </svg>
1298
+ </a>
1299
+ <?php endif; ?>
1300
+ <?php if( !empty( $attributes['socialYouTube'] ) ): ?>
1301
+ <a href="<?php echo esc_url( $attributes['socialYouTube'] ); ?>">
1302
+ <svg class="icon icon-youtube" role="img" style="<?php echo 'custom' === $attributes['socialMediaOptions'] ? 'fill:' . esc_attr( $attributes['socialMediaColors'] ) . ';': ''; ?>">
1303
+ <use href="#youtube"></use>
1304
+ </svg>
1305
+ </a>
1306
+ <?php endif; ?>
1307
+ <?php if( !empty( $attributes['socialGitHub'] ) ): ?>
1308
+ <a href="<?php echo esc_url( $attributes['socialGitHub'] ); ?>">
1309
+ <svg class="icon icon-github" role="img" style="<?php echo 'custom' === $attributes['socialMediaOptions'] ? 'fill:' . esc_attr( $attributes['socialMediaColors'] ) . ';': ''; ?>">
1310
+ <use href="#github"></use>
1311
+ </svg>
1312
+ </a>
1313
+ <?php endif; ?>
1314
+ <?php if( !empty( $attributes['socialWordPress'] ) ): ?>
1315
+ <a href="<?php echo esc_url( $attributes['socialWordPress'] ); ?>">
1316
+ <svg class="icon icon-wordpress" role="img" style="<?php echo 'custom' === $attributes['socialMediaOptions'] ? 'fill:' . esc_attr( $attributes['socialMediaColors'] ) . ';': ''; ?>">
1317
+ <use href="#wordpress"></use>
1318
+ </svg>
1319
+ </a>
1320
+ <?php endif; ?>
1321
+ </div><!-- .mpp-social -->
1322
+ <?php
1323
+ return ob_get_clean();
1324
+ }
1325
+ /**
1326
+ * mpp_load_gutenblock_svgs
1327
+ *
1328
+ * Load social icons in footer of theme
1329
+ *
1330
+ * @since 2.2.0
1331
+ *
1332
+ * @return html Echo sprite for social icons
1333
+ *
1334
+ */
1335
+ function mpp_load_gutenblock_svgs() {
1336
+ if ( '' != get_post_type() ) {
1337
+ // Define SVG sprite file.
1338
+ $path = '/img/social-logos.svg';
1339
+ $svg_icons = rtrim( dirname( plugin_dir_path(__FILE__) ), '/' );
1340
+ if ( ! empty( $path ) && is_string( $path) ) {
1341
+ $svg_icons .= '/' . ltrim( $path, '/' );
1342
+ }
1343
+
1344
+ /**
1345
+ * Filter Social Icons Sprite.
1346
+ *
1347
+ * @since 2.1.0
1348
+ *
1349
+ * @param string Absolute directory path to SVG sprite
1350
+ */
1351
+ $svg_icons = apply_filters( 'mpp_icons_sprite', $svg_icons );
1352
+ // If it exists, include it.
1353
+ if ( file_exists( $svg_icons ) ) {
1354
+ echo '<div style="position: absolute; height: 0; width: 0; overflow: hidden;">';
1355
+ require( $svg_icons );
1356
+ echo '</div>';
1357
+ }
1358
+ }
1359
+ }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: ronalfy, Alaadiaa
3
  Tags: users, user profile, gravatar, avatar, blocks, block
4
  Requires at least: 3.5
5
- Tested up to: 5.1
6
- Stable tag: 2.1.3
7
  Requires PHP: 5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -69,6 +69,23 @@ if (function_exists ( 'mt_profile_img' ) ) {
69
  }
70
  ?>
71
  `
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  View the code on <a href="https://github.com/ronalfy/user-profile-picture">GitHub</a>.
73
 
74
  The REST API is currently supported for versions of WordPress 4.4 and up.
@@ -105,6 +122,10 @@ Yes, but you'll have to set a new profile image per site. This is currently a l
105
 
106
  == Changelog ==
107
 
 
 
 
 
108
  = 2.1.3 =
109
  * Released 2019-02-16
110
  * Added filter to get users in Gutenberg besides author
@@ -269,6 +290,9 @@ Yes, but you'll have to set a new profile image per site. This is currently a l
269
 
270
  == Upgrade Notice ==
271
 
 
 
 
272
  = 2.1.3 =
273
  Added filter to get users in Gutenberg besides author
274
 
2
  Contributors: ronalfy, Alaadiaa
3
  Tags: users, user profile, gravatar, avatar, blocks, block
4
  Requires at least: 3.5
5
+ Tested up to: 5.2
6
+ Stable tag: 2.2.0
7
  Requires PHP: 5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
69
  }
70
  ?>
71
  `
72
+
73
+ Since 2.2.0, you can add a profile author box using function `mt_author_box`.
74
+
75
+ `
76
+ <?php
77
+ mt_author_box( $post->post_author, array(
78
+ 'theme' => 'tabbed',
79
+ 'profileAvatarShape' => 'round',
80
+ 'showWebsite' => true,
81
+ 'website' => 'https://www.ronalfy.com',
82
+ 'showSocialMedia' => true,
83
+ 'socialMediaOptions' => 'brand',
84
+ 'socialWordPress' => 'https://profiles.wordpress.org/ronalfy',
85
+ 'socialFacebook' => 'https://facebook.com/mindefusement',
86
+ ) );
87
+ `
88
+
89
  View the code on <a href="https://github.com/ronalfy/user-profile-picture">GitHub</a>.
90
 
91
  The REST API is currently supported for versions of WordPress 4.4 and up.
122
 
123
  == Changelog ==
124
 
125
+ = 2.2.0 =
126
+ * Released 2019-05-12
127
+ * Added template tags for displaying an author box
128
+
129
  = 2.1.3 =
130
  * Released 2019-02-16
131
  * Added filter to get users in Gutenberg besides author
290
 
291
  == Upgrade Notice ==
292
 
293
+ = 2.2.0 =
294
+ Added template tags for displaying an author box
295
+
296
  = 2.1.3 =
297
  Added filter to get users in Gutenberg besides author
298