Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
Who Viewed This Thread - Enhanced Version Details »»
Who Viewed This Thread - Enhanced Version
Version: 1.3.1, by Ocean Ocean is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 08-29-2004 Last Update: 12-14-2004 Installs: 69
DB Changes
 
No support by the author.

Who Viewed This Thread - Enhanced Version v1.3.2


Version: 1.3.2
vB Version: 3.0.3
Developer: Ocean
Install Difficulty: Moderately Easy



The original hack this references was done by Gary King (https://vborg.vbsupport.ru/showthread.php?t=61222). I modified his hack in order to gain some additional functionality.

This hack is meant to be installed instead of Gary's original version - not in addition to it (for sanity's sake, as far as managing the code is concerned).


(This was submitted as a seperate hack with Gary's permission. If this belongs in a different group, I'm sure a Moderator will move it accordingly. )


Description:

This hack will allow you to see which users have viewed any given Thread. In addition, there is a second section that is resettable. What this means, is that there are two sections that show a list of users who have viewed the Thread in question.

The first section is a Master List - it shows all users who have viewed that thread at ANY point in time (since the hack was installed).

The second section works like your car's Trip Meter. You can Reset that second section at any time and it will then show only the users that have viewed that thread FROM THAT POINT ON. In addition, this second section will show you the Date/Time of the last Reset, so that you know from what point that second list is showing. This is useful, for example, if you want to be able to see which users have viewed a thread after you have updated it, or after a particular post of interest has been made.

You can choose which UserGroups can view the Who Viewed information, or even if you want all users to be able to see the first section - but only certain UserGroups to see the second.

You can also choose whether you want the Who Viewed information to be displayed directly on the ShowThread page, or if you would prefer to only show a link that opens a Pop Up Window with the Who Viewed information there.




Release Notes:


v1.3.2

Fixed the problem where the Pop-Up Link was visible to users who didn't have permission to view that information. (They still wouldn't be shown the information - but the link shouldn't have been visible to them in the first place)


v1.3.1

Minor modifications to the Aesthetics of the ShowThread page, as well as the Who Viewed Pop Up Window. No functional changes. If you are using v1.3.0, you do not need to upgrade, unless you wish to have the new aesthetics.


v1.3.0

Added the ability to choose whether you want the Who Viewed information to be displayed directly on the ShowThread page (as it was for all prior versions of this hack), or if you would prefer to only show a link that opens a Pop Up Window with the Who Viewed information there. Also consolidated and cleaned up the code.


v1.2.6

Fixed the problem with the "Who Viewed Since" table collapsing the wrong object


v1.2.5

Minor changes to optimize code. No functional changes. If you have v1.2.4, you do not need to upgrade to v1.2.5.


v1.2.4

Reworked the Security Sections so that they are exponentially easier to set. Now, other than choosing which UserGroups you want to have access to this hack, you only need to change ONE variable in order to choose which Security Layout you want to use.


v1.2.3

Updated all of the Security Sections to allow for more flexibility in selecting which UserGroups may view the WhoViewed Information.


v1.2.1

Upgrade Notes have been updated, and an Upgrade Script provided for those who have Gary's original version installed. If you have already successfully installed v1.2 of this hack, there is no need to do anything further.


v1.2

The original hack allowed you to see which users had viewed any particular thread on your board. It was and is an excellent hack - however, I desired some additional functionality, and so I made the following changes:


1. The format of stored User IDs has changed to a comma delineated format. This was done to optimize the code by stripping out the need for an additional explode() and implode().

2. An additional set of information is now being kept and maintained. However, unlike the first set (which will show you who has viewed a particular thread - ever), the second set is resettable at any time by Admins. This gives you a "tripmeter" of sorts, as you can now tell who has viewed a particular thread from the last time you reset that counter for that thread.

3. The date and time of the last reset for each thread is kept and displayed. Otherwise, it would be self-defeating, as you wouldn't remember when you last reset it.

4. This hack has been written so that all functions are for Admins only. Instructions are included for modifying this, if you wish. (Note: Even if you make ALL information viewable to ALL users, only Admins are allowed to Reset Counters. It is recommended that you do not change this)

5. I have the template additions being added at the bottom of the ShowThread page (right above the posting permissions). It seems to make more sense putting it there, as it doesn't get in the way, aesthetically speaking. Basically, if you want to check that section, it's there - if not, you'll never be bothered by it. If you prefer to have it somewhere else, feel free to insert the ShowThread Template portion of the code wherever you wish.



