PDA

View Full Version : Time that the matches start or finish



Daniel
20-08-2015, 02:38 PM
Hi support,

We just installed the Master-League Pro edition and we are trying to get accustomed to the software. We have two problems with the time that the match starts or finishes.

In the frontend:
For example, we created a match to begin at 12:35, but the users were allowed to post their predictions even after that time has passed (i.e. even after 12:35).

In the backend:
After the match ended we navigated to the "add score" section but we faced the notification "No ended matches found". So we had to navigate to the "Edit matches" and select the matches as finished. Even then, the "add score" section was displaying the notification "No ended matches found". Therefore, we posted the score through the "Edit matches" section as well.

Can you check it please?

Regards,

Dan G

Daniel
27-08-2015, 09:59 PM
This is a kind reminder for the above.

kostas
28-08-2015, 01:12 AM
It seems that your server is running on different timezone, you can edit the timezone with PHP.ini file

create a `php.ini` file in your root directory and add the following line

date.timezone = "Europe/Berlin"

but instead the "Europe/Berlin" you will have to add your timezone,
you can find all the available timezones here

http://php.net/manual/en/timezones.php

Daniel
29-08-2015, 01:08 AM
Dear Kostas,

Thank you for the prompt response. We created a php.ini file and placed it in /public_html (using a Go Daddy host). Then we killed PHP processes from the CPanel but the problem is not solved. We even contacted Go Daddy support and they told us that we can change the timezone only through php coding. Please help.

Regards,

Dan G

kostas
29-08-2015, 11:40 AM
Ok one other way to change your timezone is through the .htaccess file , add the following line in your .htaccess file (if it not exists create it)

SetEnv TZ Europe/Berlin

if this way won't work too, you will have to add the code into the component files, that will look like this :



<?php
date_default_timezone_set('Europe/Berlin');


you can find all the available timezones here : http://php.net/manual/en/timezones.php

Daniel
30-08-2015, 07:14 PM
Dear Kostas,

The change in the .htaccess did not work either.

We then inserted the code into the masterleaguepro.php just right after the "<?php" and the problem was solved for the first point:
"In the frontend:
For example, we created a match to begin at 12:35, but the users were allowed to post their predictions even after that time has passed (i.e. even after 12:35). "

The second point was not solved.
"In the backend:
After the match ended we navigated to the "add score" section but we faced the notification "No ended matches found". So we had to navigate to the "Edit matches" and select the matches as finished. Even then, the "add score" section was displaying the notification "No ended matches found". Therefore, we posted the score through the "Edit matches" section as well. "

Do you mean to insert the "date_default_timezone_set('Europe/Berlin');" code in every php file of the component? We tried it for the playerprediction.php, matchresults.php and the matches.php but the second problem was not solved. Please let us know which php files are affected in order to insert the code.

Regards,

Dan G

kostas
31-08-2015, 11:01 AM
For the backend you will have to add the timezone code into the file <joomla path>/administrator/com_masterleaguepro/models/addscore.php

after the line


public function getMatches(){


we will fix the issue in next updates and the timezone would be set from the Joomla Global Configurations

Daniel
01-09-2015, 12:00 AM
Dear Kostas,

Thank you very much. This is working for the backend as well. There is another issue that we noticed right now after the above two issues have been fixed.

Once the match is finished, we can see the finished match in the "match results" tab and we can add a score through the back end "add scores" feature. Once we add a score, the "match results" tab is updated with the score, the "standings" tab is updated with the points earned by the user, BUT once we click on a user's name from the "standings" tab the finished match is not displayed in the user's predictions for the matchday (it has 3 hours difference - timezone problem once again).

It seems that we need to change the timezone for the player predictions page as well. We tried to insert the "date_default_timezone_set('Europe/Berlin');" code in the playerprediction.php in the root/component/com_masterleaguepro/models and in the playerpredictions/php in the root/administrator/component/com_masterleaguepro/models but no luck solving the problem. Please let us know where we have to insert the code.

Regards,

Dan G

kostas
01-09-2015, 10:33 AM
The user prediction history is not related with the time, there should be another issue , but it seems you are using the altered code that display matches even if user has not predicted those matches from this thread http://www.multihosting.com/support/forum/showthread.php/85-Playerprediction-results-page

you will have to change the

CURRENT_TIMESTAMP() , because it is a database function , so it uses the server's timezone

so at the file
<joomla directory>/components/com_masterleaguepro/models/playerprediction.php line 39

change the line

" WHERE m.matchday_id = ".$matchday." AND m.match_start_time < CURRENT_TIMESTAMP() ";

TO

" WHERE m.matchday_id = ".$matchday." AND m.match_start_time < ".date("Y-m-d H:i:s");

now the time will be provided via PHP function to the database query

Daniel
01-09-2015, 08:49 PM
Dear Kostas,

We put the code:
" WHERE m.matchday_id = ".$matchday." AND m.match_start_time < ".date("Y-m-d H:i:s");

But we receive the following error:
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '19:44:06' at line 1 SQL=SELECT m.match_start_time,th.name as home,ta.name as away,m.home_score,m.away_score,pp.home_prediction, pp.away_prediction,pp.points FROM `jos_masterleaguepro_match` m INNER JOIN `jos_masterleaguepro_teams` th ON th.id=m.home_team INNER JOIN `jos_masterleaguepro_teams` ta ON ta.id=m.away_team LEFT JOIN `jos_masterleaguepro_player_prediction` pp ON pp.match_id=m.id AND pp.user_id=473 WHERE m.matchday_id = 5 AND m.match_start_time < 2015-09-01 19:44:06Please help.

Regards,

Dan G

kostas
02-09-2015, 10:20 AM
Sorry for the mistake

the code you have to add is this



" WHERE m.matchday_id = ".$matchday." AND m.match_start_time < '".date("Y-m-d H:i:s")."'";

Daniel
02-09-2015, 09:23 PM
Dear Kostas,

It works perfectly now. Thank you.

Regards,

Dan G