vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Who Viewed This Thread - Enhanced Version (https://vborg.vbsupport.ru/showthread.php?t=68876)

bnn121 10-09-2004 11:31 PM

Thanks...I'm working on this mod now...hoping to get it to work

bnn121 10-10-2004 12:16 AM

I'm getting better at this...wish me luck...but where do I find this info and how do yu perform this action?

Add the following Phrases:

**********

Phrase Type: Global
Varname: already_viewed_this_thread
Text: Already viewed this thread:

Phrase Type: Global
Varname: already_viewed_this_thread_since
Text: Already viewed this thread since:

bnn121 10-10-2004 10:09 PM

Bump

Could some one please tell me where I need to enter the above Phrases?

Is it in the database, if so. how do you do it? tru phpmyadmin?

Is it in the fourm home template...which I did find eventually...and if it there...where do they go?

Please somebody chime in here...or is this a hopeless cause try to install this hack

bnn121 10-10-2004 10:24 PM

I was able to find it finally...

It in my AdminCP

Would be nice if coders would add a litle something extra to direct us to where these modifications are needed of these hacks/mods for us newbies...

But good work none the less

Ocean 10-10-2004 11:45 PM

Quote:

Originally Posted by bnn121

I was able to find it finally...

It in my AdminCP

Would be nice if coders would add a litle something extra to direct us to where these modifications are needed of these hacks/mods for us newbies...

But good work none the less

If you try to hack an application, it is assumed that you know how to use it.

vB is not that different. If you are trying to install a hack, it is generally assumed that you have some idea of how to use the stock forum software. If you don't, you can ask for help - and you will generally receive it... But don't criticize others for your own lack of knowledge. :)

bnn121 10-10-2004 11:59 PM

But don't criticize others for your own lack of knowledge.

I'm sorry...what gave you that idea...not sure where that came from...

All I was suggesting...is that the directions be complete with all necessary hacking information. This would prevent newbie’s like me having to come to this thread and ask the question I have been asking and then get a response that generally solves the question or raises additional questions that could have been included in the instructions. I realize that there is a format that coders use...that’s obvious from looking at most of the text from these hacks/mods. Again it was only a suggestion on my part that if the instructions where a bit more detailed...a lot of the questions on how to do this and how to do that could be eliminated...I was not critiquing anyone...

I agree with you about having some sort of knowledge about the forum software...but not to go into a long history about my lack of knowledge on these hacks and mods...I am...well was faced with having to do these on my own...because I lost my webmaster...and being on a dedicated server...I'm not about to just let anybody access my stuff...so I decided to learn on my own...as I did not have the luxury of a webmaster to do this for me.

So...I apologize to you and to whomever else my last post insulted...not my intention at all.

PS: I have finally got this hack installed and working like a charm...Kodo's to all who made this one work.

Ocean 10-11-2004 01:08 AM

Quote:

Originally Posted by bnn121

All I was suggesting...is that the directions be complete with all necessary hacking information. This would prevent newbie?s like me having to come to this thread and ask the question I have been asking and then get a response that generally solves the question or raises additional questions that could have been included in the instructions. I realize that there is a format that coders use...that?s obvious from looking at most of the text from these hacks/mods. Again it was only a suggestion on my part that if the instructions where a bit more detailed...a lot of the questions on how to do this and how to do that could be eliminated...I was not critiquing anyone...

The fact is that there is almost an unlimited level of granularity back that we could go. What level of skill should coders assume you have? Should they assume that you don't know some of the details of the AdminCP? Should they assume that you don't know how to get into the AdminCP? Should they assume that you don't even know what the AdminCP is?

So, you see, coders have to start somewhere.

A reasonable assumption is that if you are ready to modify your board, you should have a reasonable idea of how to use it in its stock form.

Otherwise, instruction files would be 20 times longer, if coders started with a basic tutorial on how to use vBulletin to begin with. :)


Quote:

Originally Posted by bnn121

PS: I have finally got this hack installed and working like a charm...Kodo's to all who made this one work.

I'm glad you like it. :)

bnn121 10-11-2004 01:14 AM

Agreed...I was only trying to help...I do appreciate the efforts you and the other coders put forth with these hacks.

May I ask another question...that does not really have ot do with this hack...well sorta.