UPGRADE NOTES:

The instructions for this hack assume that you do NOT have any prior version installed.

At the moment, if you already have Gary's original 1.0 version installed, you will either need to completely clear out the existing data, before installing this hack - or you can download the "WhoViewedUpgradeFormat.php" script in order to convert the data format over to the new style.

Instructions are included for upgrading.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #72  
Old 12-01-2004, 01:30 PM
rh2004 rh2004 is offline
 
Join Date: Nov 2004
Posts: 154
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi im confused I done the phrase but and all upto number 6 then I have no idea
what this is talking about, is it a New template, a new file


Code:
6.  Above, Add:



**********







################################################################################
########################## Who Viewed This Thread ##############################

##########################      CONFIGURATION     ##############################
################################################################################







/* 



By default, only Admins can see either of the two sections of "Who Viewed" information, and only Admins can Reset the second section.  





There are three ways you can deviate from this default setup (Regardless of which deviation you may choose, ONLY admins can Reset the second section):





OPTION 1:  If you want ALL users to be able to see BOTH sections of "Who Viewed" information...



	Located immediately below these three options, you will find a line that starts with "$whoviewed_security_option = ".  The number that follows the equals sign indicates which Security Option you wish to use (It is set to "2" by default).  For Option 1, change the number "2" to a "1".





OPTION 2:  If you want to specify ONLY certain UserGroups IN ADDITION to Admins that can see BOTH sections of "Who Viewed" information...



	Located immediately below these three options, you will find a line that starts with "$whoviewed_security_option = ".  The number that follows the equals sign indicates which Security Option you wish to use (It is set to "2" by default).  For Option 2, change the number to "2", if it is not already set that way.



	In addition, in the following section of code, insert the Usergroup IDs of the User Groups that you want this hack to work for.  Each UserGroup ID needs to be surrounded by single-quotes ( ' ), and all but the last one needs to have a comma after each entry.  In the following example, UserGroups 6 and 5 have been specified (although the actual code to be executed only specifies UserGroup 6). Change this to suit your needs.



**********************************************

EXAMPLE

**********************************************



$whoviewed_selective_usergroups = array( 

    '6', 

    '5' 

); 



**********************************************

END OF EXAMPLE

**********************************************



*/







// List of Approved UserGroups

$whoviewed_selective_usergroups = array( 

    '6' 

); 











/*



OPTION 3:  If you want ALL users to see the first section of "Who Viewed" information, but wish to specify that ONLY certain UserGroups can see the second section of "Who Viewed" information...



	Located immediately below these three options, you will find a line that starts with "$whoviewed_security_option = ".  The number that follows the equals sign indicates which Security Option you wish to use (It is set to "2" by default).  For Option 3, change the number "2" to a "3".



	In addition, set the List of Approved UserGroups above as described in Option 2.





*/









// Set the number on this line equal to which Security Option you chose.  It is set to 2, by default.
$whoviewed_security_option = 2;







/*



DISPLAY METHOD:



Display Option 1:	All "Who Viewed" information is displayed right on the ShowThread page.



Display Option 2:	The ShowThread page will have a link which opens a Pop Up Window with the "Who Viewed" information.



*/





// Set the number on this line equal to which Display Option you chose.  It is set to 1, by default.

$whoviewed_display_option = 1;






################################################################################

##########################         End of         ##############################
########################## Who Viewed This Thread ##############################

##########################      CONFIGURATION     ##############################
################################################################################


















// Section - Check if user has already viewed thread, and add UserID if they have not





$showinvisible = 1; 



// Get who has already viewed this thread 

$currentthread = $DB_site->query_first("SELECT whoviewed FROM ".TABLE_PREFIX."thread WHERE threadid = $threadid"); 

$currentthread2 = $DB_site->query_first("SELECT whoviewedcounter FROM ".TABLE_PREFIX."thread WHERE threadid = $threadid"); 

$userinfo = fetch_userinfo($bbuserinfo['userid']); 



if (!$userinfo['invisible'] OR $showinvisible) 

