Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi dev anubhav,
    yes this possible to change appointment color according their status
    1 go to in your plugin.
    2. select menu-page folder.
    3. open calendar.php file
    search comment line //Loading Appointments On Calendar Start
    or replace old code with new code from line number 36 to 83

    global $wpdb;
    $AppointmentTableName = $wpdb->prefix.”ap_appointments”;
    $FetchAllApps_sql = “select id, name, start_time, end_time, date,status FROM $AppointmentTableName“;
    $AllAppointments = $wpdb->get_results($FetchAllApps_sql, OBJECT);

    if($AllAppointments) {
    foreach($AllAppointments as $single) {
    $title = $single->name;

    if( $single->status == ‘approved’)
    {

    $appointment_color = “#FFFF00”;
    } else if( $single->status == ‘pending’)
    {

    $appointment_color = “#FFA500”;
    }
    else if( $single->status == ‘cancelled’)
    {

    $appointment_color = “#FF0000”;
    }
    else if( $single->status == ‘done’)
    {

    $appointment_color = “#008000”;
    }
    $start = date(“H, i”, strtotime($single->start_time));
    $end= date(“H, i”, strtotime($single->end_time));
    // subtract 1 from month digit coz calendar work on month 0-11
    $y = date ( ‘Y’ , strtotime( $single->date ) );
    $m = date ( ‘n’ , strtotime( $single->date ) ) – 1;
    $d = date ( ‘d’ , strtotime( $single->date ) );
    $date = “$y-$m-$d”;
    $date = str_replace(“-“,”, “, $date);
    $url = “?page=update-appointment&updateid=”.$single->id.”&&from=calendar”; ?>
    {
    title: “<?php _e(‘Booked By’, ‘appointzilla’); echo ‘: ‘; echo $title; ?>”,
    start: new Date(<?php echo “$date, $start”; ?>),
    end: new Date(<?php echo “$date, $end”; ?>),
    url: “<?php echo $url; ?>”,
    allDay: false,
    backgroundColor : “<?php echo $appointment_color; ?>”,
    textColor: “black”,
    },<?php
    }
    }

    it will work for you further any query let me know
    Thanks
    Abhishek

    Thread Starter dev anubhav

    (@dev-anubhav)

    Thanx Abhishek for answer. It helps me alot ??
    If i want a live search option for appointed persons then what should i have to do.
    Because in future,if i have more than 100 appointment and i want to search one member then what i have to do ?
    I used a code for live search for members that search with there name and number but it shows some problem, like sometime calendar disappears on that page. what to do ??

    i think you want to filter appointment in calendar.
    This feature in given in pro version.
    Thanks
    Abhishek

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘All Status Have Different Color’ is closed to new replies.