In the forumhome template...I have four templates installed...all differnet color templates. Is there a way to modify all tmeplates at one time...meaning I modify the first template...and then do something that makes the modifaction to the other three at the same time...or do I need ot make the changes one at a time?

Ocean 10-12-2004 12:13 PM

Quote:

Originally Posted by bnn121

In the forumhome template...I have four templates installed...all differnet color templates. Is there a way to modify all tmeplates at one time...meaning I modify the first template...and then do something that makes the modifaction to the other three at the same time...or do I need ot make the changes one at a time?

Well, you can't have four templates in one... However, if I understand you correctly in that you have four versions, than yes - you can do what you want. Just make the other color versions Child Styles of the primary one. That way, you can just make changes to the parent - and those changes will filter down to the child styles.

theArchitect 10-17-2004 12:24 AM

Quote:

Originally Posted by Ocean
Well, you can't have four templates in one... However, if I understand you correctly in that you have four versions, than yes - you can do what you want. Just make the other color versions Child Styles of the primary one. That way, you can just make changes to the parent - and those changes will filter down to the child styles.

Super idea for a hack. Very useful. :)

*theArchitect clicks install*.

Though, for some reason the "Already viewed this thread since:" is displaying "never" rather than a date and time shown in your screen shot. Have I messed something up in the install?

BTW, I found the install process very simple, but I amended the SHOWTHREAD template as I have currently active users at the top and not the bottom.

Also, and I don't know if this is of interest to anyone. When I downloaded the .txt file and opening it in the default app text edit everything was fine. But when I opened the file in my editor of choice (BBEdit) I got some strange symbols. And if anyone says, that?s Mac?s for you they are a dead man.

Ocean 10-17-2004 12:32 AM

Quote:

Originally Posted by theArchitect

Super idea for a hack. Very useful. :)

Thanks! :)


Quote:

Originally Posted by theArchitect

*theArchitect clicks install*.

Though, for some reason the "Already viewed this thread since:" is displaying "never" rather than a date and time shown in your screen shot. Have I messed something up in the install?

Not at all. It will show "Never" if you have never reset the counter for that particular thread. Try resetting it, you'll see that it will now show the date and time you last reset it. :)

Until the first time you reset the second counter for any given thread, the second counter will show the exact same results as the first.


Quote:

Originally Posted by theArchitect

BTW, I found the install process very simple, but I amended the SHOWTHREAD template as I have currently active users at the top and not the bottom.

Also, and I don't know if this is of interest to anyone. When I downloaded the .txt file and opening it in the default app text edit everything was fine. But when I opened the file in my editor of choice (BBEdit) I got some strange symbols. And if anyone says, that?s Mac?s for you they are a dead man.

Well, I won't say it then. But it would seem that I don't need to, either... <grin>

theArchitect 10-17-2004 02:03 AM

Quote:

Originally Posted by Ocean
Thanks! :)




Not at all. It will show "Never" if you have never reset the counter for that particular thread. Try resetting it, you'll see that it will now show the date and time you last reset it. :)

Until the first time you reset the second counter for any given thread, the second counter will show the exact same results as the first.




Well, I won't say it then. But it would seem that I don't need to, either... <grin>

So I need to hit reset for all of my threads?????

Is there a short cut to do them all. I have one or two of them.

edit:
Err. I just hit reset counter and got:
Code:

Fatal error:  Call to undefined function:  is_member_of() in \forum\misc.php on line 8
Help...

Ocean 10-17-2004 02:15 AM

Quote:

Originally Posted by theArchitect

So I need to hit reset for all of my threads?????

Is there a short cut to do them all. I have one or two of them.

No, you don't have to hit Reset on any of them until you have the need/desire to. The second counter is there to give you a date/timestamped resettable list of users who have viewed that thread. You don't need to Reset any given thread unless/until you have the need/desire to see who will have viewed that thread from that point on.

Otherwise, you can just leave them be. :)


Quote:

Originally Posted by theArchitect

edit:
Err. I just hit reset counter and got:
Code:


Fatal error: Call to undefined function: is_member_of() in \forum\misc.php on line 8

Help...

The function "is_member_of" is called from the code this hack adds to misc.php. However, it is a vB function.

