Forum Replies Created

Viewing 15 replies - 16 through 30 (of 72 total)
  • Thread Starter Gerald

    (@gerital)

    Thanks for your help. I tried to call mobmenuClosePanel( ‘mobmenu-right-panel’ ); from my theme, but it failed with Uncaught ReferenceError: mobmenuClosePanel is not defined.

    But it worked out using directly the code from the named function:

    $(".mobmenu-panel .menu-item").click(function() {
    	//mobmenuClosePanel( 'mobmenu-right-panel' );
            $( '.mobmenu-right-panel' ).toggleClass( 'show-panel' );
            $( 'html' ).removeClass( 'show-mobmenu-filter-panel' );
            $( 'body' ).removeClass( 'show-nav-right' );
            $( 'body' ).removeClass( 'show-nav-left' );
            $( 'html' ).removeClass( 'mob-menu-no-scroll' );
    });
    Thread Starter Gerald

    (@gerital)

    This issue just got resolved by the developers of GDPR Cookie Compliance plugin and WP Multilang now is officially compatible with this plugin.

    • This reply was modified 5 years, 9 months ago by Gerald.
    Thread Starter Gerald

    (@gerital)

    Hi,

    you’re the best. Thanks a lot for making it compatible with WP Multilang plugin.

    1000 thanx!

    Thread Starter Gerald

    (@gerital)

    Finally I managed to get the flexible slots running. I followed the approach drafted in the above question, here the code:

    function custom_create_appointment( $appointment_id, $appointment_data ) {
    	global $wpdb;
    
    	// get event id
    	$eventId = ($wpdb->get_row("SELECT value from wp_ea_fields WHERE app_id=".$appointment_id." AND field_id=5"))->value;
    
    	// get event duration (in seconds)
    	$duration = wp_get_attachment_metadata(get_post_meta($eventId, "duration", true));
    
    	// check if podcast lasts longer than slot of 30 minutes
    	if ($duration > 1800) {
    
    		// change end time of podcast
    		$slots = ceil($duration/1800);
    		$endtime = strtotime($appointment_data["start"]) + $slots*30*60;
    		$endtimeStr = date('H:i:s', $endtime);
    
    		// check if new endtime interferers with following event
    		$interfereEvent = $wpdb->get_results("SELECT * from wp_ea_appointments WHERE date='".$appointment_data["date"]."' AND end_date='".$appointment_data["end_date"]."' AND start < CAST('".$endtimeStr."' AS time) AND end > CAST('".$endtimeStr."' AS time)");
    		if (count($interfereEvent) < 1) {
    
      			$wpdb->update(
    				"wp_ea_appointments", 
    				array("end"=>$endtimeStr), 
    				array("id"=>$appointment_id)
    			);
    		}
    	}
    
    }
    add_action( 'ea_new_app_from_customer', 'custom_create_appointment', 10, 2 );

    This approach has the limitation that you can fill available slots with events which are longer than the slot, so users have to be careful!

    • This reply was modified 6 years, 1 month ago by Gerald.
    • This reply was modified 6 years, 1 month ago by Gerald. Reason: add condition so next events don't get interferred
    Thread Starter Gerald

    (@gerital)

    I tried to print the $appointment_data and the above error message comes from print_r($appointment_data); which seems to destroy the JSON returned to calendar.

    So finally I print the data using this statement:

    error_log(urldecode(http_build_query($appointment_data)));

    Thread Starter Gerald

    (@gerital)

    I use the following template code to write the JSON file:

    <?php
    /**
    	Template Name: Programació JSON
    
    	Gets all appointments and associated podcast data from DB
    */
    
    header('Content-Type: application/json; charset=utf-8');
    $fp = fopen('php://output', 'w');
    
    $params = array();
    
    $query_programacio = $wpdb->prepare("SELECT id,date,start
    	FROM wp_ea_appointments
    	WHERE date >= CURDATE()
    	ORDER BY date ASC,start",
    	$params
    );
    $programacio = $wpdb->get_results($query_programacio);
    
    //echo json_encode(array("data" => $programacio));
    
    $i = 0;
    foreach ($programacio as $prog) {
    	$query_podcast = $wpdb->prepare("SELECT value
    		FROM wp_ea_fields
    		WHERE app_id=$prog->id AND field_id=5",
    		$params
    	);
    
    	$podcast->id = (int)$wpdb->get_results($query_podcast)[0]->value;
    
    	$programacio[$i]->title = get_post($podcast->id)->post_title;
    	$programacio[$i]->author_id = get_post($podcast->id)->post_author;
    	$programacio[$i]->author_name = get_the_author_meta('display_name', $programacio[$i]->author_id);
    
    	$i++;
    }
    
    echo json_encode(array("podcasts" => $programacio));
    
    fclose($fp);
    
    ?>
    Thread Starter Gerald

    (@gerital)

    Finally I ended up writing a template for my theme. I first write all the events as JSON file and second made a theme template using fullcalendar to show them on front end.

    I don’t know if there is a hook or another more elegant way to do that, the only solution I can offer you is to manually change the plugin code. Attention: This has to be redone after every update of the plugin!

    You have to change the access rights which are limited to admins at line 790 of ajax_report function of wp-content/plugins/easy_appointsments/src/ajax.php from:

    $this->validate_access_rights();

    To this:

    $this->validate_access_rights_editor();

    Then you have to define this new function:

    private function validate_access_rights_editor()
    {
        if (!current_user_can( 'edit_pages' )) {
            header('HTTP/1.1 403 Forbidden');
            die('You don\'t have rights for this action');
        }
    }
    • This reply was modified 6 years, 5 months ago by Gerald.
    • This reply was modified 6 years, 5 months ago by Gerald.

    It works for me so maybe there is something wrong with the time settings on your server? Try to put different values (60, 120, 180, …) and check if available appointments change in the calendar.

    Just added a pull request to add catalan language flag: https://github.com/VaLeXaR/wp-multilang/pull/44

    thanks
    G>

    Plugin Contributor Gerald

    (@gerital)

    Actually I have it in one line in the text tab, exactly as I posted it in the last message. Seems that WordPress is doing some HTML cleanup before saving it to the database.

    • This reply was modified 6 years, 10 months ago by Gerald.
    Plugin Contributor Gerald

    (@gerital)

    There is a final detail with the generated popup markup. Probably it’s an issue with layer.bindPopup( text ). I’m adding more HTML markup to the geojson shortcode, like this:

    [leaflet-geojson]<h3><a href="https://xrcb.exo.cat/?p={id}">{title}</a></h3>{barrio}<br>Radio {categoria}[/leaflet-geojson]

    It get’s converted to something like that, with a lot of extra <p> and <br>:

    <div class="leaflet-popup-content"><p></p><br><h3><a href="https://xrcb.exo.cat/?p=22">scannerfm.com</a></h3><br><p>el Poble Sec<br>Radio libre</p></div>

    Plugin Contributor Gerald

    (@gerital)

    Great shot @bozdoz, your proposal works perfect adding the template function and changing line 109 of leaflet-map/shortcodes/class.geojson-shortcode.php to:

    text = popup_property && props[ popup_property ] || template(popup_text, feature.properties);

    Thanks!

    ps: just created a pull request

    Gerald

    (@gerital)

    I also see a [X] in place of image and tried to debug the error adding $mpdf->showImageErrors = true; to dkpdf-functions.php. Where should I see the output of mpdf image errors, in the PDF or somewhere in the logs?

    Thanks Emili, that worked out great!

Viewing 15 replies - 16 through 30 (of 72 total)