grebos
Forum Replies Created
-
I now rolled back to last 5.x version. I don’t want to deal with the 6.x version as long as it’s breaking core functionality of the plugin, such as search.
However, I’m still hoping this will get fixed soon, as I liked the new calendar design
Grebos
Thank you for the fast reply. I don’t fully understand what you mean by it doesn’t work? If a normal page is cached, the login system works just fine, only if a “blocked” page is cached, the problem exists.
What I mean is when you, for example, make a search on this page search test which contains the shortcode [event_search_form] you end up on this page, which is marked as the events page in the settings, and don’t stay on the search-test page. I assume this is the default behaviour and it would be hard to display results of the search directly on the search test page
Ok, Thanks.
One last question: Is it normal, that when I’m searching, in a search field created by the [event_search_form] shortcode, that the normal events page is opened to display the results?This solution would work, but this would also apply to the main events page. This should only apply to the “second events page” where I want to display and search the past events. Is there another thing I could do?
One option, which comes to my mind, would be a checkbox field, in the advanced search tab, which can be clicked, and then it would show the past events in descending order. But currently, I don’t have the time to do the programming work, so I’m still hoping for an easier solution…I finally endet up using this JavaScript plugin.
You have to add only a few lines of code to make it work:
I made a quick and dirty version where everything is inline so you probably want to load the scripts properly with the WordPress tools but here is how it works for me.
The following code is in the events-list.php template into the second if( get_option(‘dbem_css_evlist’) )You have to load the script itself:
echo '<script src="https://unpkg.com/infinite-scroll@3/dist/infinite-scroll.pkgd.min.js"></script>';And you have to insert some jquery script to make it work with the Events manager.
In order to work, you have to go to the events manager settings and go to Format –> Events format and add here in the “Default event list format header” to the most inner class where all events are added the class “events-list-container”. In default this is the tbody element: <tbody class=”events-list-container”>. You also have to add to the most outer element of the “Default event list format” the class “events-list-item”. In default this is <tr class=”events-list-item”>
The plugin is now looking for the “events-list-item” elements and adds them to the “events-list-container” element.
(The if ( $( ‘.next.page-numbers’).length ) checks whether there are Multiple pages to display, otherwise it will not activate the script and just display, that the end of the list is reached):echo " <script> jQuery(document).ready(function($) { if ( $( '.next.page-numbers').length ) { $('.events-list-container').infiniteScroll({ path: '.next.page-numbers', append: '.events-list-item', status: '.page-load-status', history: false, hideNav: '.em-pagination' }); } else{ $( '.infinite-scroll-request' ).hide(); $( '.infinite-scroll-error' ).hide(); } }); </script>";Add some message that the end of the script is reached or display a loading animation. If you dont want a loading animation, and just want to display “Loading…” you can just replace the “infinite-scroll-request loader-ellips” division by “<p class=”infinite-scroll-request”>Loading…</p>”
echo ' <div class="page-load-status"> <div class="infinite-scroll-request loader-ellips"> <span class="loader-ellips__dot"></span> <span class="loader-ellips__dot"></span> <span class="loader-ellips__dot"></span> <span class="loader-ellips__dot"></span> </div> <p class="infinite-scroll-last">End of the list</p> <p class="infinite-scroll-error">Loading of events not possible</p> </div>'."<br/>\n";If you want the loading animation, you need to insert some css style:
echo ' <style> .loader-ellips { font-size: 20px; /* change size here */ position: relative; width: 4em; height: 1em; margin: 10px auto; } .loader-ellips__dot { display: block; width: 1em; height: 1em; border-radius: 0.5em; background: #555; /* change color here */ position: absolute; animation-duration: 0.5s; animation-timing-function: ease; animation-iteration-count: infinite; } .loader-ellips__dot:nth-child(1), .loader-ellips__dot:nth-child(2) { left: 0; } .loader-ellips__dot:nth-child(3) { left: 1.5em; } .loader-ellips__dot:nth-child(4) { left: 3em; } @keyframes reveal { from { transform: scale(0.001); } to { transform: scale(1); } } @keyframes slide { to { transform: translateX(1.5em) } } .loader-ellips__dot:nth-child(1) { animation-name: reveal; } .loader-ellips__dot:nth-child(2), .loader-ellips__dot:nth-child(3) { animation-name: slide; } .loader-ellips__dot:nth-child(4) { animation-name: reveal; animation-direction: reverse; } </style>';- This reply was modified 8 years, 5 months ago by grebos.
!!Warning the solution I provided earlier does not work properly!!
It doesn’t filter the sql select but rather the event list when they get processed. Because of that it works only on the first page of results and on any further pages its not working properly.
I now use this version. In the my_teacher_conditions function it is important, that you look up the names of your databases in phpMyAdmin, since the prefix of the name can change. Here the prefix is kal_ at kal_postmeta and kal_em_events. In my case it was wp_em_events and wp_postmeta.
BTW when you use $_REQUEST instead of $_POST in the my_teacher_search_field function the search parameters wont disappear when you go to the second search pageThanks, I solved it using php get arguments to pass arguments to the filter. The filtering itself works like here
The the ics file gets now caled via the link yourwpsite.com/events.ics?mode=event_type_1function custom_em_ical_filter($args){ $mode = isset($_GET['mode']) ? $_GET['mode'] : ''; if($mode == 'event_type_1'){ $args['event_type'] = 'event_type_1'; } if($mode == 'event_type_2'){ $args['event_type'] = 'event_type_2'; } return $args; }Thanks, this work perfectly
Forum: Plugins
In reply to: [WP FullCalendar] Dropdown menus to filter events like on demo siteIs now the code from the demo site is available somewhere?
Forum: Plugins
In reply to: [WP FullCalendar] Dropdown menus to filter events like on demo siteI use the Events Manager
Hi, I implemented now a barebone email reminder function with no user interface and stuff like that. It works with WP Cron which has its issues written down here, but it should work how it is.
It should be possible to implement this with a nice user interface and placeholders for the email text… but I’m not planing to do this.
I recommend the WP Crontrol plugin tho activate and deactivate the function (Hook name is my_email_reminder_hook)register_activation_hook(__FILE__, 'my_activation'); function my_activation() { if ( ! wp_next_scheduled( 'my_email_reminder_hook' ) ) { wp_schedule_event( time(), 'hourly', 'my_email_reminder_hook' ); } } add_action( 'my_email_reminder_hook', 'my_email_reminder_function' ); function my_email_reminder_function() { date_default_timezone_set('europe/berlin'); $startTime = time(); $lastTimeChecked = $startTime; //Set the directory how you want $lastTimeChekedFileDirectory = plugin_dir_path( __FILE__ )."lastTimeCheckedFile.txt"; if(file_exists ( $lastTimeChekedFileDirectory )){ $lastTimeChekedFile = fopen($lastTimeChekedFileDirectory, "r") or die("Unable to open file!"); $lastTimeChecked = fread($lastTimeChekedFile,filesize($lastTimeChekedFileDirectory)); fclose($lastTimeChekedFile); } //Get all Events occuring between those two dates. The Formatting to dates is needet since scope only takes dates and not time as input // --> This could probably be done by adapting this code and making a custom scope according to the tutorial here: // http://wp-events-plugin.com/tutorials/create-your-own-event-scope/ // but like this it also works $lastDateCheckd = date('Y-m-d',$lastTimeChecked); $today = date('Y-m-d',$startTime); $eventArray = EM_Events::get(array('scope'=>$lastDateCheckd.','.$today)); foreach($eventArray as $EM_Event){ $eventStartTime = $EM_Event->event_start_time; $eventEndTime = $EM_Event->event_end_time; $eventStartDate = $EM_Event->event_start_date; $eventEndDate = $EM_Event->event_end_date; $allDayEvent = $EM_Event->event_all_day; $realEventEndTime; //The reminder for all day events and events with no duration comes at midnight (evening) of the end date if(($eventStartDate == $eventEndDate && $eventStartTime == $eventEndTime ) || $allDayEvent == 1){ $realEventEndTime = strtotime($eventEndDate)+ 24*60*60; //+24h (in seconds) otherwise it would come at midnight in the morning of the end date) } else{ $realEventEndTime = strtotime($eventEndDate.$eventEndTime); } //Test if event has endet since last time checked and now if($realEventEndTime >= $lastTimeChecked && $realEventEndTime < $startTime){ //Get some variables to use in the mail $eventOwner = get_user_by('id',$EM_Event->event_owner); $ownerEmail = $eventOwner->user_email; $ownerFirstName = get_user_meta($EM_Event->event_owner,'first_name',false)[0]; $eventName = $EM_Event->event_name; $emailTitle = "Feedback for $eventName"; $emailText = "Hi $ownerFirstName Some text ... your event $eventName has endet ... Please give a feedback under following link... This is an automatically generated e-mail"; //send the mail wp_mail( $ownerEmail, $emailTitle, $emailText); } } $myfile = fopen($lastTimeChekedFileDirectory, "w") or die("Unable to open file!"); fwrite($myfile, $startTime); fclose($myfile); }I have a similar problem, since I haven’t activated the booking stuff, the “booking email template” tab isn’t shown in my settings menu and even when activating, I didn’t see the option (or at least I didn’t see it). Is there a template which could to be adapted to setup this email triggered by the event_end_date? Don’t worry I know you are not allowed to help me with coding stuff, but giving me a starting hint, would be nice 😉
I could make it work in the meantime: Here is the needed code, to insert a checkbox or a drop down menu into the advanced search
// START EM Custm Attribute search /* The idea is comming from here: http://www.beetlebrow.co.uk/about-us/beetle-blog/wordpress-event-manager-plugin-adding-custom-event-attribute I just changed some things since it didn't work for me and made it to an checkbox --> The dropdown variant is commented Create a new search attribute form entry for our new Event Attribute "myAttribute" (#_ATT{myAttribute}) The values are hard-coded but could probably be automatically selected Add this field to the search form using an EM action. nb. The action doc'd here http://wp-events-plugin.com/tutorials/adding-custom-event-search-form-fields/ does not seem to exist so use the footer one for inclusion in advanced search or the header one for normal search. Read the source Luke. */ function my_myattribute_search_field(){ ?> <div class="em-search-myattribute em-search-field"> <span>My attribute name</span> <input type="checkbox" name="myAttribute" value="myAttributeDefaultValue" <?php echo ((array_key_exists('myAttribute', $_POST)) && $_POST['myAttribute'] == "myAttributeDefaultValue") ? 'checked':''; ?>> <!-- <select name="myAttribute"> <option value=''>all options</option> <option value="option1" <?php echo ((array_key_exists('myAttribute', $_POST)) && $_POST['myAttribute'] == "option1") ? 'selected="selected"':''; ?>>option1</option> <option value="option2" <?php echo ((array_key_exists('myAttribute', $_POST)) && $_POST['myAttribute'] == "option2") ? 'selected="selected"':''; ?>>option2</option> </select> --> </div> <?php } add_action('em_template_events_search_form_footer', 'my_myattribute_search_field'); // /* Hook the new search attribute myAttribute into default search filter, so it isn’t ignored when Events Manager creates an events search query */ function my_myattribute_search($searches, $array){ if( !empty($array['myAttribute']) ){ $searches['myAttribute'] = $array['myAttribute']; } return $searches; } add_filter('em_events_get_default_search','my_myattribute_search',1,2); /* The next step is to add the function Events Manager needs to narrow down its results. In this case, we’re going to filter the results of an EM_Events::get() request via the em_events_get filter: Here one may wants to adjust the second if, such that it fitts the values which are saved */ add_filter('em_events_get','my_em_myAttribute_events_get',1,2); function my_em_myAttribute_events_get($events, $args){ if( !empty($args['myAttribute'])){ foreach($events as $event_key => $EM_Event){ if( $args['myAttribute'] != $EM_Event->event_attributes['myAttribute']){ unset($events[$event_key]); } } } return $events; } // // END EM Custom Attribute SearchNo problem, I found an older simmilar Post, where you linked to this site: http://www.beetlebrow.co.uk/about-us/beetle-blog/wordpress-event-manager-plugin-adding-custom-event-attribute
I tried this code, but when activating the filter, no results are shown. Is it possible, that the sql search is wrong?
$conditions['teacher'] = " (kal_em_events.post_id IN ( SELECT post_id FROM kal_postmeta WHERE (kal_postmeta.meta_key = 'teacher' AND kal_postmeta.meta_value = '$teacherval')))";btw i also tried the action hook em_template_events_search_form_ddm documented here and it doesn’t seem to work… (This is also mentioned on the website above and they found a way arround this)