OK...
You need to be using a mod rewrite for this to work or you will have to edit the links to point to the members ID instead of their nickname.
I have been testing the profile comments hack and OTB it slows down the loading of the members profile page way to much.
Also it does not navigate well. (Just like the OTB inbox and outboxes did)
It needs its own page so I created this hack.
This mod creates a new profile comments page for each member.
It also adds the members thumbnail to the top of each page.
(My screen shot shows Pic_1_addon - the larger pic but this code will show your members thumbnail)
Code:// ----------------------------------------------- Take your profile.php and make a copy and rename it to profile_comments.php // ------------------------------------------------- in your profile.php find: $profile_type_add = ( 'couple' != $p_arr['ProfileType'] ) ? " AND `profile_type` != 'couple' " : ""; add below: $comments ="<a href=\"profile_comments.php?ID=".$p_arr['NickName']."\""; $comments .= ">"; $comments .= _t("_profile_comments")."</a>"; find: $_page_cont[$_ni]['con'] = $con; add below: $_page_cont[$_ni]['comments'] = $comments; find and delete $enable_profileComments = ( 'on' == getParam("enable_profileComments") ) ? 1 : 0; $_page_cont[$_ni]['profile_comments'] = $enable_profileComments ? getMemberProfileComments() : ''; // --- Find and delete all the profile comment functions (5 - I think from your profile.php) // Just like you did in your new profile_comments.php but do not replace them with anything. // ----------------------------------------------- add to your lang file: '_profile_comments' => 'My Profile Comments', // ---------------------------------------------- take your tmpl_???_page.html make a copy and rename it to tmpl_???_page_profile_comments.html In your new tmpl_???_page_profile_comments.html find and delete: __page_main_code__ replace with: <div><div align="center">__thumbnail__</div></div> <br> <div class="divUnderCustomization" align="center"> <div class="db_2_block">__profile_comments__</div></div> // --------------------------------------- In your page 7 add __comments__ where ever you want the link for the profile comments to be displayed. // ---------------------------------------- in your new profile_comments.php find and delete: $_page['name_index'] = 7; replace with $_page['name_index'] = profile_comments; find: $enable_couple = getParam("enable_couple") == "on" ? 1 : 0; add below: $enable_profileComments = ( 'on' == getParam("enable_profileComments") ) ? 1 : 0; $_page_cont[$_ni]['profile_comments'] = $enable_profileComments ? getMemberProfileComments() : ''; find and delete these functions. (You will also have to remove __profile_comments__ from your page 6) function getMemberProfileComments() { global $site; global $logged; global $oTemplConfig; global $profileID; global $memberID; global $owner; $ret = ''; if( $logged['member'] ) { $ret .= '<div class="add_comment">'; $ret .= '<a href="javascript:void(0);" onclick="z = document.getElementById(\'addCommentArea\'); z.style.display=\'block\'">' . _t("_add_a_comment") . '</a>'; $ret .= '</div>'; } if( $_POST['commentsubmit'] ) { $ret .= addComment($profileID); } if( $_GET['action'] == 'commentdelete' ) { $commentID = (int)$_GET['commentID']; $ret .= deleteComment($commentID); } if ( $_GET['page'] ) { $sFormAdd = '&page=' . (int)$_GET['page']; } $ret .= '<div id="profileComments">'; $ret .= '<div style="display:none;" class="addcomment_textarea" id="addCommentArea">' . "\n"; $ret .= '<form method="post" action="' . $site['url'] . 'profile.php?ID=' . $profileID . $sFormAdd . '">'; $ret .= '<textarea name="commenttext" class="comment_textarea" id="commenttext"></textarea>'; $ret .= '<div class="answer_smiles">'; $ret .= put_smiles( 'commenttext', 120); $ret .= '</div>'; $ret .= '<div class="addcomment_submit">'; $ret .= '<input type="hidden" name="ID" value="' . $profileID . '" />'; $ret .= '<input type="hidden" name="member" value="' . $memberID . '" />'; $ret .= '<input type="hidden" name="commentsubmit" value="true" />'; $ret .= '<input type="submit" value="add comment" />'; $ret .= '</div>'; $ret .= '</form>'; $ret .= '</div>' . "\n"; $ret .= getCommentList( '', 1 ); $ret .= '<div style="text-align:center;"> '; $ret .= getCommentNavigation(); $ret .= '</div>'; $ret .= '</div>'; $langShow = _t('_Show'); $langHide = _t('_Hide'); $menu = '<div class="block_menu" onclick="javascript: if ( \'none\' == document.getElementById(\'profileComments\').style.display ) { document.getElementById(\'profileComments\').style.display=\'block\'; this.innerHTML=\''. $langHide .'\'; } else { document.getElementById(\'profileComments\').style.display=\'none\'; this.innerHTML=\''. $langShow .'\'; }" >'. $langHide .'</div>'; return $ret; // return DesignBoxContent( _t("_profile_comments"), $ret, $oTemplConfig -> getMemberProfileComments_db_num, $menu ); } function getCommentList( $commentID = '', $sql_limit = 0) { global $cont; global $logged; global $site; global $iPerPage; global $profileID; global $memberID; global $owner; global $ID_PIC_URL; global $ID_PIC_DIR; $ret = ''; if( $commentID ) { $add = ' AND `ReplyTO` = \'' . $commentID . '\' '; } else { $add = ' AND `ReplyTO` is null '; } if ( 1 == $sql_limit ) { if( !$_GET['page'] ) { $page = 0; } else { $page = ((int)$_GET['page']-1) * $iPerPage; } $query_limit = " LIMIT {$page}, {$iPerPage} "; } else { $query_limit = ""; } if ( $_GET['page'] ) { $sFormAdd = '&page=' . (int)$_GET['page']; } $comment_query = "SELECT `ProfilesComments`.`ID` AS gID, `ProfilesComments`.`Date`, `ProfilesComments`.`IP`, `ProfilesComments`.`Sender`, `ProfilesComments`.`Recipient`, `ProfilesComments`.`Text`, `ProfilesComments`.`New`, `ProfilesComments`.`Date`, `ProfilesComments`.`ReplyTO`, `Profiles`.`Pic_0_addon`, `Profiles`.`ID` AS pID, `Profiles`.`NickName` AS pNick FROM `ProfilesComments` LEFT JOIN `Profiles` ON `ProfilesComments`.`Sender` = `Profiles`.`ID` WHERE `ProfilesComments`.`Recipient` = '" . $profileID . "' " . $add . " ORDER BY `Date` DESC $query_limit ;"; // Add posters Photo - Thumbnail to post //echo $comment_query; $comment_res = db_res($comment_query); while( $comment_arr = mysql_fetch_assoc($comment_res)) { $ret .= '<div class="comment_row" style="margin-left:' . ( 10*$cont) . 'px;">'; $ret .= '<div class="comment_caption">'; $ret .= '<a href="' . $site['url'] . 'profile.php?ID=' . $comment_arr['pID'] . '">'; $ret .= process_line_output($comment_arr['pNick']); // $id = $comment_arr['pID']; // $thumb_name = "$ID_PIC_URL" . $id . "_" . "0_{$comment_arr['Pic_0_addon']}" . ".jpg"; // $ret .= $thumb_name; // add time of comment to comment in correct order display ex. 00-00-00 time 01:10:10 $ret .= '</a>'; $ret .= '<div class="comment_caption">'; $ret .= process_line_output (date("m-d-Y - h:ia", strtotime($comment_arr['Date']))); $ret .= '</div>'; if( $owner && $comment_arr['New'] ) { $ret .= '<div class="commentNew">' . _t("_new") . '</div>'; db_res("UPDATE `ProfilesComments` SET `New` = '0' WHERE `ID` = '{$comment_arr['gID']}';"); } elseif( $logged['admin'] ) { $ret .= '<div class="commentNew">' . _t("_new") . '</div>'; } $ret .= '</div>'; $ret .= '<div class="comment_text">'; $ret .= process_html_output($comment_arr['Text']); $ret .= '</div>' . "\n"; $ret .= '<div class="comment_menu" id="menu' . $comment_arr['gID'] . '" style="display:block;">'; $ret .= '<div class="for_all">'; $ret .= ( $owner || $logged['admin'] ) ? '<span><a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '&action=commentdelete&commentID=' . $comment_arr['gID'] . '">delete</a></span>' : ''; $ret .= ( $logged['member'] ) ? '<span><a href="javascript:void(0);" onclick="z = document.getElementById(\'comm' . $comment_arr['gID'] . '\'); y = document.getElementById(\'menu' . $comment_arr['gID'] . '\'); z.style.display=\'block\'; y.style.display=\'none\';">answer</a></span>' : ''; $ret .= '</div>'; $ret .= '</div>'; $cont ++; $ret .= '</div>'; $ret .= '<div style="display:none;" class="addcomment_textarea" id="comm' . $comment_arr['gID'] . '">' . "\n"; $ret .= '<form method="post" action="' . $site['url'] . 'profile.php?ID=' . $profileID . $sFormAdd . '">'; $ret .= '<textarea name="commenttext" class="comment_textarea" id="answer_text' . $comment_arr['gID'] . '"></textarea>'; $ret .= '<div class="answer_smiles">'; $ret .= process_html_output($comment_arr['gID'], 120); $ret .= '</div>'; $ret .= '<div class="addcomment_submit">'; $ret .= '<input type="hidden" name="replyTO" value="' . $comment_arr['gID'] . '" />'; $ret .= '<input type="hidden" name="ID" value="' . $profileID . '" />'; $ret .= '<input type="hidden" name="member" value="' . $memberID . '" />'; $ret .= '<input type="hidden" name="commentsubmit" value="true" />'; $ret .= '<input type="submit" value="add comment" />'; $ret .= '</div>'; $ret .= '</form>'; $ret .= '</div>' . "\n"; $ret .= getCommentList( $comment_arr['gID'] ); $cont --; } return $ret; } function addComment( $profileID ) { global $record_maxlength; global $period; global $record_limit; global $logged; $ret = ""; $record_text = process_html_output(strmaxtextlen( $_POST['commenttext'], $record_maxlength )); $record_sender = strlen($_COOKIE['memberID']) ? (int)$_COOKIE['memberID'] : ""; $record_recipient = (int)$profileID; $ip = ( getenv('HTTP_CLIENT_IP') ? getenv('HTTP_CLIENT_IP') : getenv('REMOTE_ADDR') ); if($_POST['replyTO'] > 0 ) { $replyTO = (int)$_POST['replyTO']; } else { $replyTO = 'NULL'; } if ( !$record_recipient ) return $ret; if( !$record_sender ) { return $ret; } if( strlen($record_text) < 2 ) { $ret .= _t_err("_enter_message_text"); return $ret; } // Test if IP is defined if ( !$ip ) { $ret .= _t_err("_sorry, i can not define you ip adress. IT'S TIME TO COME OUT !"); return $ret; } // Test if last message is old enough $last_count = db_arr( "SELECT COUNT( * ) AS `last_count` FROM `ProfilesComments` WHERE `IP` = '{$ip}' AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`Date`) < {$period}*60)" ); if ( $last_count['last_count'] != 0 ) { $ret .= _t_err("_You have to wait for PERIOD minutes before you can write another message!", $period); return $ret; } // Perform insertion db_res( "INSERT INTO `ProfilesComments` SET `Date` = NOW(), `IP` = '{$ip}', `Sender` = '{$record_sender}', `Recipient` = '{$record_recipient}', `Text` = '{$record_text}', `New` = '1', `ReplyTO` = {$replyTO};" ); //echo "INSERT INTO `ProfilesComments` SET `Date` = NOW(), `IP` = '{$ip}', `Sender` = '{$record_sender}', `Recipient` = '{$record_recipient}', `Text` = '{$record_text}', `New` = '1', `ReplyTO` = {$replyTO};" . '<hr>'; return $ret; } function deleteComment( $commentID ) { global $logged; global $profileID; global $memberID; global $owner; $commentID = (int)$commentID; if( $owner || $logged['admin'] ) { $del = db_res( "SELECT `ID` FROM `ProfilesComments` WHERE `ReplyTO` = '$commentID' "); while ( $del_arr = mysql_fetch_array($del)) { deleteComment( $del_arr['ID'] ); } db_res("DELETE FROM `ProfilesComments` WHERE `ID` = '$commentID'"); } else { $ret = ''; return $ret; } } function getCommentNavigation() { global $site; global $iPerPage; global $show; global $profileID; global $memberID; global $owner; $page = $_GET['page'] ? $_GET['page'] : 1; $ret = ''; $nav_query = " SELECT COUNT(*) FROM `ProfilesComments` LEFT JOIN `Profiles` ON `ProfilesComments`.`Sender` = `Profiles`.`ID` WHERE `ProfilesComments`.`Recipient` = '" . $profileID . "' AND `Profiles`.`Status` = 'Active' AND `ReplyTO` is NULL;"; $nav_arr = db_arr($nav_query); $pages = ceil( $nav_arr['0'] / $iPerPage ); $around = (int)($show / 2); if( $page < $show ) { $start = 1; } elseif( $page > $pages - $show ) { $start = max(1, $pages - $show); } else { $start = $page - $around; } if ( $page < $show ) { $end = min($show, $pages); } elseif ( $page > $pages - $show ) { $end = $pages; } else { $end = $page + $around; } $ret .= '<div style="margin-bottom:5px;"> '; for( $i = $start; $i <= $end; $i++ ) { if( $page == $i ) { $ret .= '<span>[ ' . $i . ' ]</span> '; } else { $ret .= ' <span>[ <a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '&page=' . $i . '">' . $i . '</a> ]</span>'; } } $ret .= '</div>'; $ret .= '<div> '; if( 1 < $page ) { $ret .= ' <a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '">First</a> | '; $ret .= ' <a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '&page=' . ( $page - 1 ) . '"><< Previous</a> '; } if( $page < $pages) { $ret .= ' <a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '&page=' . ( $page + 1 ) . '">Next >></a> | '; $ret .= ' <a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '&page=' . ($pages) . '">Last</a>'; } $ret .= '</div>'; return $ret; } See part 2


LinkBack URL
About LinkBacks



Reply With Quote


Bookmarks