Version Description
- Removed deprecated mysql_ function
Download this release
Release Info
| Developer | glen_scott |
| Plugin | |
| Version | 0.9.9 |
| Comparing to | |
| See all releases | |
Code changes from version 0.9.8 to 0.9.9
- readme.txt +5 -2
- user-photo.php +32 -26
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: westonruter, ryanhellyer, glen_scott
|
| 3 |
Tags: users, photos, images
|
| 4 |
Requires at least: 3.0.5
|
| 5 |
-
Tested up to: 4.
|
| 6 |
-
Stable tag: 0.9.
|
| 7 |
|
| 8 |
Allows a user to associate a photo with their account and for this photo to be displayed in their posts and comments.
|
| 9 |
|
|
@@ -114,6 +114,9 @@ If you value this plugin, *please donate* to ensure that it may continue to be m
|
|
| 114 |
|
| 115 |
== Changelog ==
|
| 116 |
|
|
|
|
|
|
|
|
|
|
| 117 |
= 0.9.8 =
|
| 118 |
* Optimised retrieval of administrators for settings page
|
| 119 |
|
| 2 |
Contributors: westonruter, ryanhellyer, glen_scott
|
| 3 |
Tags: users, photos, images
|
| 4 |
Requires at least: 3.0.5
|
| 5 |
+
Tested up to: 4.6
|
| 6 |
+
Stable tag: 0.9.9
|
| 7 |
|
| 8 |
Allows a user to associate a photo with their account and for this photo to be displayed in their posts and comments.
|
| 9 |
|
| 114 |
|
| 115 |
== Changelog ==
|
| 116 |
|
| 117 |
+
= 0.9.9 =
|
| 118 |
+
* Removed deprecated mysql_ function
|
| 119 |
+
|
| 120 |
= 0.9.8 =
|
| 121 |
* Optimised retrieval of administrators for settings page
|
| 122 |
|
user-photo.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: User Photo
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/user-photo/
|
| 5 |
Description: Allows users to associate photos with their accounts by accessing their "Your Profile" page. Uploaded images are resized to fit the dimensions specified on the options page; a thumbnail image is also generated. New template tags introduced are: <code>userphoto_the_author_photo</code>, <code>userphoto_the_author_thumbnail</code>, <code>userphoto_comment_author_photo</code>, and <code>userphoto_comment_author_thumbnail</code>. Uploaded images may be moderated by administrators.
|
| 6 |
-
Version: 0.9.
|
| 7 |
Author: <a href="http://weston.ruter.net/">Weston Ruter</a>
|
| 8 |
|
| 9 |
Original code by Weston Ruter <http://weston.ruter.net> at Shepherd Interactive <http://shepherd-interactive.com>.
|
|
@@ -97,10 +97,16 @@ function userphoto_filter_get_avatar($avatar, $id_or_email, $size, $default){
|
|
| 97 |
$id_or_email = $id_or_email->comment_author_email;
|
| 98 |
}
|
| 99 |
|
| 100 |
-
if(is_numeric($id_or_email))
|
| 101 |
$userid = (int)$id_or_email;
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
if(!$userid)
|
| 106 |
return $avatar;
|
|
@@ -324,7 +330,7 @@ function userphoto_profile_update($userID){
|
|
| 324 |
|
| 325 |
#Delete photo
|
| 326 |
if(@$_POST['userphoto_delete']){
|
| 327 |
-
|
| 328 |
if($userdata->userphoto_image_file){
|
| 329 |
$upload_dir = wp_upload_dir();
|
| 330 |
$bdir = trailingslashit($upload_dir['basedir']) . 'userphoto/';
|
|
@@ -332,17 +338,17 @@ function userphoto_profile_update($userID){
|
|
| 332 |
$thumbpath = $bdir . basename($userdata->userphoto_thumb_file);
|
| 333 |
|
| 334 |
if(file_exists($imagepath) && !@unlink($imagepath)){
|
| 335 |
-
|
| 336 |
}
|
| 337 |
else {
|
| 338 |
@unlink($thumbpath);
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
}
|
| 347 |
}
|
| 348 |
}
|
|
@@ -450,7 +456,7 @@ function userphoto_profile_update($userID){
|
|
| 450 |
|
| 451 |
#Update usermeta
|
| 452 |
if($current_user->user_level <= get_option('userphoto_level_moderated') ){
|
| 453 |
-
|
| 454 |
|
| 455 |
$admin_notified = get_option('userphoto_admin_notified');
|
| 456 |
if($admin_notified){
|
|
@@ -461,14 +467,14 @@ function userphoto_profile_update($userID){
|
|
| 461 |
}
|
| 462 |
}
|
| 463 |
else {
|
| 464 |
-
|
| 465 |
}
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
|
| 473 |
//Delete old thumbnail if it has a different filename (extension)
|
| 474 |
if($oldimagefile != $imagefile)
|
|
@@ -485,18 +491,18 @@ function userphoto_profile_update($userID){
|
|
| 485 |
array_key_exists('userphoto_approvalstatus', $_POST) &&
|
| 486 |
in_array((int)$_POST['userphoto_approvalstatus'], array(USERPHOTO_PENDING, USERPHOTO_REJECTED, USERPHOTO_APPROVED))
|
| 487 |
){
|
| 488 |
-
|
| 489 |
if((int)$_POST['userphoto_approvalstatus'] == USERPHOTO_REJECTED)
|
| 490 |
-
|
| 491 |
else
|
| 492 |
-
|
| 493 |
}
|
| 494 |
}
|
| 495 |
|
| 496 |
if($error)
|
| 497 |
-
|
| 498 |
else
|
| 499 |
-
|
| 500 |
}
|
| 501 |
add_action('profile_update', 'userphoto_profile_update');
|
| 502 |
#add_action('personal_options_update', ???);
|
| 3 |
Plugin Name: User Photo
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/user-photo/
|
| 5 |
Description: Allows users to associate photos with their accounts by accessing their "Your Profile" page. Uploaded images are resized to fit the dimensions specified on the options page; a thumbnail image is also generated. New template tags introduced are: <code>userphoto_the_author_photo</code>, <code>userphoto_the_author_thumbnail</code>, <code>userphoto_comment_author_photo</code>, and <code>userphoto_comment_author_thumbnail</code>. Uploaded images may be moderated by administrators.
|
| 6 |
+
Version: 0.9.9
|
| 7 |
Author: <a href="http://weston.ruter.net/">Weston Ruter</a>
|
| 8 |
|
| 9 |
Original code by Weston Ruter <http://weston.ruter.net> at Shepherd Interactive <http://shepherd-interactive.com>.
|
| 97 |
$id_or_email = $id_or_email->comment_author_email;
|
| 98 |
}
|
| 99 |
|
| 100 |
+
if ( is_numeric( $id_or_email ) ) {
|
| 101 |
$userid = (int)$id_or_email;
|
| 102 |
+
}
|
| 103 |
+
else if ( is_string( $id_or_email ) ) {
|
| 104 |
+
$userid = (int)$wpdb->get_var(
|
| 105 |
+
$wpdb->prepare(
|
| 106 |
+
"SELECT ID FROM $wpdb->users WHERE user_email = %s", $id_or_email
|
| 107 |
+
)
|
| 108 |
+
);
|
| 109 |
+
}
|
| 110 |
|
| 111 |
if(!$userid)
|
| 112 |
return $avatar;
|
| 330 |
|
| 331 |
#Delete photo
|
| 332 |
if(@$_POST['userphoto_delete']){
|
| 333 |
+
delete_user_meta($userID, "userphoto_error");
|
| 334 |
if($userdata->userphoto_image_file){
|
| 335 |
$upload_dir = wp_upload_dir();
|
| 336 |
$bdir = trailingslashit($upload_dir['basedir']) . 'userphoto/';
|
| 338 |
$thumbpath = $bdir . basename($userdata->userphoto_thumb_file);
|
| 339 |
|
| 340 |
if(file_exists($imagepath) && !@unlink($imagepath)){
|
| 341 |
+
update_user_meta($userID, 'userphoto_error', __("Unable to delete photo.", 'user-photo'));
|
| 342 |
}
|
| 343 |
else {
|
| 344 |
@unlink($thumbpath);
|
| 345 |
+
delete_user_meta($userID, "userphoto_approvalstatus");
|
| 346 |
+
delete_user_meta($userID, "userphoto_image_file");
|
| 347 |
+
delete_user_meta($userID, "userphoto_image_width");
|
| 348 |
+
delete_user_meta($userID, "userphoto_image_height");
|
| 349 |
+
delete_user_meta($userID, "userphoto_thumb_file");
|
| 350 |
+
delete_user_meta($userID, "userphoto_thumb_width");
|
| 351 |
+
delete_user_meta($userID, "userphoto_thumb_height");
|
| 352 |
}
|
| 353 |
}
|
| 354 |
}
|
| 456 |
|
| 457 |
#Update usermeta
|
| 458 |
if($current_user->user_level <= get_option('userphoto_level_moderated') ){
|
| 459 |
+
update_user_meta($userID, "userphoto_approvalstatus", USERPHOTO_PENDING);
|
| 460 |
|
| 461 |
$admin_notified = get_option('userphoto_admin_notified');
|
| 462 |
if($admin_notified){
|
| 467 |
}
|
| 468 |
}
|
| 469 |
else {
|
| 470 |
+
update_user_meta($userID, "userphoto_approvalstatus", USERPHOTO_APPROVED);
|
| 471 |
}
|
| 472 |
+
update_user_meta($userID, "userphoto_image_file", $imagefile); //TODO: use userphoto_image
|
| 473 |
+
update_user_meta($userID, "userphoto_image_width", $imageinfo[0]); //TODO: use userphoto_image_width
|
| 474 |
+
update_user_meta($userID, "userphoto_image_height", $imageinfo[1]);
|
| 475 |
+
update_user_meta($userID, "userphoto_thumb_file", $thumbfile);
|
| 476 |
+
update_user_meta($userID, "userphoto_thumb_width", $thumbinfo[0]);
|
| 477 |
+
update_user_meta($userID, "userphoto_thumb_height", $thumbinfo[1]);
|
| 478 |
|
| 479 |
//Delete old thumbnail if it has a different filename (extension)
|
| 480 |
if($oldimagefile != $imagefile)
|
| 491 |
array_key_exists('userphoto_approvalstatus', $_POST) &&
|
| 492 |
in_array((int)$_POST['userphoto_approvalstatus'], array(USERPHOTO_PENDING, USERPHOTO_REJECTED, USERPHOTO_APPROVED))
|
| 493 |
){
|
| 494 |
+
update_user_meta($userID, "userphoto_approvalstatus", (int)$_POST['userphoto_approvalstatus']);
|
| 495 |
if((int)$_POST['userphoto_approvalstatus'] == USERPHOTO_REJECTED)
|
| 496 |
+
update_user_meta($userID, "userphoto_rejectionreason", $_POST['userphoto_rejectionreason']);
|
| 497 |
else
|
| 498 |
+
delete_user_meta($userID, "userphoto_rejectionreason");
|
| 499 |
}
|
| 500 |
}
|
| 501 |
|
| 502 |
if($error)
|
| 503 |
+
update_user_meta($userID, 'userphoto_error', $error);
|
| 504 |
else
|
| 505 |
+
delete_user_meta($userID, "userphoto_error");
|
| 506 |
}
|
| 507 |
add_action('profile_update', 'userphoto_profile_update');
|
| 508 |
#add_action('personal_options_update', ???);
|