{ 

    if (!empty($currentthread['whoviewed'])) 

    { 

        $vieweduserids = explode(",", $currentthread['whoviewed']); 

        if (!in_array($bbuserinfo['userid'], $vieweduserids)) 

        { 

            $adduserid = ",".$bbuserinfo[userid]; 

            $DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewed = CONCAT(whoviewed, '$adduserid') WHERE threadid = $threadid"); 

        } 

    } 

    else 

    { 

        $DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewed = $bbuserinfo[userid] WHERE threadid = $threadid"); 

    } 





// Duplicate Set



    if (!empty($currentthread2['whoviewedcounter'])) 

    { 

        $vieweduserids2 = explode(",", $currentthread2['whoviewedcounter']); 

        if (!in_array($bbuserinfo['userid'], $vieweduserids2)) 

        { 

            $adduserid = ",".$bbuserinfo[userid]; 

            $DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedcounter = CONCAT(whoviewedcounter, '$adduserid') WHERE threadid = $threadid"); 

        } 

    } 

    else 

    { 

        $DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedcounter = $bbuserinfo[userid] WHERE threadid = $threadid"); 

    } 





} 


	

// End Section - Check if user has already viewed thread, and add UserID if they have not








// Main "Who Viewed" Function



function whoviewedfunction()
{


	// Globalize all variables to that external variables are available within the function, and so internal variables are available outside the function



	global $showinvisible, $DB_site, $threadid, $userinfo, $bbuserinfo, $currentthread, $thread, $vbphrase, $user, $session;

	global $currentthread, $currentthread2, $vieweduserids, $adduserid, $vieweduserids2, $whoviewed_selective_usergroups, $whoviewed_security_option, $whoviewed_group_approved, $show_whoviewed, $result, $viewers, $result2, $viewers2, $whoviewedreset, $whoviewed_display_option;

	

	

	

	

	

	

	

	// Section - Security - Evaluate if user has permission to view "Who Viewed" information, and which sections they have permissions to access

	
	
	
	if ((in_array($bbuserinfo['usergroupid'], $whoviewed_selective_usergroups)) OR (in_array($bbuserinfo['membergroupids'], $whoviewed_selective_usergroups)))
	{
	
		$whoviewed_group_approved = true;
	
	}
	else
	{
	
		$whoviewed_group_approved = false;
	
	}
	

	
	if ( ($whoviewed_group_approved == true) OR ($whoviewed_security_option == 1) OR ($whoviewed_security_option == 3))
	
	{
		
		

		$show_whoviewed = true; 

		
		
		

		// End Section - Security - Evaluate if user has permission to view "Who Viewed" information, and which sections they have permissions to access

		

		

		

		// Section - Get list of users who has viewed this thread - First Counter

		

		

		if (empty($currentthread['whoviewed'])) 

		{ 

		    $thread['viewers'] = '('.strtolower($vbphrase['none']).')'; 

		} 

		else 

		{ 

		    $result = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread[whoviewed])"); 

		    $viewers = array(); 

		    while ($user = $DB_site->fetch_array($result)) 

		    { 

		            array_push($viewers, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) .    "</a>"); 

		    } 

		    $thread['viewers'] = implode(", ", $viewers); 

		} 

		

	

		// End Section - Get list of users who has viewed this thread - First Counter

	

	

	

		// Section - Get list of users who has viewed this thread - Second Counter

	

		

		if (empty($currentthread2['whoviewedcounter'])) 

		{ 

		    $thread['viewerscounter'] = '('.strtolower($vbphrase['none']).')'; 

		} 

		else 

		{ 

		    $result2 = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread2[whoviewedcounter])"); 

		    $viewers2 = array(); 

		    while ($user = $DB_site->fetch_array($result2)) 

		    { 

		            array_push($viewers2, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) .    "</a>"); 

		    } 

		    $thread['viewerscounter'] = implode(", ", $viewers2); 

		} 

	

	

		// End Section - Get list of users who has viewed this thread - Second Counter

		

	

		

		// Section - Get the date/time of last reset
	

		
		if ($thread['whoviewedreset'] != '0')

		{

		

		//	$whoviewedreset = vbdate($vboptions[dateformat], '$thread[whoviewedreset]');

			$whoviewedreset = vbdate("m/d/Y - h:i a", $thread[whoviewedreset]);

		

		}

		

		else

		{

		

			$whoviewedreset = "Never";

		

		}

		

	

		// End Section - Get the date/time of last reset

		

		
	
	}
	
	else
	{
	

	        $show_whoviewed = false; 

	

	}

	

	

}





// End of Main "Who Viewed" Function











if ($whoviewed_display_option == 1)

{





	whoviewedfunction();





}







