Support Hours

Monday - Friday
9am - 5pm
Saturday
10am - 4pm
Sunday
Closed
Our Current Time
06 March 2021
02:53
Your Current Time

Announcements

We have recently been working hard migrating our websites over to a new hosting provider so if you experience any problems please let us know so we can fix them as soon as possible.

Steven Palmer

Contact Us

Week Start - Thursday?

More

Week Start - Thursday?

Hello there!

I've been trying out CoalaWeb Traffic for use as a counter, and so far I'm really liking what I see. There is, however, one problem.

For various reasons, I need to count hits week-to-week from Thursday to Thursday. That is to say, a week for me starts and ends on Thursdays. I've seen that there are options for Week Start in the General Options section, but sadly it's limited to only 3 days (Sun through Mon). Is there any way of opening this up so I'd have it functioning as I need?

I'd be able to make do if not if only the week's worth of hits counted the last 7 days, not the number since the Week Start day.

Anyway, thanks for your help. :)

Ross

Please Log in or Create an account to join the conversation.

More

Week Start - Thursday?

Moderator

Hi Ross,

I have to say you are first person to ask for a week start on a Thursday :)

Let me have look and I will get back to you.

Thanks,

Steve


Hi! I'm Steve the founder and head developer of CoalaWeb design studios. I'm an avid supporter of open source projects and the GPL license.

The following user(s) said Thank You: Daemon

Please Log in or Create an account to join the conversation.

More

Week Start - Thursday?

Moderator

So to get your week starting on Thursday open up the helper.php file found here:

modules -> mod_coalawebtraffic

Then move down to line 58 and you should see this chunk of code like this:
switch ($weekDayStart) {
            case 'sat':
                $weekstart = $daystart - ((date('N') + 1) * 24 * 60 * 60);
                break;
            case 'sun':
                $weekstart = $daystart - (date('N') * 24 * 60 * 60);
                break;
            case 'mon':
                $weekstart = $daystart - ((date('N') - 1) * 24 * 60 * 60);
                break;
            default:
                $weekstart = $daystart - ((date('N') - 1) * 24 * 60 * 60);
                break;
        }

Just after that enter this line of code
$weekstart = $daystart - ((date('N') - 4) * 24 * 60 * 60);

now your week is starting on Thursday.

Things to note:
You will have to add this line on each update of the CoalaWeb Traffic extension.

Thanks,

Steve


Hi! I'm Steve the founder and head developer of CoalaWeb design studios. I'm an avid supporter of open source projects and the GPL license.

The following user(s) said Thank You: Daemon

Please Log in or Create an account to join the conversation.

More

Week Start - Thursday?

Hi Steve!

Thanks, that's amazing. :cheer:

I've set that up, and I'll give it a proper test in the coming weeks, but I've no reason whatsoever to doubt it works at this point.

Thanks so much!

Ross

Please Log in or Create an account to join the conversation.

More

Week Start - Thursday?

Moderator

Hi Ross,

It was lucky that you asked me on Friday so when I was doing my initial testing its was easy to check the Total was correct by adding Yesterday to Today but I encourage you to do your own testing as you mentioned just in case there are any issues.

Let me know if you find anything and we can work through a solution.

Cheers,

Steve


Hi! I'm Steve the founder and head developer of CoalaWeb design studios. I'm an avid supporter of open source projects and the GPL license.

Please Log in or Create an account to join the conversation.

Time to create page: 0.115 seconds

GET IN TOUCH

We will be glad to help you with any general or technical questions.