- This topic has 2 replies, 2 voices, and was last updated 12 years, 10 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘How do I …’ is closed to new topics and replies.
Events Made Easy › Forums › How do I … › Customising SQL
I want to check for where logged in user == “guest” and if so only look at public events for the widget on the side menu
I’ve even hard-coded the SQL statement. But it doesn’t make any difference?
Is there anything I should look for?
Two Ways I’ve tried this
if ($this_event == STATUS_PRIVATE && !is_user_logged_in()) {
continue;
}
if ($this_event == STATUS_PRIVATE && $current_userid != “guest” ){//TJB
continue;
}
OR IN SQL ITSELF
if ($where != “”)
$where = ” WHERE ” . $where . ” AND event_status = 1″ ; //TJB
$sql = “SELECT *,
DATE_FORMAT(event_start_date, ‘%e’) AS ‘event_start_day’,
DATE_FORMAT(event_start_date, ‘%m’) AS ‘event_start_month’,
DATE_FORMAT(event_start_date, ‘%Y’) AS ‘event_start_year’,
DATE_FORMAT(event_start_time, ‘%k’) AS ‘event_start_hh’,
DATE_FORMAT(event_start_time, ‘%i’) AS ‘event_start_mm’,
DATE_FORMAT(event_start_time, ‘%h:%i%p’) AS ‘event_start_12h_time’,
DATE_FORMAT(event_start_time, ‘%H:%i’) AS ‘event_start_24h_time’,
DATE_FORMAT(event_end_date, ‘%e’) AS ‘event_end_day’,
DATE_FORMAT(event_end_date, ‘%m’) AS ‘event_end_month’,
DATE_FORMAT(event_end_date, ‘%Y’) AS ‘event_end_year’,
DATE_FORMAT(event_end_time, ‘%k’) AS ‘event_end_hh’,
DATE_FORMAT(event_end_time, ‘%i’) AS ‘event_end_mm’,
DATE_FORMAT(event_end_time, ‘%h:%i%p’) AS ‘event_end_12h_time’,
DATE_FORMAT(event_end_time, ‘%H:%i’) AS ‘event_end_24h_time’
FROM $events_table
$where” ;
Note: hardcoding this to see if it had any effect.Not the way I want to it to be in real life
Does seem to affect the listing at all?
What am I doing wrong?
it all depends on where in the code you actually change this 🙂
I realise that. I changed it in for all SQLs in eme_events.php to make sure. I changed the sQL to read only public events. In my database I have only private events. However, the widget still listed all events when there should have been none. I’ve refreshed Internet Explorer and I’ve even removed the temporary Internet files.Just doesn’t seem to have any effect.
Note. I’m only doing this to see what difference it makes to the website.