Skip to content

Commit 36757e7

Browse files
committed
Support for PHP 8 and more changes.
-Compatibility extended up to PHP 8. -Disable Gravatar function added. -Default avatar can be add anymore. -Some bugs fixed. -Some design changes have been made.
1 parent 69e093e commit 36757e7

18 files changed

+446
-155
lines changed

about.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
** about.php
5-
** @version 1.2.1
5+
** @version 1.3
66
** @since 1.0
77
** @author en0ndev
88
*/
@@ -25,8 +25,8 @@
2525
defined('ABSPATH') || exit; // Exit if accessed directly
2626

2727
$template = "<div class='about'><img src='" . plugin_dir_url(__FILE__) . "/assets/img/icon-128x128.png' alt='Custom Profile Avatar' /><p class='big'>Custom Profile Avatar</p>";
28-
$template .= "<p>" . esc_html__('Version', 'custom-profile-avatar') . ": 1.2.1</p>";
29-
$template .= "<p>" . esc_html__('Developer', 'custom-profile-avatar') . ": en0ndev</p>";
28+
$template .= "<p>" . esc_html__('Version', 'custom-profile-avatar') . ": 1.3</p>";
29+
$template .= "<p>" . esc_html__('Developer', 'custom-profile-avatar') . ": <a class='about__author link' href='https://github.com/en0ndev' target='_blank'>en0ndev</a></p>";
3030
$template .= "<a class='link' target='_blank' href='https://www.youtube.com/channel/UC3CSOAThanO-LvYKFwJ24RQ'>" . esc_html__('My YouTube Channel', 'custom-profile-avatar') . "</a></div>";
3131

3232
$page = new cpa__page__template;

assets/css/style.css

Lines changed: 92 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
** File: style.css
3-
** Version: 1.2.1
3+
** Version: 1.3
44
** Since: 1.0
55
** Author: en0ndev
66
@@ -20,23 +20,29 @@ You should have received a copy of the GNU General Public License
2020
along with Custom Profile Avatar. If not, see <https://www.gnu.org/licenses/>.
2121
*/
2222

23-
@import url("https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,500;0,700;1,300&display=swap");
23+
/*@import url("https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,500;0,700;1,300&display=swap");*/
24+
25+
/*@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@200;400;600&display=swap");*/
26+
27+
@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600&display=swap");
28+
2429
body {
2530
background: #ddd;
2631
user-select: none;
2732
line-height: normal !important;
2833
}
2934

30-
#wpbody * {
35+
#wpbody *,
36+
#author__by {
3137
line-height: normal !important;
32-
font-family: "Ubuntu", sans-serif;
38+
font-family: "Quicksand", sans-serif;
3339
}
3440

3541
#author__by {
3642
background: #000;
37-
padding: 5px 20px;
43+
padding: 10px 35px;
3844
border-radius: 30px;
39-
box-shadow: 1px 1px 5px 1px rgba(0, 0, 0, 0.6);
45+
box-shadow: 1px 1px 5px 1px rgba(0, 0, 0, 0.5);
4046
position: absolute;
4147
left: 11px;
4248
bottom: 11px;
@@ -51,7 +57,8 @@ body {
5157
#author__by .bold {
5258
color: #fff;
5359
font-weight: 700;
54-
padding: 1px 0;
60+
padding: 0 2px;
61+
margin: 0 5px;
5562
}
5663

5764
#author__by .bold:hover {
@@ -65,7 +72,7 @@ body {
6572
/*justify-content: center;*/
6673
flex-direction: column;
6774
text-align: center;
68-
padding-top: 20px;
75+
padding: 40px 0;
6976
}
7077

7178
.main__area h1,
@@ -84,7 +91,7 @@ input[type="button"],
8491

8592
.inner__area {
8693
width: 800px;
87-
height: 300px;
94+
max-height: 600px;
8895
background: #f8f8f8;
8996
border-radius: 10px;
9097
margin-top: 20px;
@@ -110,8 +117,12 @@ input[type="button"],
110117
background: rgb(150, 0, 0);
111118
color: #fff;
112119
padding: 3px 15px;
113-
margin-bottom: 40px;
114-
display: inline-block;
120+
margin: 40px 0;
121+
display: block;
122+
}
123+
124+
.main__area .info__card:first-child {
125+
margin-top: 0;
115126
}
116127

