8
I found this code in the forums i think... i check it and work.. and have to add a link to outbox.php (in your root)
<?php
$xoopsOption['pagetype'] = "pmsg";
include_once "mainfile.php";
if ( !$xoopsUser ) {
$errormessage = _PM_SORRY."<br />"._PM_PLZREG."";
redirect_header("user.php",2,$errormessage);
} else {
include XOOPS_ROOT_PATH.'/header.php';
$pm_handler =& xoops_gethandler('privmessage');
$sql = "SELECT * FROM ".$xoopsDB->prefix("privmessage")." where subject not like '[any subject you do not want to select]'
and from_userid=".$xoopsUser->getVar('uid')." order by msg_id";
//$result = $xoopsDB->query($sql);
// $criteria = new CriteriaCompo();
// $criteria->add(new Criteria('subject', '[Trisomy 18 Support]%', 'LIKE'));
// $criteria->add(new Criteria( 'test%', 'subject', 'NOT LIKE'));
// $pm_arr =& $pm_handler->getObjects($criteria);
$criteria = new CriteriaCompo();
$criteria1=new Criteria('from_userid', $xoopsUser->getVar('uid'));
$criteria2=new Criteria( 'subject', '[Trisomy 18 Support]%', 'NOT LIKE');
$criteria->add($criteria1);
$criteria->add($criteria2);
$pm_arr =& $pm_handler->getObjects($criteria);
//$criteria->add(new Criteria('subject', '[Trisomy 18 Support]%', 'LIKE'));
//$criteria2->add(new Criteria('uid', $uid), 'OR');
//$criteria->add(new Criteria('from_userid', $xoopsUser->getVar('uid')));
//$pm_arr =& $pm_handler->getObjects(criteria);
// $pm_arr =& $pm_handler->getObjects(new Criteria('subject', 'test', 'NOT LIKE'));
// $pm_arr =& $pm_handler->getObjects(new Criteria('subject', '[Trisomy 18 Support]'));
// OLD ONE
// $pm_arr =& $pm_handler->getObjects(new Criteria('from_userid', $xoopsUser->getVar('uid')));
// if ( $xoopsUser->getVar('uid') == 1){
// echo "Testing: <br><br>";
// echo $pm_arr[2];
//
// echo "<br><br>Finished Testing<br><br>";
// }
echo "<h4 style='text-align:center;'>Bandeja de Salida</h4>
<hr><a href='userinfo.php?uid=". $xoopsUser->getVar("uid")."'>". _PM_PROFILE ."</a> <span style='font-weight:bold;'>»»</span> <small>Outbox</small><br /><br /><table border='0' cellspacing='1' cellpadding='4' width='100%' class='outer'>n";
echo "<form name='prvmsg' method='post' action='viewpmsg.php'>";
echo "<tr align='center' valign='middle'><th><img src='images/download.gif' alt='' border='0' /></th><th>". _PM_TO ."</th><th>". _PM_SUBJECT ."</th><th align='center'>". _PM_DATE ."</th></tr>n";
$total_messages = count($pm_arr);
if ( $total_messages == 0 ) {
echo "<tr><td class='even' colspan='6' align='center'>"._PM_YOUDONTHAVE."</td></tr> ";
$display= 0;
} else {
// echo "<tr><td class='even' colspan='6' align='center'>Feature will be active shortly.</td></tr> ";
$display = 1;
}
// if ( $xoopsUser->getVar('uid') == 1){
for ($i = 0; $i < $total_messages; $i++) {
$class = ($i % 2 == 0) ? 'even' : 'odd';
echo "<tr align='left' class='$class'>n";
if ($pm_arr[$i]->getVar('read_msg') == 1) {
echo "<td valign='top' width='5%' align='center'><img src='images/read.gif' alt='"._PM_NOTREAD."' /></td>n";
} else {
echo "<td valign='top' width='5%' align='center'><img src='images/unread.gif' alt='"._PM_NOTREAD."' /></td>n";
}
$postername = XoopsUser::getUnameFromId($pm_arr[$i]->getVar("to_userid"));
echo "<td valign='middle' width='10%'>";
// no need to show deleted users
if ($postername) {
echo "<a href='userinfo.php?uid=".$pm_arr[$i]->getVar("to_userid")."'>".$postername."</a>";
} else {
echo $xoopsConfig['anonymous'];
}
echo "</td>n";
if ($pm_arr[$i]->getVar('read_msg') == 1) {
echo "<td valign='middle'><a href='readoutbox.php?start=$i&total_messages=$total_messages'>".$pm_arr[$i]->getVar("subject")."</a></td>";
} else {
echo "<td valign='middle'><a href='readoutbox.php?start=$i&total_messages=$total_messages'><b>".$pm_arr[$i]->getVar("subject")."</b></a></td>";
}
echo "<td valign='middle' align='center' width='20%'>".formatTimestamp($pm_arr[$i]->getVar("msg_time"))."</td></tr>";
}
// }
if ( $display == 1 ) {
echo "<tr class='foot' align='left'><td colspan='6' align='left'><input type='button' class='formButton' onclick='javascript:openWithSelfMain("".XOOPS_URL."/pmlite.php?send=1","pmlite",450,380);' value='"._PM_SEND."' /> </td></tr></form>";
} else {
echo "<tr class='bg2' align='left'><td colspan='6' align='left'><input type='button' class='formButton' onclick='javascript:openWithSelfMain("".XOOPS_URL."/pmlite.php?send=1","pmlite",450,380);' value='"._PM_SEND."' /></td></tr></form>";
}
echo "</table>";
include "footer.php";
}
?>