Icy Phoenix

     
 


This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies. 
Page 1 of 1
 
 
Reply with quote Download Post 
Post FAP CUSTOMIZATION - Update pic_username when a user changes username 
 
I don't know whether it was intended to be like this but whenever a user changes his/her username, the pic_username of all their picture prior to the name change stays the same, i.e. when you do a search in the album on the username, it may not find all the pictures of that user... (Anyone know where else pic_username is used other then search?)

I did the following to update the pic_username whenever the user changes their username or an admin does...

It seems to be working but grateful if the more advanced coders could cast an eye over this

Cheers


Code: [Download] [Hide] [Select]
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
// We remove all stored login keys since the password has been updated
            // and change the current one (if applicable)
            if ( !empty($passwd_sql) )
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$sql = "UPDATE " . ALBUM_TABLE . "
                SET pic_username = '" . str_replace("'", "''", $username) . "'
                WHERE " . ALBUM_TABLE . ".pic_user_id = $user_id";
            if ( !($result = $db->sql_query($sql)) )
            {
                message_die(GENERAL_ERROR, 'Could not update album table', '', __LINE__, __FILE__, $sql);
            }

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_users.php
#
#-----[ FIND ]------------------------------------------
#
        //
        // Update entry in DB
        //
        if( !$error )
        {

#
#-----[ AFTER, ADD ]------------------------------------------
#
                $sql = "UPDATE " . ALBUM_TABLE . "
                SET pic_username = '" . str_replace("'", "''", $username) . "'
                WHERE " . ALBUM_TABLE . ".pic_user_id = $user_id";
            if ( !($result = $db->sql_query($sql)) )
            {
                message_die(GENERAL_ERROR, 'Could not update album table', '', __LINE__, __FILE__, $sql);
            }

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------

 




____________
lefty74
www.zoocrew.eu - help us save our wildlife
 
lefty74Send private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: Update pic_username when a user changes username 
 
Actually, I would have thought that pic_username would only be used for guests ... same as post_username is used.
Evidently that is not the case, but perhaps it needs to be  
 



 
ArtieSend private message  
Back to topPage bottom
This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies.  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events