aboutsummaryrefslogtreecommitdiffstats
path: root/mod/profile_photo.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/profile_photo.php')
-rw-r--r--mod/profile_photo.php24
1 files changed, 6 insertions, 18 deletions
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index 597b5f66d..79f84c690 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -143,7 +143,7 @@ function profile_photo_post(&$a) {
'filename' => $base_image['filename'], 'album' => t('Profile Photos'));
$p['scale'] = 4;
- $p['photo_flags'] = (($is_default_profile) ? PHOTO_PROFILE : PHOTO_NORMAL);
+ $p['photo_usage'] = (($is_default_profile) ? PHOTO_PROFILE : PHOTO_NORMAL);
$r1 = $im->save($p);
@@ -170,13 +170,9 @@ function profile_photo_post(&$a) {
// If setting for the default profile, unset the profile photo flag from any other photos I own
if($is_default_profile) {
- $r = q("UPDATE photo SET profile = 0 WHERE profile = 1 AND resource_id != '%s' AND `uid` = %d",
- dbesc($base_image['resource_id']),
- intval(local_channel())
- );
- $r = q("UPDATE photo SET photo_flags = ( photo_flags & ~%d ) WHERE ( photo_flags & %d )>0
+ $r = q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d
AND resource_id != '%s' AND `uid` = %d",
- intval(PHOTO_PROFILE),
+ intval(PHOTO_NORMAL),
intval(PHOTO_PROFILE),
dbesc($base_image['resource_id']),
intval(local_channel())
@@ -301,20 +297,12 @@ function profile_photo_content(&$a) {
if(($r[0]['album'] == t('Profile Photos')) && ($havescale)) {
// unset any existing profile photos
- $r = q("UPDATE photo SET profile = 0 WHERE profile = 1 AND uid = %d",
- intval(local_channel()));
- $r = q("UPDATE photo SET photo_flags = (photo_flags & ~%d ) WHERE (photo_flags & %d )>0 AND uid = %d",
- intval(PHOTO_PROFILE),
+ $r = q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d AND uid = %d",
+ intval(PHOTO_NORMAL),
intval(PHOTO_PROFILE),
intval(local_channel()));
- // set all sizes of this one as profile photos
- $r = q("UPDATE photo SET profile = 1 WHERE uid = %d AND resource_id = '%s'",
- intval(local_channel()),
- dbesc($resource_id)
- );
-
- $r = q("UPDATE photo SET photo_flags = ( photo_flags | %d ) WHERE uid = %d AND resource_id = '%s'",
+ $r = q("UPDATE photo SET photo_usage = %d WHERE uid = %d AND resource_id = '%s'",
intval(PHOTO_PROFILE),
intval(local_channel()),
dbesc($resource_id)