if ($_REQUEST['do'] == 'whoviewedpopup')
{
	// global.php handles $threadid..
	//$threadid = intval($threadid);

	$thread = verify_id('thread', $threadid, 1, 1);
	$forumperms = fetch_permissions($thread['forumid']);

	if (!($forumperms & CANVIEW))
	{
		print_no_permission();
	}
	if (!($forumperms & CANVIEWOTHERS) AND ($thread['postuserid'] != $bbuserinfo['userid'] OR !$bbuserinfo['userid']))
	{
		print_no_permission();
	}



	whoviewedfunction();




	unset($shutdownqueries['pmpopup']);
	eval('print_output("' . fetch_template('WhoViewedTemplate') . '");');






}







if ($_REQUEST['do'] == "resetwhoviewedcounter") 

{ 

	

	if(!is_member_of($bbuserinfo, 6)) // only admins may reset counter (usergroup: 6) 

	{ 

	

		print_no_permission(); 

	

	} 

	

	

	$threadid = addslashes($_REQUEST['threadid']); 

	

	//***insert mysql queries 

	$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedcounter='' WHERE threadid=$threadid");

	$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedreset = " . TIMENOW . " WHERE threadid = $threadid");

	

	

	if ($whoviewed_display_option == 1)

	{

	

		//redirect back to thread 

		$url = "showthread.php?$session[sessionurl]t=$threadid"; 

		eval(print_standard_redirect('redirecting')); 

	

	}

	

	

	if ($whoviewed_display_option == 2)

	{

	

		//redirect back to Pop Up Window 

		$url = "showthread.php?$session[sessionurl]do=whoviewedpopup&amp;t=$threadid"; 

		eval(print_standard_redirect('redirecting')); 

	

	}







}





********************************





7.  Optional Step:  In the code you just added in the previous step, there is a Configuration Section. If you wish, you can modify this hack's behavior and permissions there.  Instructions can be found within the Configuration Section.





********************************



8.  Open the "SHOWTHREAD" template and Find:



**********





<!-- forum rules and admin links -->

<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">





********************************



9.  Above, Add:



**********







<br/>



<!-- Section - If the Display Option is set to Pop Up, show the Pop Up Link -->





<if condition="$whoviewed_display_option == 2">





	<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">

	<tr>

		<td class="tcat" colspan="2">

			

		<a href="showthread.php?$session[sessionurl]do=whoviewedpopup&amp;t=$threadid" target="threadpop" onclick="window.open(this.href, this.target, 'width=640, height=400, resizable'); return false;">List users who viewed this thread</a> 



		</td>

	</tr>

	</table>



	<br/>

	<br/>





</if>





<!-- End Section - If the Display Option is set to Pop Up, show the Pop Up Link -->









<!-- Section - If the Display Option is set to ShowThread, show the Who Viewed information right on the ShowThread page -->





<if condition="$whoviewed_display_option == 1">

	





<!-- Master Section - Display Who Viewed information, based on permissions. -->

<!-- Section Note:  "WhoViewedTemplate" Template has a mirror of this section -->

	



	<if condition="$show_whoviewed">

		



	

		<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">

		<tbody>

		<tr>

			<td class="tcat" colspan="2">

			<a style="float:right" href="#top" onclick="return toggle_collapse('whoviewed1')"><img id="collapseimg_whoviewed1" src="images/buttons/collapse_tcat.gif" alt="" border="0" /></a>

	

				$vbphrase[already_viewed_this_thread]

	

			</td>

		</tr>

	

		</tbody>

		<tbody id="collapseobj_whoviewed1" style="">

	

		<tr>

			<td class="alt1" colspan="2">

				<span class="smallfont">$thread[viewers]</span>

			</td>

		</tr>

		</tbody>

		</table>



		<br />

		

		

	</if>

	

	

	

	

	<if condition="$whoviewed_group_approved OR $whoviewed_security_option == 1">

	

		

	

		<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">

		<tbody>

		<tr>

			<td class="tcat" colspan="2">

			<a style="float:right" href="#top" onclick="return toggle_collapse('whoviewed2')"><img id="collapseimg_whoviewed2" src="images/buttons/collapse_tcat.gif" alt="" border="0" /></a>

	

	

			$vbphrase[already_viewed_this_thread_since] &nbsp $whoviewedreset &nbsp &nbsp 

			

			

			<if condition="is_member_of($bbuserinfo,6)">

			

				(<a href="showthread.php?$session[sessionurl]do=resetwhoviewedcounter&amp;t=$threadid">Reset Counter</a>)

			

			</if>

			

	

	

			</td>

		</tr>

	

		</tbody>

		<tbody id="collapseobj_whoviewed2" style="">

	

		<tr>

			<td class="alt1" colspan="2">

				<span class="smallfont">$thread[viewerscounter]</span>

			</td>

		</tr>

		</tbody>

		</table>



		<br />

		<br />

		

	

	

	

	</if>





<!-- End Master Section - Display Who Viewed information, based on permissions. -->

	



</if>







<!-- End Section - If the Display Option is set to ShowThread, show the Who Viewed information right on the ShowThread page -->





********************************



10.  In the Parent Style of your choice, create a New Template (Style Manager/<Pulldown Menu> Add New Template) with the following information:



**********





New Template Title:  WhoViewedTemplate





********************************



11.  For the contents of this New Template - "WhoViewedTemplate", enter the following:



**********







$stylevar[htmldoctype]

<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">

<head>

	<title>Who Viewed this Thread? - $vboptions[bbtitle]</title>

	$headinclude

</head>

<body onload="self.focus()" style="margin:0px">



<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">

<tr>

	<td class="tcat" colspan="1">



		Who Viewed this Thread?

		<div class="smallfont">Thread: <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">$thread[title]</a></div>



	</td>

</tr>



</table>



<br/>

<br/>







<!-- Mirror Section - Display Who Viewed information, based on permissions. -->

<!-- Section Note:  This is a mirror of the Master Section, located in the ShowThread Template addition.  -->









	<if condition="$show_whoviewed">

		



	

		<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">

		<tbody>

		<tr>

			<td class="tcat" colspan="2">

			<a style="float:right" href="#top" onclick="return toggle_collapse('whoviewed1')"><img id="collapseimg_whoviewed1" src="images/buttons/collapse_tcat.gif" alt="" border="0" /></a>

	

				$vbphrase[already_viewed_this_thread]

	

			</td>

		</tr>

	

		</tbody>

		<tbody id="collapseobj_whoviewed1" style="">

	

		<tr>

			<td class="alt1" colspan="2">

				<span class="smallfont">$thread[viewers]</span>

			</td>

		</tr>

		</tbody>

		</table>



		<br />

		

		

	</if>

	

	

	

	

	<if condition="$whoviewed_group_approved OR $whoviewed_security_option == 1">

	

		

	

		<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">

		<tbody>

		<tr>

			<td class="tcat" colspan="2">

			<a style="float:right" href="#top" onclick="return toggle_collapse('whoviewed2')"><img id="collapseimg_whoviewed2" src="images/buttons/collapse_tcat.gif" alt="" border="0" /></a>

	

	

			$vbphrase[already_viewed_this_thread_since] &nbsp $whoviewedreset &nbsp &nbsp 

			

			

			<if condition="is_member_of($bbuserinfo,6)">

			

				(<a href="showthread.php?$session[sessionurl]do=resetwhoviewedcounter&amp;t=$threadid">Reset Counter</a>)

			

			</if>

			

	

	

			</td>

		</tr>

	

		</tbody>

		<tbody id="collapseobj_whoviewed2" style="">

	

		<tr>

			<td class="alt1" colspan="2">

				<span class="smallfont">$thread[viewerscounter]</span>

			</td>

		</tr>

		</tbody>

		</table>



		<br />

		<br />

		

	

	

	

	</if>









<!-- End Mirror Section - Display Who Viewed information, based on permissions. -->







<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">



<tr>

	<td class="tfoot" colspan="1" align="center"><div class="smallfont">

		<a href="#" onclick="self.close();"><strong>$vbphrase[close_this_window]</strong></a>

	</div></td>

</tr>

</table>



</body>

</html>







********************************











Installation Complete!

Can someone explain please
Reply With Quote
  #73  
Old 12-01-2004, 01:38 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rh2004

Hi im confused I done the phrase but and all upto number 6 then I have no idea
what this is talking about, is it a New template, a new file


Can someone explain please
It should be self-explanatory.


Step 5 tells you to find a bit of code in the ShowThread.php file. Step 6 tells you to insert the following segment above the code you found in Step 5.

The segment is defined as the code between


********************************
6. Above, Add:
**********


Insert the code that appears between these two lines of asterisks.