The problem is that the error message states that you put that addition in the very beginning of the misc.php file (before the global functions are pre-loaded). You need to move the hack's added code to the right place in Misc.php - refer to the instructions for details. :)

theArchitect 10-17-2004 02:00 PM

Thankyou Ocean. Your prompt and accurate advice is most appreciated.

Ocean 10-17-2004 03:44 PM

Quote:

Originally Posted by theArchitect

Thankyou Ocean. Your prompt and accurate advice is most appreciated.

You're very welcome! :)

bnn121 10-21-2004 08:48 AM

This is a great hack...but...is there a way to pick and choose who can see this?

Meaning...right now all admins can see the hack...but no supermods or regualr mods. I no it may be some work. Is there a section that can be edited to allow additional userid to view this hack?

Ocean 10-21-2004 02:05 PM

Quote:

Originally Posted by bnn121

This is a great hack...but...is there a way to pick and choose who can see this?

Meaning...right now all admins can see the hack...but no supermods or regualr mods. I no it may be some work. Is there a section that can be edited to allow additional userid to view this hack?

No problem. :)

See my following post about the new version. :)


Edit: I released a new version initially, but I subsequently pulled it, because I wanted to make the Security settings easier to work with. Give me a bit, and I'll post the new version here. :)

Ocean 10-21-2004 07:05 PM

Hi, all! I have just released v1.2.5 of this hack.

The only changes that were made, was to allow for more flexibility in deciding who could view this hack, and the ease that you could choose which Security Layout you wanted to use (No more "remove this" or "uncomment that". Now, other than choosing which UserGroups you want to have access to this hack, you only have to change ONE variable in order to select which Security Option you want to use). :)

As before - by default, only Admins can see any of the "Who Viewed" information, and only Admins can Reset the second section.


However, if you wish to change this, there are now three options you can choose from:

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

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

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.


Regardless of which option you choose, ONLY Admins can Reset the second section.


If the default security setup is fine with you, than installation is mostly just a matter of inserting code where instructed.


However, if you want to choose any of the other security options, instructions are in the code changes for the ShowThread.php file. It's a LOT easier now. :)


If anyone wishes to upgrade from 1.2.1 to 1.2.5, all you have to do is replace the code additions to ShowThread.php and the SHOWTHREAD Template from the new instructions.

Then, if you wish to modify the security settings, follow the instructions in the ShowThread.php section to do so. :)

bnn121 10-23-2004 10:45 AM

I just finished installing your newest release...and this is one great hack...but I have one question.

If you click on the Who viewed this thread's minimize arrow to collapse that box it does just fine...but if you try the same thing with the who viewed this thread since...it does not collapse that box...it collapse the who viewed this thread since instead.

What part of the code handles the collapsing of the boxes...so I may check and see if I made an error.

Ocean 10-23-2004 02:45 PM

Quote:

Originally Posted by bnn121

I just finished installing your newest release...and this is one great hack...but I have one question.

If you click on the Who viewed this thread's minimize arrow to collapse that box it does just fine...but if you try the same thing with the who viewed this thread since...it does not collapse that box...it collapse the who viewed this thread since instead.

What part of the code handles the collapsing of the boxes...so I may check and see if I made an error.

Oops! No, that's not your error - that's mine. I never collapse those objects on my own board, so I never noticed that discrepancy.

I fixed the problem and released 1.2.6. Anyone upgrading from v1.2.5 ONLY - can just replace the code added to the SHOWTHREAD Template (Step 6), and you'll be fine.


Anyone upgrading from v1.2.1 to v1.2.6 only needs to replace the code additions to ShowThread.php in addition to the SHOWTHREAD Template. :)

Ocean 10-23-2004 04:26 PM

Alright, everyone - I have a question for you.

I'm looking at filling the requests that this hack show up as a link which opens a Pop Up Window with the requisite information.


The question I'm posing to all of you is this: if I do this, does anyone still feel that it is beneficial to be able to optionally have the information display on the thread itself (the way it does currently)?

Or would everyone unanimously prefer that it only display the information as a Pop Up?


If everyone wants it as a Pop Up, I may not retain the current format. On the other hand, if there are those who like it as it is - I may make it an option, so that you can select which format you prefer.

Let me know. :)

bnn121 10-23-2004 04:51 PM

