- This topic is empty.
-
AuthorPosts
-
November 2, 2011 at 2:11 pm #35020jbopeParticipant
Unfortunately, I have not yet learned PHP. (working on javascript at the moment)
I am hoping someone can point me in the right direction to correct this problem.
I am using a wordpress plugin called “gigs calendar”. It lists gig dates for bands. It is not really supported though I have posted the issue on the authors site. You can find the plugin page here http://wordpress.org/extend/plugins/gigs-calendar/
You can see my install here. http://thishope.org/schedule/?page_id=5
You will notice that the two events on Nov 20 are not listed in the correct order (PM comes first). It does not matter how I enter them, they always list like this.
I don’t even know which part of the code to post along with this question.
I am hoping someone can get me started on what to look for or which part of the code to post here for eveluation.
Thanks in advance.
November 5, 2011 at 7:21 am #90215lyleyboyMemberThe first thing you need to do is to look in the database to see what format the date/time is in.
Then we can look at adapting the SQL query.
February 13, 2012 at 4:45 pm #96647February 13, 2012 at 4:52 pm #96648jbopeParticipantWait… I found a “tables.sql” in the folder for the plugin.
Oped it and it says “time default NULL” in the “time” code.
Is that what you are looking for?
February 13, 2012 at 7:07 pm #96653bungleMemberthat file is just the file that creates the tables presumably, the time default NULL just means the time field will be blank by default.
What you are looking for the query lines some of which are found inside gigs-classes.php (i haven’t looked through all the other files)
At line 303 you find a query being built inside the search() function
$this->_rows = $this->wpdb->get_results('SELECT * FROM `' . $this->_table . '` ' . ($where !== null ? 'WHERE ' . $where : '') . ($order !== null ? ' ORDER BY ' . $order : ''));
This query is ordering the results by whatever the $order specifies, a variable passed to the order function.
The getPerformances() function for example is passing time as the $order
function getPerformances() {
$p = new performance();
if ( $this->id ) {
$p->search("`gigID` = " . (int) $this->id, "`time`");
}
return $p;
}
I can’t access your site right now to look as it appears to be a little broken, maybe its just as simple as reversing the order from ASC to DESC, are the times unordered or in the wrong order?
February 13, 2012 at 9:13 pm #96659jbopeParticipant@bungle – Thanks for looking at this for me. I found the file and the query. Not sure how to address it. I can’t find ASC or DESC.
The page is up for me now. Not sure what was wrong. http://thishope.org/schedule/
I have three events posted. The first two posted in correct order am to pm. The next two do not (pm-am)
They are ordered correctly by date but the time of day does not seem to order them. Do I need to add something to make this happen?
February 13, 2012 at 10:38 pm #96660bungleMemberThe problem may be that it isn’t specifying ASC or DESC so it’s returning in no specific order. Give me an hour or two and I’ll take a look at it again.
February 13, 2012 at 10:51 pm #96661bungleMemberWorse yet it may not be storing time in a sortable format rather as a string. I’ll take a look.
February 13, 2012 at 11:37 pm #96563February 13, 2012 at 11:51 pm #96663bungleMemberThe broken part is when i click on the Schedule link from the schedule page. Its trying to load http://thishope.org/schedule/schedule.php rather than /schedule.php so maybe you need to make sure your menu links are prefixed with /
I can’t find a way to navigate to Nov? how are you getting to there?
February 13, 2012 at 11:54 pm #96664bungleMemberthe SQL is storing the time in time format so that’s good news
Can you try modifying line 534 of gigs-classes.php so that instead of
$p->search("`gigID` = " . (int) $this->id, "`time`");
it reads
$p->search("`gigID` = " . (int) $this->id, "`time` ASC");
and see if anything changes? If that doesn’t work try
$p->search("`gigID` = " . (int) $this->id, "str_to_date(`time`,'%l:%i')");
February 14, 2012 at 12:12 am #96665bungleMemberI may have messed up the quoting in that last one
If that one breaks your php then try
$p->search("`gigID` = " . (int) $this->id, "str_to_date(`time`,`%l:%i`)");
March 1, 2012 at 2:33 pm #97850 -
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.