********************************

7. Optional Step: In the code you just added in the previous step, there is a Configuration Section. If you wish, you can modify this hack's behavior and permissions there. Instructions can be found within the Configuration Section.

********************************
Reply With Quote
  #74  
Old 12-01-2004, 01:46 PM
rh2004 rh2004 is offline
 
Join Date: Nov 2004
Posts: 154
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So for no 6 I just add:

**********

whats the CONFIGURATION ?
Reply With Quote
  #75  
Old 12-01-2004, 01:51 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rh2004

So for no 6 I just add:


**********


whats the CONFIGURATION ?
No, you don't add the asterisks right beneath the instructions for Step 6 - those are meant to be seperators (the same as the last 5 instructions before them) - you add what's between the asterisks. Follow the instructions.

As for the Configuration section - the information you need is written out right there for you. Read it, and you'll understand.
Reply With Quote
  #76  
Old 12-01-2004, 02:26 PM
rh2004 rh2004 is offline
 
Join Date: Nov 2004
Posts: 154
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, I did it this is my showthread.php file...


Code:
$whoviewed_group_approved = true;
	
	}
	else
	{
	
		$whoviewed_group_approved = false;
	
	}
	
	
	if ( ($whoviewed_group_approved == true) OR ($whoviewed_security_option == 1) OR ($whoviewed_security_option == 3))
	
	{
		
		
		$show_whoviewed = true; 
		
		
		
		// End Section - Security - Evaluate if user has permission to view "Who Viewed" information, and which sections they have permissions to access
		
		
		
		// Section - Get list of users who has viewed this thread - First Counter
		
		
		if (empty($currentthread['whoviewed'])) 
		{ 
		    $thread['viewers'] = '('.strtolower($vbphrase['none']).')'; 
		} 
		else 
		{ 
		    $result = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread[whoviewed])"); 
		    $viewers = array(); 
		    while ($user = $DB_site->fetch_array($result)) 
		    { 
		            array_push($viewers, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) .    "</a>"); 
		    } 
		    $thread['viewers'] = implode(", ", $viewers); 
		} 
		
	
		// End Section - Get list of users who has viewed this thread - First Counter
	
	
	
		// Section - Get list of users who has viewed this thread - Second Counter
	
		
		if (empty($currentthread2['whoviewedcounter'])) 
		{ 
		    $thread['viewerscounter'] = '('.strtolower($vbphrase['none']).')'; 
		} 
		else 
		{ 
		    $result2 = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread2[whoviewedcounter])"); 
		    $viewers2 = array(); 
		    while ($user = $DB_site->fetch_array($result2)) 
		    { 
		            array_push($viewers2, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) .    "</a>"); 
		    } 
		    $thread['viewerscounter'] = implode(", ", $viewers2); 
		} 
	
	
		// End Section - Get list of users who has viewed this thread - Second Counter
		
	
		
		// Section - Get the date/time of last reset
	
		
		if ($thread['whoviewedreset'] != '0')
		{
		
		//	$whoviewedreset = vbdate($vboptions[dateformat], '$thread[whoviewedreset]');
			$whoviewedreset = vbdate("m/d/Y - h:i a", $thread[whoviewedreset]);
		
		}
		
		else
		{
		
			$whoviewedreset = "Never";
		
		}
		
	
		// End Section - Get the date/time of last reset
		
		
	
	}
	
	else
	{
	
	        $show_whoviewed = false; 
	
	}
	
	
}


// End of Main "Who Viewed" Function





if ($whoviewed_display_option == 1)
{


	whoviewedfunction();


}




if ($_REQUEST['do'] == 'whoviewedpopup')
{
	// global.php handles $threadid..
	//$threadid = intval($threadid);

	$thread = verify_id('thread', $threadid, 1, 1);
	$forumperms = fetch_permissions($thread['forumid']);

	if (!($forumperms & CANVIEW))
	{
		print_no_permission();
	}
	if (!($forumperms & CANVIEWOTHERS) AND ($thread['postuserid'] != $bbuserinfo['userid'] OR !$bbuserinfo['userid']))
	{
		print_no_permission();
	}


	whoviewedfunction();


	unset($shutdownqueries['pmpopup']);
	eval('print_output("' . fetch_template('WhoViewedTemplate') . '");');



}