I would like to see it as an option...Mine is set to display on admin and staff...but if this where to be visable boaRd wide...then yes a popup would be nice

rjordan 10-23-2004 07:51 PM

Personally, I think the popup is what is prefered. You might not want to see who viewed ALL topics, just the ones you really want to monitor. Besides, this might open the door for my previous request ;) !

Torqued 10-26-2004 01:06 PM

An option to do either would seem to make everyone happy. :)

Ocean 10-26-2004 04:48 PM

Quote:

Originally Posted by Torqued

An option to do either would seem to make everyone happy. :)

That's what I figured.

Well, everyone - I'm working on the next version, which will have a user-selectable option to make the "Who Viewed" information available via a Pop Up Window (or, you could choose to see them on the ShowThread page, as it is now). :)

I should have it released this week, if all goes well. :)

Ocean 10-26-2004 07:27 PM

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.

I also consolidated and cleaned up the code - so now (among other changes) there is a distinct Configuration Section in the ShowThread.php code addition.




For users upgrading from v1.2.6 (and these instructions ONLY apply to users coming from v1.2.6), download the v1.3.0 instructions and do the following:


1. Remove the code addition you previously had added to Misc.php. It is no longer needed.

2. Follow Steps 3-4 in the v1.3.0 Instructions file.

3. Replace the old (v1.2.6) code additions to ShowThread.php with the new version of code (Steps 5-6).

4. Replace the old (v1.2.6) code additions to the SHOWTHREAD Template with the new version of code (Steps 8-9).

5. Follow Steps 10-11 in the v1.3.0 Instructions file.

6. Test to make sure the hack works properly (do this BEFORE you change anything in the Configuration Section).

7. Optional: Edit the Configuration Section in the new Code you just added.


That's it!

Let me know what you think of the new Pop Up functionality! :)

Torqued 10-26-2004 07:31 PM

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. :)

:angry: Darn you for being so efficient!

I had just installed 1.2.6 this morning! :D

Thanks! Will try out the upated mod this evening. :) :banana:

Ocean 10-26-2004 07:38 PM

Quote:

Originally Posted by Torqued

:angry: Darn you for being so efficient!

I had just installed 1.2.6 this morning! :D

Thanks! Will try out the upated mod this evening. :) :banana:

Sorry about that! :)

I know how much I hate waiting weeks or months for other developers to make changes or improvements - so I try to not do the same thing.

If it really bothers you, I could start waiting a month or two longer than necessary before releasing new versions... <grin>

Torqued 10-27-2004 05:37 PM

Quote:

Originally Posted by Ocean
Sorry about that! :)

I know how much I hate waiting weeks or months for other developers to make changes or improvements - so I try to not do the same thing.

If it really bothers you, I could start waiting a month or two longer than necessary before releasing new versions... <grin>

Nooooooooo! :confused: :D

Ocean 10-27-2004 10:03 PM

Quote:

Originally Posted by Torqued

Nooooooooo! :confused: :D

Oh, all right then. Just for you, I released v1.3.1. <grin>

There are no functional changes with v1.3.1 (versus v1.3.0) - I made some minor improvements to the aesthetics, that's all.

I updated the screenshots on the first post in this thread - so you can take a look and decide if you want those changes now, or if you'd rather wait until the next functional release. :)


For anyone upgrading from v1.3.0 to v1.3.1 - just replace the code inserted into the SHOWTHREAD Template, as well as the entire contents of the WhoViewedTemplate Template. That's it. You're not overwriting any configuration settings - so it's just two quick replacements and you're completely done. :)

rh2004 12-01-2004 01:30 PM

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

Ocean 12-01-2004 01:38 PM

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.

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

rh2004 12-01-2004 01:46 PM

So for no 6 I just add:

**********

whats the CONFIGURATION ?

Ocean 12-01-2004 01:51 PM

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.

rh2004 12-01-2004 02:26 PM

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....

Ocean 12-01-2004 02:40 PM

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.

rh2004 12-05-2004 06:54 PM

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...

Ocean 12-05-2004 07:53 PM

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. :)

mtha 12-05-2004 09:22 PM

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! :)


rh2004 12-05-2004 10:19 PM

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


All times are GMT. The time now is 10:08 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01697 seconds
  • Memory Usage 2,063KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_html_printable
  • (25)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete