// USERPIC within PMS !!!
// IntroductionAs we may already know this so far, the PMS MOD has been obsolete since almost a year now. However, for
those who are still using it, they've been requesting to have the userpic MOD under the PMS (which I have just finished - thanks to the cooperation of
Stoleti for letting me evaluating my project).
// Beta-TesterSo, for those who might miss this part of the message, again, my thanks goes to
Stoleti for this evaluation.
// FeaturesObviously, the userpic will be shown from the recipient who PMs you directly, when you reply to the recipient and into the sent items.
// WeaknessUnfortunitely, at least - for now - the userpic is NOT available within the "preview action".
// Obligations - {if... and ifno...} The
{if ... and ifno ...} MOD
must be installed (if you haven't already done so) in order to install this addon.
// Affected files
- pms.php
- templates/<your_template>/pms_folder.html
- templates/<your_template>/pms_view.html
// Backup your filesNote: Backup these affected files first !!!// Step 1In your pms.php file,
find :
$site_template->register_vars(array(
"view" => $lang['pms_'.$mode],
"lang_from" => $lang['pms_'.(($mode == "inbox") ? "to" : "from")],
"lang_subject" => $lang['pms_subject'],
"lang_date" => $lang['pms_date'],
"previewedit" => 0,
"action" => 0,
"lang_to" => 0,
// "reply" => 0,
"ip" => 0,
"lang_received" => 0,
"colspan" => "colspan=\"2\"",
"from" => stripslashes($user_info['user_name']),
"subject" => stripslashes($subject),
"message" => format_text($message, $html, $config['wordwrap_comments'], $bbcode, $config['bb_img_comments']),
"date" => format_date($config['date_format']." ".$config['time_format'], time())
));
$preview = $site_template->parse_template("pms_view");
}
}
replace with :
$userpic_img = ($config['userpic'] && @file_exists(ROOT_PATH."data/userpic/".$user_list['userpic'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$user_list[$user_table_fields['user_id']])."\"><img src=\"".ROOT_PATH."data/userpic/".$user_list['userpic']."\"></a>" : "";
$site_template->register_vars(array(
"view" => $lang['pms_'.$mode],
"userpic_img" => $userpic_img,
"lang_from" => $lang['pms_'.(($mode == "inbox") ? "to" : "from")],
"lang_subject" => $lang['pms_subject'],
"lang_date" => $lang['pms_date'],
"previewedit" => 0,
"action" => 0,
"lang_to" => 0,
// "reply" => 0,
"ip" => 0,
"lang_received" => 0,
"colspan" => "colspan=\"2\"",
"from" => stripslashes($user_info['user_name']),
"subject" => stripslashes($subject),
"message" => format_text($message, $html, $config['wordwrap_comments'], $bbcode, $config['bb_img_comments']),
"date" => format_date($config['date_format']." ".$config['time_format'], time())
));
$preview = $site_template->parse_template("pms_view");
}
}
Then, find :
$sql = "SELECT *
FROM ".PMS_TABLE." p
LEFT JOIN ".USERS_TABLE." u ON (p.pms_".$who." = u.user_id)
WHERE p.pms_id = ".$id.$pms_sql;
$result = $site_db->query_firstrow($sql);
if ($result){
$to = get_user_info($result['pms_'.$who2]);
add below :
$userpic_img = ($config['userpic'] && @file_exists(ROOT_PATH."data/userpic/".$result['userpic'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$result[$user_table_fields['user_id']])."\"><img src=\"".ROOT_PATH."data/userpic/".$result['userpic']."\"></a>" : "";
Then, find :
}
elseif ($row['pms_type'] != PMS_UNREAD){
$bstart = "";
$bend = "";
$new = "";
}
add below :
$userpic_img = ($config['userpic'] && @file_exists(ROOT_PATH."data/userpic/".$row['userpic'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row[$user_table_fields['user_id']])."\"><img src=\"".ROOT_PATH."data/userpic/".$row['userpic']."\"></a>" : "";
Then, find :
$msg_list .= "<tr class=\"row".(($bgcounter++ % 2 == 0) ? 1 : 2)."\" align=\"center\">
<td>".$new."</td>
<td align=\"left\"><a href=\"".$site_sess->url(ROOT_PATH."pms.php?action=view&mode=".$action."&id=".$row['pms_id'])."\">".$bstart.htmlspecialchars($row['pms_subject']).$bend."</a></td>
<td>".$bstart."<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['user_id'])."\">".$row['user_name']."</a>".$bend."</td>
<td>".$bstart.format_date($config['date_format']." ".$config['time_format'], $row['pms_date']).$bend."</td>
replace with :
$msg_list .= "<tr class=\"row".(($bgcounter++ % 2 == 0) ? 1 : 2)."\" align=\"center\">
<td>".$new."</td>
<td align=\"left\"><a href=\"".$site_sess->url(ROOT_PATH."pms.php?action=view&mode=".$action."&id=".$row['pms_id'])."\">".$bstart.htmlspecialchars($row['pms_subject']).$bend."</a></td>
<td>".$bstart."<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['user_id'])."\">".$row['user_name']."</a>".$bend."</td>
";
if ($config['userpic'] && @file_exists(ROOT_PATH."data/userpic/".$row['userpic'])) {
$msg_list .= "
<td>".$bstart. $userpic_img."</td>
";
} ###### End of if statement.
$msg_list .= "
<td>".$bstart.format_date($config['date_format']." ".$config['time_format'], $row['pms_date']).$bend."</td>
".(($action == "sentbox") ? "
<td>".$bstart.format_date($config['date_format']." ".$config['time_format'], $row['pms_date_rcvd']).$bend."</td>" : "")."
".(($action == "outbox") ? "
<td>"."<a href=\"".$site_sess->url(ROOT_PATH."pms.php?action=edit&id=".$row['pms_id'])."\">[".$lang['pms_edit']."]</a>"."</td>" : "")."
<td><input type=\"checkbox\" name=\"delete[]\" value=\"".$row['pms_id']."\"></td>
</tr>
";
}
Then, find :
"lang_delete_all" => $lang['pms_delete_all'],
add right below :
"lang_userpic" => $lang['userpic'],
// Step 2In your templates/<your_template>/pms_folder.html file,
find :
<td width="20%"><b>{lang_who}</b></td>
add below :
<td width="20%">{lang_userpic}</td>
// Step 3In your templates/<your_template>/pms_view.html file,
important as the pms.php file - let me recommend you to use this template instead :
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bordercolor">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="3" cellspacing="1">
{if previewedit}
<tr class="row1" align="center">
<td width="100%" colspan="3" height="28" valign="top">
<font color="#808000">{view}</font></td>
</tr>
{endif previewedit}
<tr class="row2">
{if userpic_img}<td nowrap width="10%"><b>{lang_from}</b>{if ip}<br />IP: {ip}{endif ip}</td>
<td width="90%" colspan="2" align="center">
{userpic_img}<br />
{from}
</td>
</tr>
</table>{endif userpic_img}
{ifno userpic_img}<td nowrap width="">{lang_from}</b>{if ip}<br />IP: {ip}{endif ip}</td>
<td width="78%" colspan="2">
{from}
</td>
</tr>
</table>{endifno userpic_img}
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr class="row2" width="100%">
<td width="22%"><b>{lang_date}</b></td>
<td width="78%"colspan="2">{date}</td>
</tr>
</table>
{if lang_received}
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr class="row2" width="100%">
<td width="22%"><b>{lang_received}</b></td>
<td width="78%" colspan="2">{received}</td>
</tr>
</table>
{endif lang_received}
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr class="row2" width="100%">
<td width="22%"><b>{lang_subject}</b></td>
<td width="22%" {colspan}>{subject}</td>
{if quote}<td width="56%" nowrap> {quote} |{endif quote}{if reply} {reply} |{endif reply}{if edit} {edit} |{endif edit} {delete} </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr class="row1">
<td width="100%" colspan="3">{message}</td>
</tr>
</table>
</td>
</tr>
</table>
Note: This is the
{if ... and ifno ...} obligation part !!! (otherwise, your template will look a little chunky
).
// Installation completeThis completes the installation of this addon. Simply use your PMS MOD and see if you can view your userpic along with your messages (whoever you are).
Good luck !