if ($_REQUEST['do'] == "resetwhoviewedcounter") 
{ 
	
	if(!is_member_of($bbuserinfo, 6)) // only admins may reset counter (usergroup: 6) 
	{ 
	
		print_no_permission(); 
	
	} 
	
	
	$threadid = addslashes($_REQUEST['threadid']); 
	
	//***insert mysql queries 
	$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedcounter='' WHERE threadid=$threadid");
	$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedreset = " . TIMENOW . " WHERE threadid = $threadid");
	
	
	if ($whoviewed_display_option == 1)
	{
	
		//redirect back to thread 
		$url = "showthread.php?$session[sessionurl]t=$threadid"; 
		eval(print_standard_redirect('redirecting')); 
	
	}
	
	
	if ($whoviewed_display_option == 1)
	{
	
		//redirect back to Pop Up Window 
		$url = "showthread.php?$session[sessionurl]do=whoviewedpopup&amp;t=$threadid"; 
		eval(print_standard_redirect('redirecting')); 
	
	}



}
//set thread last view
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
if ($thread['pollid'] AND $vboptions['updatelastpost'] AND ($displayed_dateline == $thread['lastpost'] OR $threadview == $thread['lastpost']) AND $pollinfo['lastvote'] > $thread['lastpost'])
{
	$displayed_dateline = $pollinfo['lastvote'];
}

There is no errors but I can't see it anywhere....
Reply With Quote
  #77  
Old 12-01-2004, 02:40 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rh2004

Hi, I did it this is my showthread.php file...



There is no errors but I can't see it anywhere....
Of course you can't. You didn't insert the entire section of code.
Reply With Quote
  #78  
Old 12-05-2004, 06:54 PM
rh2004 rh2004 is offline
 
Join Date: Nov 2004
Posts: 154
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello, sorry but I was confused I worked it out ..

Anyway would you not be able to add the times people viewed the topic
in the next version, and as well as the view count add a drop down menu
which will list the times they viewed the topic in more detail

For example viewed 7 times (click something to bring up in more details +)

test - the time they viewed
test - the time they viewed
test - the time they viewed
test - the time they viewed
test - the time they viewed
test - the time they viewed
test - the time they viewed

This is my phpbb one that I had for so long, the more details are not on the
phpbb one either is the reset function...
Reply With Quote
  #79  
Old 12-05-2004, 07:53 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rh2004

Hello, sorry but I was confused I worked it out ..

Anyway would you not be able to add the times people viewed the topic
in the next version, and as well as the view count add a drop down menu
which will list the times they viewed the topic in more detail
I will try to put in a date/time last viewed for each user in the next major version. However, the extensive logs you gave as an example might very well put too much of a load on the Server. I'll consider that option when I add a date/time stamp.
Reply With Quote
  #80  
Old 12-05-2004, 09:22 PM
mtha's Avatar
mtha mtha is offline
 
Join Date: Jul 2002
Location: US
Posts: 775
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When you have $whoviewed_display_option = 2;
Those who are not allowed to view "who viewed list" should NOT see the link "List users who viewed this thread" either

HTML Code:
 <if condition="$whoviewed_display_option == 2">
 <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
 	<tr>
 		<td class="tcat" colspan="2">
 			
 	<a href="showthread.php?$session[sessionurl]do=whoviewedpopup&t=$threadid" target="threadpop" onclick="window.open(this.href, this.target, 'width=640, height=400, resizable'); return false;">List users who viewed this thread 
 		</td>
 	</tr>
 	</table>
 	<br/>
 	<br/>
 </if>
Quote:
Originally Posted by Ocean
Alright everyone!

I have just released v1.3.0 of this hack, and I have given you what you asked for: the ability to have the Who Viewed information displayed in a Pop Up, instead of directly in the ShowThread page.

I made it so that you can choose which Display Mode you prefer - to have the Who Viewed information show up directly on the ShowThread page (as it was for all prior versions), or to only show a Link on the ShowThread page that opens a Pop Up Window with the Who Viewed information there.

That's it!

Let me know what you think of the new Pop Up functionality!
Reply With Quote
  #81  
Old 12-05-2004, 10:19 PM
rh2004 rh2004 is offline
 
Join Date: Nov 2004
Posts: 154
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ocean
I will try to put in a date/time last viewed for each user in the next major version. However, the extensive logs you gave as an example might very well put too much of a load on the Server. I'll consider that option when I add a date/time stamp.
Thanks
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:41 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.11744 seconds
  • Memory Usage 2,377KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_html
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete