PDA

View Full Version : Forum Home Enhancements - Another Members that have Visited Statistics mod


Marco van Herwaarden
01-01-2007, 10:00 PM
This modification will make it possible to show statistics on the number of members that have visited. There are other modifications of this type, this one is however aimed at busy boards and written with performance in mind. Statistics are not real-time, but by default updated every 10 minutes by a cron.

Features:
- No extra queries on Forum Homepage
- 3 Timespans settible to show statistics for
- Optional show the membernames that have visited during the first timespan
- Information is collected by Scheduled Task to prevent processing on Forum Home
- Optional use filesystem caching
- Plus more optional settings
- This modifcation will not list the names of Members that are set to Invisible!

Please note that this is not marked as supported, as i don't have much time for that.

Changelog:
2007-01-19: v1.0.2
- Warning: implode() [function.implode]: Bad arguments. in /includes/cron/mh_mv_stats.php on line 144
This is caused by a changed behaviour between MySQL 4.1 and 5.x.
Changed:
AND NOT options & 512
To:
AND NOT (options & 512)
2007-01-02: v1.0.1
- Initial release

sensimilla
01-02-2007, 02:54 PM
Thanks for it Marco, does it look on the forumhome like regular whosonline members list ?

Thanks

gunitman247
01-02-2007, 06:12 PM
ill give it a try. thanks :)

Shazz
01-02-2007, 10:47 PM
If anyone has it installed, many people waiting for a screen shot :D

Is this like members who have visited in the last 24 hours? and guets visit
Or just members who have visited...
(both made by paul M )

TheWhite
01-03-2007, 03:09 AM
does this combine both members and guests?

Marco van Herwaarden
01-04-2007, 07:04 AM
If i have time i will make some screenshots in a bit. I have it running on a board where i could make some screenshots (no use making screenshots from my localhost as there are not many visiting my localhost ;)).

To answer some of the other questions:

Yes this is like the Members Visisted Today, with the following differences:
- Optimised for bigger boards
- All information is collected by a Scheduled Task, no queries run on your forum home page
- List total members visited for up to 3 timespans (default 24 hours, 7 days, 30 days)
- Will show the list of membernames for the first timespan (24 hours). You can optinally maximize the number of names listed on the forumhome page (reduce page size!). If more members have visited, you will get a link to a second page where the full list can be shown.
- You can choose to only show the names, apply their usergroup HTML markup, or link to their profiles. All these options are to allow for further reduction of the pagesize of forumhome.
- Can store the info in either datastore or filesystem (usefull with a caching like APC)

Will it also list guests: No

Background on this mod:
I am server admin for a site that has between 600 ad 1.600 members online. The owner loves member statistics, but other modifications added too much processing, and maybe more important they increased the pagesize with sometimes more then 500K :eek: (consider 6.000+ unique members visiting each day, take the size of their names, HTML markup, HTML-code to link to their profiles etc....). This was written to both keep the size of the forumhome page low, with less processing needed on forumhome and still be able to show the statistics.

Marco van Herwaarden
01-04-2007, 07:15 AM
Ok, screenshots added

PS Deleted all posts only asking for a screenshot.

Shazz
01-04-2007, 12:52 PM
If i have time i will make some screenshots in a bit. I have it running on a board where i could make some screenshots (no use making screenshots from my localhost as there are not many visiting my localhost ;)).

To answer some of the other questions:

Yes this is like the Members Visisted Today, with the following differences:
- Optimised for bigger boards
- All information is collected by a Scheduled Task, no queries run on your forum home page
- List total members visited for up to 3 timespans (default 24 hours, 7 days, 30 days)
- Will show the list of membernames for the first timespan (24 hours). You can optinally maximize the number of names listed on the forumhome page (reduce page size!). If more members have visited, you will get a link to a second page where the full list can be shown.
- You can choose to only show the names, apply their usergroup HTML markup, or link to their profiles. All these options are to allow for further reduction of the pagesize of forumhome.
- Can store the info in either datastore or filesystem (usefull with a caching like APC)

Will it also list guests: No

Background on this mod:
I am server admin for a site that has between 600 ad 1.600 members online. The owner loves member statistics, but other modifications added too much processing, and maybe more important they increased the pagesize with sometimes more then 500K :eek: (consider 6.000+ unique members visiting each day, take the size of their names, HTML markup, HTML-code to link to their profiles etc....). This was written to both keep the size of the forumhome page low, with less processing needed on forumhome and still be able to show the statistics.

Thanx for the info marco, I don't run a big board, but if it does reduce some database load as it can carry over to file system I may consider using it.

Marco van Herwaarden
01-05-2007, 09:22 PM
It does reduce the load compaired to a modification that would query the database for each load of the homepage (sorry i don't know for sure how other mod's are coded).

TheWhite
01-06-2007, 01:31 AM
well if it summed the members and guests it would have been an excellent mod but as it is i'll stick with the other one anyway good work :)

HPIA
01-06-2007, 01:50 AM
This is good for Big boards...

joeychgo
01-07-2007, 06:33 PM
well if it summed the members and guests it would have been an excellent mod but as it is i'll stick with the other one anyway good work :)



Agreed...

Steve B
01-17-2007, 09:14 AM
Just tried this and I am getting the following error when the cron is run..

Gather Statistics on Members Visited

Warning: implode() [function.implode]: Bad arguments. in /includes/cron/mh_mv_stats.php on line 144

Done

line 144 reads
, '" . $vbulletin->db->escape_string(implode(", ", $names_a_short)) . "'

I have tried it with both the database writing and also the file writing with the same error.

Any ideas please?

Marco van Herwaarden
01-17-2007, 10:25 AM
What PHP version are you using?
What is the setting for the number of names to show on your forum home in your vBulletin Options?
And how many members did you aproximatly had online during the last day?

Steve B
01-17-2007, 10:59 AM
Details as requested.

PHP 4.4.4
Number of names: 200
Test site with closed access apart from 4 mods: its showing no names at all, but under Members Visited Statistics: Last 24 Hours: 1 - Last 7 Days: 2 - Last 30 Days: 4 which seems to be right?

I do currently have show names activated, Clickable Membernames for First Timespan list set to yes and Use Usergroup Markup for Member names enabled as well.

Marco van Herwaarden
01-18-2007, 10:35 AM
I would need to do some debugging to find why this is happening. If you want this solved, then please PM me with AdminCP and FTP access details to your board.

Steve B
01-18-2007, 02:15 PM
Cheers

PM sent :)

farooqaaa
01-18-2007, 04:53 PM
Thanks alot! this is nice. Installed!

Al-Fateh
01-18-2007, 04:59 PM
I installed the mod, however the members names who actually keep visiting the site are not shown on the list...

is there something wrong?

Al-Fateh
01-18-2007, 05:22 PM
here is an attachment to view the issue

sportsoutlaw
01-19-2007, 02:52 AM
Just tried this and I am getting the following error when the cron is run..



line 144 reads
, '" . $vbulletin->db->escape_string(implode(", ", $names_a_short)) . "'I have tried it with both the database writing and also the file writing with the same error.

Any ideas please?

I installed the mod, however the members names who actually keep visiting the site are not shown on the list...

is there something wrong?

I have both of these issues.

php 4.4.4
Set to 200 members, which is lower than what I actually would have.

thincom2000
01-19-2007, 03:57 AM
line 144 reads
, '" . $vbulletin->db->escape_string(implode(", ", $names_a_short)) . "'

I have tried it with both the database writing and also the file writing with the same error.

Any ideas please?

I have both of these issues.

I don't have this mod installed, but by the looks of line 144, it could be causing both.

Try changing line 144 to:
, '" . $db->escape_string(implode(", ", $names_a_short)) . "'

If what I say below is true, then this shouldn't change much, except make your code cleaner.


Test site with closed access apart from 4 mods: its showing no names at all, but under Members Visited Statistics: Last 24 Hours: 1 - Last 7 Days: 2 - Last 30 Days: 4 which seems to be right?

This would result in you having only 1 value for $names_a_short which either wouldn't count as an array (but you would get the error 'supplied argument is not an array') OR implode() just wouldn't be happy imploding less than 2 pieces. There is nothing in the php.net documentation about this, though, so it might not be the issue. Just a thought.

In any case, is there a check to do the following?
if (count($names_a_short) < 2)
{
// no commas necessary
$whatever_the_string_is = $db->escape_string($names_a_short);
}

EDIT: Having downloaded the code, and looking at it, the problem seems to be at line 82:
$names_a_short = $names_a_short[0];

Looking back at line 81, we see that $names_a_short[0] is in fact from an array, multi-dimensional thanks to array_chunk():
$names_a_short = (intval($vbulletin->options['mh_mv_max_forumhome']) == 0 ? array($names_a) : array_chunk($names_a, intval($vbulletin->options['mh_mv_max_forumhome'])));

The array $names_a_short is formed from whatever $names_a is. The most recent definition of $names_a is line 73, where it is compressed to a single-level array:
$names_a["$name[username]"] = $names_a["$name[username]"]['username'];

Thus, even though my logic makes no sense, this error makes no sense. Line 82 turns record 0 of the multi-level array not into another array, but into a string "Array". And we cannot implode a string...

Comment out line 82 and change line 144 to:
, '" . $db->escape_string(implode(", ", $names_a_short[0])) . "'

OR

Change line 82 to:
$names_a_short = array_merge($names_a_short[0]);

Marco van Herwaarden
01-19-2007, 07:24 AM
I installed the mod, however the members names who actually keep visiting the site are not shown on the list...

is there something wrong?
make sure you have set the member names to show in the vBulletin Options, and that the Scheduled Task has ran since you turned on showing membernames.

Marco van Herwaarden
01-19-2007, 08:33 AM
Version 1.0.2 released to fix a bug with MySQL 4.x

Changelog:
2007-01-19: v1.0.2
- Warning: implode() [function.implode]: Bad arguments. in /includes/cron/mh_mv_stats.php on line 144
This is caused by a changed behaviour between MySQL 4.1 and 5.x.
Changed:
AND NOT options & 512
To:
AND NOT (options & 512)

Marco van Herwaarden
01-19-2007, 08:36 AM
Warning: implode() [function.implode]: Bad arguments. in /includes/cron/mh_mv_stats.php on line 144
As per my previous post, this was caused by a change in behaviour between MySQL 4.x (tested on 4.1.21) and 5.x (development was done on 5.0). The WHERE-clause that should filter members that are set to invisible was causing the query to return no results with MySQL 4.1.21.

Adding () around the condition solved the problem. Also added test to avoid errors if no members returned.

Steve B
01-19-2007, 12:58 PM
Thank you for taking the time to fix this.

Its now installed on our live site and working well :)

sportsoutlaw
01-19-2007, 01:07 PM
Thanks Marco, it seems to be working perfectly for me now.

Al-Fateh
01-19-2007, 01:15 PM
working great now!!!

thincom2000
01-19-2007, 03:09 PM
Haha, or caused by $db->num_rows($names_a_short) < 1

That could work too. Glad you worked it out.

PinkDaisy
03-06-2007, 06:26 PM
This isn't showing at all for me, I did all the instructions on installing. ???

PinkDaisy
03-06-2007, 06:34 PM
Okay, nevermind. This seems to be okay, I updated and ran a time that ran and it worked!!

Terminatoronly
03-24-2007, 12:36 PM
thanks alot installed :)

dbirosel
03-25-2007, 06:59 AM
saving this mod to be installed when i get home. subscribed.

Marco van Herwaarden
03-30-2007, 08:36 PM
thanks alot installed :)
Then please click install. ;)

kylek
08-19-2007, 08:28 PM
Is there any way possible to hide a member from not showing? We have an admin account that is hidden from all (who's online, current active users, etc) and would love to try this one out as the other Members Who Visited Today has no way to block a userid.

Marco van Herwaarden
08-20-2007, 08:49 AM
No there is no such option in this modification.

You are however probably using another modification to hide these members, i guess that modification would need to be adjusted for this.