Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: New Profile Comments Page with members thumbnail on each page. Part 1

  1. #1
    Prometheus
    Guest

    Talking New Profile Comments Page with members thumbnail on each page. Part 1

    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 = '&amp;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;">&nbsp;';
    			$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 = '&amp;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 . '&amp;action=commentdelete&amp;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;">&nbsp;';
    	for( $i = $start; $i <= $end; $i++ )
    	{
    		if( $page == $i )
    		{
    			$ret .= '<span>[&nbsp;' . $i . '&nbsp;]</span> ';
    		}
    		else
    		{
    			$ret .= ' <span>[&nbsp;<a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '&amp;page=' . $i . '">' . $i . '</a>&nbsp;]</span>';
    		}
    	}
    	$ret .= '</div>';
    	$ret .= '<div>&nbsp;';
    	if( 1 < $page )
    	{
    		$ret .= ' <a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '">First</a> | ';
    		$ret .= ' <a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '&amp;page=' . ( $page - 1 ) . '">&lt;&lt; Previous</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
    	}
    	if( $page < $pages)
    	{
    		$ret .= ' <a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '&amp;page=' . ( $page + 1 ) . '">Next &gt;&gt;</a> | ';
    		$ret .= ' <a href="' . $site['url'] . 'profile.php?ID=' . $profileID . '&amp;page=' . ($pages) . '">Last</a>';
    	}
    	$ret .= '</div>';
    
    
    	return $ret;
    
    }
    
    
    
    See part 2
    Attached Images Attached Images
    Last edited by Prometheus; 06-12-2007 at 10:27 AM.

  2. #2
    Prometheus
    Guest

    Default New Profile Comments Page with members thumbnail on each page. Part 2

    Code:
    replace with:
    
    
    // ------------ Profile Comments BEGIN -----------------------
    
    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 = '&amp;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_comments.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;">&nbsp;';
    			$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 = '&amp;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">';
    
    // eprofile NicName HERE
    
    				$ret .= '<a href="' . $site['url'] . $comment_arr['pNick'] . '">';
    					$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_comments.php?ID=' . $profileID . '&amp;action=commentdelete&amp;commentID=' . $comment_arr['gID'] . '">[ Delete this Comment ]</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\';">Post Reply</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_comments.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;">&nbsp;';
    	for( $i = $start; $i <= $end; $i++ )
    	{
    		if( $page == $i )
    		{
    			$ret .= '<span>[&nbsp;' . $i . '&nbsp;]</span> ';
    		}
    		else
    		{
    			$ret .= ' <span>[&nbsp;<a href="' . $site['url'] . 'profile_comments.php?ID=' . $profileID . '&amp;page=' . $i . '">' . $i . '</a>&nbsp;]</span>';
    		}
    	}
    	$ret .= '</div>';
    	$ret .= '<div>&nbsp;';
    	if( 1 < $page )
    	{
    		$ret .= ' <a href="' . $site['url'] . 'profile_comments.php?ID=' . $profileID . '">First</a> | ';
    		$ret .= ' <a href="' . $site['url'] . 'profile_comments.php?ID=' . $profileID . '&amp;page=' . ( $page - 1 ) . '">&lt;&lt; Previous</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
    	}
    	if( $page < $pages)
    	{
    		$ret .= ' <a href="' . $site['url'] . 'profile_comments.php?ID=' . $profileID . '&amp;page=' . ( $page + 1 ) . '">Next &gt;&gt;</a> | ';
    		$ret .= ' <a href="' . $site['url'] . 'profile_comments.php?ID=' . $profileID . '&amp;page=' . ($pages) . '">Last</a>';
    	}
    	$ret .= '</div>';
    
    
    	return $ret;
    
    }


    I realize that there will be ALOT of EXTRA code in your profile_comments.php but everyone wants hacks that will work with dolphin too. So this hack is dolphin compatible to a point. Since you are using the profile.php for your version it should work fine for you. You (dolphiners) may have to tweek the rest of the mod (lang file entries etc..) for your version but 90&#37; will work as posted for the fish people. 100% if you are using ae 4.1.2....LOL...
    Last edited by Prometheus; 06-12-2007 at 10:29 AM.

  3. #3

    Join Date
    Jul 2006
    Posts
    101

    Default

    what if i wanted to add the members pic to another page like cc.php or something like that would i just add the same code?

  4. #4

    Join Date
    Jun 2006
    Posts
    44

    Default really interesting

    this seems a relly interestind anyone can get it working with 5.6005

    thanks
    Spread love world wide

  5. #5
    CodyT's Avatar
    Join Date
    Feb 2007
    Posts
    288

    Default

    Could you please tell us how to get this working for Dolphin 5.6.005 ?

    Thanks
    SocialEngine 2.81 Nulled

  6. #6
    Prometheus
    Guest

    Default

    Well. no matter what version you are using you can simply follow the same instructions.

    Since you are using code that already works on your site (your profile.php file) and you are simply making a copy and renaming it to profile_comments.php it will work perfectly. How can it not...???
    You do not NEED to alter/or delete any code if you do not wish to. (in your profile.php)
    But you will still have to change all the instances of

    'profile.php?ID=
    with
    'profile_comments.php?ID=

    in your new profile_comments.php

    create the links on your page 7 or your profile page and make the appropriate changes/additions to your lang file...create a new template named profile_comments blah blah blah and change the name that you new php file calls from 7 to profile_comments.

    The code that I used was taken from dolphin...LOL....
    If you have profile comments working you will be fine.

    This is very easy to do....
    It only becomes/looks difficult because I am using dolphin code in ae and hence all the really unneeded instructions - If you are using dolphin.
    Last edited by Prometheus; 06-14-2007 at 12:52 PM.

  7. #7
    Prometheus
    Guest

    Default

    Quote Originally Posted by driver_x View Post
    what if i wanted to add the members pic to another page like cc.php or something like that would i just add the same code?
    Code:
    Use the print thumb() function that is already written in your script.
    
    
    /**
     * Print thumbnail pictire and link to the aditional pictures
     */
    function PrintThumb()
    {
        global $p_arr;
        global $site;
    	global $ID_PIC_URL;
    	global $ID_PIC_DIR;
    	global $pic_num;
    	global $ID;
    	global $icon_yellow;
    
    	// pictures
    
    	$thumb_width    = getParam( 'pic_width' );
    	$thumb_height   = getParam( 'pic_height' );
        $pic_first_name = "id_img/$p_arr[ID]_1_$p_arr[Pic_1_addon].jpg";
    	$thumb_name = "$ID_PIC_DIR$p_arr[ID]_1_$p_arr[Pic_1_addon]";
    	$pic[thumb] = file_exists( "$thumb_name.jpg" );
    
    	ob_start();
    	      $enable_auto_thumbnail = getParam("enable_thumb") == "on" ? 1 : 0;
    
    	$action_result   = checkAction( $_COOKIE[memberID], ACTION_ID_VIEW_PHOTOS, false );
    	    if ( $action_result[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED )
    
    	       $click = 'javascript: get_gallery('.$ID.');';
    
    	   else
    	       $click = 'window.open(\'profilethumb.htm\',\'profile_foto\',\'width=350,height=300,left=350,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no\');';
    
    	      echo '
    	            <table border="1" cellspacing="0" cellpadding="0" width="'. $thumb_width .'" height="' . $thumb_height . '" class="thumb_profile">
    	        <tr>
    	              <td align=center valign=center>';
    	      echo '<div STYLE="width: ' . $thumb_width . '; overflow : hidden"><a href="javascript: void();" onClick="'.$click.'">';
    	      echo '<img src="';
    	    if ( $pic[thumb] )
    	        echo "$ID_PIC_URL$p_arr[ID]_1_$p_arr[Pic_1_addon].jpg";
    	    else
    	        echo "$site[images]pic_not_avail.gif";
    
            echo '" border=0></a></div></td></tr></table>';
    
    // define if we have more pictires to show in gallery
    
        $ret = ob_get_contents();
        ob_end_clean();
    
        return $ret;
    }
    
    
    
    You can take out the code that links to the gallery if you want then simply
    put in your cc.php where you want the thumb to appear. 
    
    (You may have to use echo instead of $ret. I cannot remember what is used in cc.php)
    
    
    $ret .= '<a href="' . $site['url'] . $comment_arr['pNick'] . '">';
    $ret .= "<img src='".print_thumb($comment_arr['Sender'])."' border=0>";
    $ret .= '</a>';
    
    
    (kisses example)
    
    you will have to change the $comment_arr['pNick'] to say $vk_arr['NickName']
    
    and print_thumb($comment_arr['Sender']) to print_thumb($vk_arr['NickName'])
    But the OTB cc.php page layout blows and adding LOTS and I mean Lots of call and having to have your members download 60,70 100 + pics when they hit their cc.php page will really slow it down.
    Ex. If you use this for the profile views section you view 200 members then your members will be downloading 200 pic and that is just for the viewing area plus the page length and content size will be HUGE...
    Last edited by Prometheus; 06-14-2007 at 02:55 PM.

  8. #8

    Join Date
    Jul 2006
    Posts
    101

    Default

    thanks prom and you were right about cc.php i took the code and tried to use it in gallery.php but as hard as i have tried i cannot get the thumbnail to appear. any suggestion?

  9. #9
    Prometheus
    Guest

    Default Add a link to the profile comments page for search row - search results

    !!! NOTICE: REQUIRES MOD REWRITE !!!


    Although this/these addons are quite simple I post them in the hope to inspire you to find new and creative ways to manipulate your site.



    This is an addon to the the hack below.
    This mod adds a link on the search row page to your members comments page. (profile_comments.php)

    (See attached)

    This new link only appears for logged in members.

    open

    members.inc.php


    find:

    $al_sendmsg .= _t("_contact")."</a>&nbsp;&nbsp;&nbsp;";


    if ( $logged['member'] )
    {





    add below


    // Profile Comment link for Search Row - Search Reuslts - BEGIN

    $comments = "<a href=\"profile_comments.php?ID=".$p_arr['NickName']."\"";
    $comments .= ">";
    $comments .= _t("_comments")."</a>";

    // Profile Comment link for Search Row - Search Reuslts - End


    find:

    $templ = str_replace ( "__match__", $match, $templ );


    add below:


    $templ = str_replace ( "__al_comments__", $comments, $templ );


    in your tmpl_???_searchrow.html



    add

    __al_comments__


    where ever you want the link to appear.
    Attached Images Attached Images

  10. #10
    CodyT's Avatar
    Join Date
    Feb 2007
    Posts
    288

    Default

    Coud someone PLEASE get the thumbnail code for Dolphin 5.6 ?

    That would be excellent.
    SocialEngine 2.81 Nulled

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add Send My Profile to a Friend to Members home page
    By Prometheus in forum Free Mod Exchange
    Replies: 2
    Last Post: 07-01-2007, 02:51 PM
  2. searh: page number links lose part of query!
    By makenoize in forum General Troubleshooting
    Replies: 3
    Last Post: 04-20-2007, 02:53 PM
  3. Add members NickName to Blog page header and page text.
    By Prometheus in forum Free Mod Exchange
    Replies: 0
    Last Post: 03-09-2007, 05:50 PM
  4. Add members NickName to Guestbook page header and page text.
    By Prometheus in forum Free Mod Exchange
    Replies: 0
    Last Post: 03-09-2007, 05:45 PM
  5. View members profile photos on search results page.
    By Prometheus in forum Free Mod Exchange
    Replies: 1
    Last Post: 12-21-2006, 09:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •