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....
##############################################################
## 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
## 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:
#
#-----[ 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
#-----[ 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) |