https://www.icyphoenix.com/viewtopic.php?f=26&t=1168&p=8984#p8984 ----------------------------------- lefty74 Tue 20 Feb, 2007 01:39 FAP CUSTOMIZATION - Last_pic_in_profile ----------------------------------- Wanted to show the last picture uploaded by a user in his/her profile. Since I did not find this here or on MG's site, I thought I might as well share it with everyone. I was not so sure about the cat_view_levels but think the way I did it is not too bad. How many cat_view_levels are there. I saw -1, 0 and then 3 but was not sure whether there are more.... [code linenumbers=false]############################################################## ## MOD Title: Last Pic on Profile ## MOD Author: lefty74 < lefty@lefty74.com > (Heiko Carstens) http://www.lefty74.com ## MOD Description: ## MOD Version: 1.0.0 ## ## Installation Level: Easy ## Installation Time: 5 minutes ## Files To Edit: includes/usercp_viewprofile.php ## language/lang_english/lang_main.php ## templates/subSilver/profile_view_body.tpl ## Included Files: ## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ## Generator: Phpbb.ModTeam.Tools ############################################################## ## For security purposes, please check: http://www.phpbb.com/mods/ ## for the latest version of this MOD. Although MODs are checked ## before being allowed in the MODs Database there is no guarantee ## that there are no security problems within the MOD. No support ## will be given for MODs not found within the MODs Database which ## can be found at http://www.phpbb.com/mods/ ############################################################## ## Author Notes: Had this finished for my own board so thought it might be of interest to others... ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ OPEN ]------------------------------------------ # includes/usercp_viewprofile.php # #-----[ FIND ]------------------------------------------ # $avatar_img = ''; # #-----[ BEFORE, ADD ]------------------------------------------ # // BEGIN last pic on profile lefty74 $cat_view_level = ($userdata['user_level'] == ADMIN ? "'-1','0','1','2','3'" : ($userdata['session_logged_in'] ? "'-1','0'" : "'-1'")); $sql = "SELECT ct.cat_id, ct.cat_view_level, p.pic_id, p.pic_title, p.pic_desc FROM ". ALBUM_TABLE ." AS p LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id WHERE p.pic_user_id = " . $profiledata['user_id'] ." AND ct.cat_view_level IN ($cat_view_level) ORDER BY p.pic_id desc LIMIT 1 "; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query last pic on profile information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $last_pic_url = append_sid("album_showpage.". $phpEx ."?pic_id=" . $row['pic_id']); $last_pic_thumb = '' . $row['pic_desc'] . ''; $last_pic_title = $row['pic_title']; // END last pic on profile lefty74 # #-----[ FIND ]------------------------------------------ # 'U_SEARCH_USER' # #-----[ AFTER, ADD ]------------------------------------------ # // BEGIN last pic on profile lefty74 'LAST_PIC_THUMB' => $last_pic_thumb, 'LAST_PIC_TITLE' => $last_pic_title, 'L_LAST_PIC' => $lang['Last_Pic_uploaded'], //END last pic on profile lefty74 # #-----[ OPEN ]------------------------------------------ # language/lang_english/lang_main.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE, ADD ]------------------------------------------ # // BEGIN last pic on profile lefty74 $lang['Last_Pic_uploaded'] = 'Last Picture uploaded'; // END last pic on profile lefty74 # #-----[ OPEN ]------------------------------------------ # templates/subSilver/profile_view_body.tpl # #-----[ FIND ]------------------------------------------ # {L_INTERESTS}: {INTERESTS} # #-----[ AFTER, ADD ]------------------------------------------ # {L_LAST_PIC}: {LAST_PIC_THUMB}
{LAST_PIC_TITLE} # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM [/code] EDIT: I noticed that IE was showing an X picture when a user did not have any pictures uploaded. This got rid of it: [code linenumbers=false]# #-----[ OPEN ]------------------------------------------ # includes/usercp_viewprofile.php # #-----[ FIND ]------------------------------------------ # $last_pic_url = append_sid("album_showpage.". $phpEx ."?pic_id=" . $row['pic_id']); $last_pic_thumb = '' . $row['pic_desc'] . ''; $last_pic_title = $row['pic_title']; # #-----[ REPLACE, WITH ]------------------------------------------ # if ($row['pic_id'] == '') { $last_pic_url = ''; $last_pic_thumb = ''; $last_pic_title = ''; } else { $last_pic_url = append_sid("album_showpage.". $phpEx ."?pic_id=" . $row['pic_id']); $last_pic_thumb = '' . $row['pic_desc'] . ''; $last_pic_title = $row['pic_title']; } # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM [/code] The screenshot is from my board and not subSilver, sorry