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 - 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: [Download] [Hide] [Select]
##############################################################
## 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 = '<a href="' . $last_pic_url . '"><img src="' . "album_thumbnail.". $phpEx ."?pic_id=" . $row['pic_id'] . '" alt="' . $row['pic_desc'] . '" title="' . $row['pic_title'] . '" style="max-width: 150; max-height: 80"; border="0" /></a>';
    $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 ]------------------------------------------
#
        <tr>
          <td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_INTERESTS}:</span></td>
          <td> <b><span class="gen">{INTERESTS}</span></b></td>
        </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
        <tr>
          <td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_LAST_PIC}:</span></td>
          <td><span class="genmed">{LAST_PIC_THUMB}</span><br/><b><span class="gensmall">{LAST_PIC_TITLE}</span></b></td>
        </tr>

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



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: [Download] [Hide] [Select]
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
    $last_pic_url =  append_sid("album_showpage.". $phpEx ."?pic_id=" . $row['pic_id']);
    $last_pic_thumb = '<a href="' . $last_pic_url . '"><img src="' . "album_thumbnail.". $phpEx ."?pic_id=" . $row['pic_id'] . '" alt="' . $row['pic_desc'] . '" title="' . $row['pic_title'] . '" style="max-width: 150; max-height: 80"; border="0" /></a>';
    $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 = '<a href="' . $last_pic_url . '"><img src="' . "album_thumbnail.". $phpEx ."?pic_id=" . $row['pic_id'] . '" alt="' . $row['pic_desc'] . '" title="' . $row['pic_title'] . '" style="max-width: 150; max-height: 80"; border="0" /></a>';
    $last_pic_title = $row['pic_title'];
}    

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


The screenshot is from my board and not subSilver, sorry

last_pic_in_profile.jpg
Description: Screenshot Last_pic_in_profile 
Download
Filename: last_pic_in_profile.jpg
Filesize: 143.89 KB
Downloaded: 827 Time(s)

 



 
Last edited by lefty74 on Sun 04 Mar, 2007 22:10; edited 1 time in total 
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: Last_pic_in_profile 
 
Thanks lefty74, doesn't the RECENT PUBLIC PICS block make something similar?
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Last_pic_in_profile 
 
Hi Mighty Gorgon, I suppose it does...

I just wanted it in the profile though...
 



 
lefty74Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Last_pic_in_profile 
 
lefty74 wrote: [View Post]
Hi Mighty Gorgon, I suppose it does...

I just wanted it in the profile though...

He he he... great.

Thanks for sharing it, if you create a zip file I'll include it in FAP package.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Last_pic_in_profile 
 
Mighty Gorgon wrote: [View Post]

He he he... great.

Thanks for sharing it, if you create a zip file I'll include it in FAP package.


Here is the zip file, I have found a glitch with IE which I seem to have solved in 1.0.1 (first post updated):
Unfortunately, IE does not recognise max-width: or max-height:   so in IE the thumbnail shows in the original size

last_pic_on_profile_1_0_1.zip
Description:  
Download
Filename: last_pic_on_profile_1_0_1.zip
Filesize: 1.74 KB
Downloaded: 177 Time(s)

 



 
lefty74Send 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