117128
.inner__area h2 {
@@ -165,6 +176,8 @@ input[type="button"],
165176
justify-content: center;
166177
align-items: center;
167178
flex-direction: column;
179+
width: min-content;
180+
margin: 0 auto;
168181
}
169182

170183
.remove {
@@ -225,17 +238,30 @@ input[type="button"],
225238
border-bottom: 4px solid #2271b1;
226239
}
227240

241+
.about > p > .about__author.link {
242+
color: #000;
243+
text-decoration: none;
244+
padding: 2px 0;
245+
border-bottom: 2px solid #000;
246+
}
247+
248+
.about > p > .about__author.link:hover {
249+
border-bottom: 4px solid #000;
250+
}
251+
228252
#notf {
229253
position: absolute;
230254
right: 15px;
231-
top: 15px;
232-
box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.3);
255+
top: 2.5px;
256+
box-shadow: 1px 1px 8px -1px rgba(0, 0, 0, 0.3);
233257
padding: 10px 2em;
234-
border-radius: 5px;
258+
border-radius: 3px;
235259
color: #000;
236260
background: #fff;
237261
font-weight: 500;
238262
font-size: 16px;
263+
display: none;
264+
transition: transform 0.6s;
239265
}
240266

241267
.scs {
@@ -267,47 +293,92 @@ input[type="button"],
267293
/* for .rate__box */
268294
}
269295

270-
.checkbox__area {
296+
.checkbox__area,
297+
.checkbox__area__single {
271298
display: flex;
272-
/*justify-content: space-between;*/
299+
justify-content: space-evenly;
300+
padding-bottom: 20px;
273301
}
274302

275303
.user__permissions {
276304
display: block;
277305
}
278306

279-
.user__permissions .permission__cont {
307+
.user__permissions .checkbox__area label {
280308
/*margin-left: 15px;*/
281309
/*margin-right: 15px;*/
282310
display: inline-flex;
283311
flex-direction: column;
284312
align-items: center;
285313
/*margin: 0 auto;*/
286314
position: relative;
287-
margin: 0 25px;
315+
margin: 0 15px;
288316
}
289317

290-
.user__permissions .permission__cont span {
318+
.user__permissions .checkbox__area label span {
291319
font-size: 10pt;
292320
position: absolute;
293321
bottom: -20px;
294322
white-space: nowrap;
295323
}
296324

297-
.user__permissions .permission__cont input {
325+
.user__permissions .checkbox__area label input {
298326
width: 50px;
299327
height: 50px;
300328
border: none;
301329
box-shadow: 1px 1px 8px -4px rgba(35, 35, 35, 0.75);
302330
margin: 0 !important;
303331
}
304332

305-
.user__permissions .permission__cont input:checked::before {
333+
.user__permissions .checkbox__area .permission__cont input:checked::before {
306334
width: 50px !important;
307335
height: 50px !important;
308336
margin: 0 !important;
309337
}
310338

339+
.user__permissions .checkbox__area__single label {
340+
width: 85px;
341+
height: 35px;
342+
border-radius: 30px;
343+
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.3);
344+
overflow: hidden;
345+
position: relative;
346+
}
347+
348+
.user__permissions .checkbox__area__single label span {
349+
width: 100%;
350+
height: 100%;
351+
background-color: #dadada;
352+
display: inline-block;
353+
transition: background 0.5s;
354+
}
355+
356+
.user__permissions .checkbox__area__single label span::before {
357+
content: "";
358+
width: 25px;
359+
height: 25px;
360+
border-radius: 50%;
361+
box-shadow: 1px 1px 4px -1px rgba(0, 0, 0, 0.3);
362+
background-color: #ffffff;
363+
display: block;
364+
transition: transform 0.5s;
365+
position: absolute;
366+
left: 5px;
367+
top: 5px;
368+
}
369+
370+
.user__permissions .checkbox__area__single label input {
371+
display: none;
372+
}
373+
374+
.user__permissions .checkbox__area__single label input:checked + span {
375+
background-color: #2ab600;
376+
}
377+
378+
.user__permissions .checkbox__area__single label input:checked + span::before {
379+
transform: translateX(50px);
380+
}
381+
311382
#change {
312383
background-color: transparent;
313384
box-shadow: none;
3.26 KB
Loading

assets/js/modules.js

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
** File: modules.js
3-
** Version: 1.2.1
3+
** Version: 1.3
44
** Since: 1.0
55
** Author: en0ndev
66
This file is part of Custom Profile Avatar.
@@ -19,40 +19,49 @@ You should have received a copy of the GNU General Public License
1919
along with Custom Profile Avatar. If not, see <https://www.gnu.org/licenses/>.
2020
*/
2121

22-
jQuery(document).ready(function($) {
23-
var mediaUploader;
24-
$('#change').click(function(e) {
25-
e.preventDefault();
26-
// If the uploader object has already been created, reopen the dialog
27-
if (mediaUploader) {
28-
mediaUploader.open();
29-
return;
30-
}
31-
// Extend the wp.media object
32-
mediaUploader = wp.media.frames.file_frame = wp.media({
33-
title: 'Choose Your Custom Profile Avatar',
34-
button: {
35-
text: 'Choose'
36-
},
37-
multiple: false,
38-
library: {
39-
type: ['image']
40-
},
41-
});
42-
// When a file is selected, grab the URL and set it as the text field's value
43-
mediaUploader.on('select', function() {
44-
attachment = mediaUploader.state().get('selection').first().toJSON();
45-
$('.user__avatar > .avatar').attr('src', attachment.url);
46-
$('input[name="avatar__val"]').attr('value', attachment.url);
47-
if (!$('.user__avatar').children().hasClass('remove')) { $('.user__avatar > .avatar').after('<div class="remove"></div>') };
48-
});
49-
// Open the uploader dialog
50-
mediaUploader.open();
22+
jQuery(document).ready(function ($) {
23+
var mediaUploader;
24+
$("#change").click(function (e) {
25+
e.preventDefault();
26+
// If the uploader object has already been created, reopen the dialog
27+
if (mediaUploader) {
28+
mediaUploader.open();
29+
return;
30+
}
31+
// Extend the wp.media object
32+
mediaUploader = wp.media.frames.file_frame = wp.media({
33+
title: "Choose Your Custom Profile Avatar",
34+
button: {
35+
text: "Choose",
36+
},
37+
multiple: false,
38+
library: {
39+
type: ["image"],
40+
},
5141
});
52-
$(document).on('click', '.remove', function() {
53-
var pull = $('#pull > img').attr('src');
54-
$('.user__avatar .avatar').attr('src', pull);
55-
$('input[name="avatar__val"]').removeAttr('value');
56-
$(this).remove();
42+
// When a file is selected, grab the URL and set it as the text field's value
43+
mediaUploader.on("select", function () {
44+
attachment = mediaUploader.state().get("selection").first().toJSON();
45+
$(".user__avatar > .avatar").attr("src", attachment.url);
46+
$('input[name="avatar__val"]').attr("value", attachment.url);
47+
if (!$(".user__avatar").children().hasClass("remove")) {
48+
$(".user__avatar > .avatar").after('<div class="remove"></div>');
49+
}
5750
});
58-
});
51+
// Open the uploader dialog
52+
mediaUploader.open();
53+
});
54+
$(document).on("click", ".remove", function () {
55+
var pull = $("#pull > img").attr("src");
56+
$(".user__avatar .avatar").attr("src", pull);
57+
$('input[name="avatar__val"]').removeAttr("value");
58+
$(this).remove();
59+
});
60+
$(document).on("click", "[name='disable__gravatar']", function () {
61+
if ($(this).is(":checked")) {
62+
$(".collapse__disable__avatar").fadeIn(500);
63+
} else {
64+
$(".collapse__disable__avatar").fadeOut(500);
65+
}
66+
});
67+
});

0 commit comments

Comments
 (0)