[EventCalendar] add locations to your events

Rafael Oliveira rafainri at gmail.com
Fri May 16 14:57:17 UTC 2008


Great!!!

Thanks  alot for this add-on. Now, would it be possible to add another  
field? Like ticket cost? How can I do that?
And how do I retrieve the location and the location only for a  
determined post? Is this possible. I am trying to set up a blog for a  
show promoter and would like to attach the event info to posts. But  
would like each field to appear separately, on an unordered list. Like  
this:

DAY 		18 Thursday
MONTH 		May 2008
TIME 		12:00PM
LOCATION 	New York
TICKETS 	5$

I managed to get the whole date string wrapped inside an <li> element  
using ec3_get_schedule() so I could show:

DATE 18 Thursday, May 2008 12:00PM

But I would like to separate each field.

How would I go about doing this?

Any ideas?

Thanks a lot.

On 2008/05/16, at 13:05, Benoît Gréant wrote:

> this is something I did to be able to add a location to each event  
> (eventcalendar 3.1.1._rc3).
> I think that function should be improved and implemented to ec3 !
>
> 1) If it's an old install, you have to modify your database :
> ALTER TABLE `wp_ec3_schedule` ADD `location` LONGTEXT NULL AFTER  
> `allday` ;
>
> 2) files to modify : eventcalendar3.php, template-functions.php,  
> admin.php.
> This patch has been "hand-made",
> + = lines to add
> - = lines to delete
>
> ****eventcalendar3.php LINE 58 ****
>
> -    "SELECT post_id,start,end,allday,rpt,IF(end>='$ec3->today',1,0)  
> AS active
> +    "SELECT post_id,start,end,allday,location,rpt,IF(end>='$ec3- 
> >today',1,0) AS active
>
>
> ****eventcalendar3.php LINE 362****
>
>     "SELECT
>          post_id,
>          post_title,
>          post_excerpt,
>          DATE_FORMAT(start,IF(allday,'%Y%m%d','%Y-%m-%d %H:%i')) AS  
> dt_start,
>          IF( allday,
>              DATE_FORMAT(DATE_ADD(end, INTERVAL 1 DAY),'%Y%m%d'),
>              DATE_FORMAT(end,'%Y-%m-%d %H:%i')
>            ) AS dt_end,
>          $ec3->wp_user_nicename AS user_nicename,
>          IF(allday,'TRANSPARENT','OPAQUE') AS transp,
>          -allday
>          +allday,
>          location
>
>
> ****template-functions.php LINE 482****
>
>   foreach($post->ec3_schedule as $s)
>   {
>     $date_start=mysql2date($date_format,$s->start);
>     $date_end  =mysql2date($date_format,$s->end);
>     $time_start=mysql2date($time_format,$s->start);
>     $time_end  =mysql2date($time_format,$s->end);
> +  $location = $s->location;
>
>
> ****template-functions.php LINE 517****
>
>         if($time_start==$time_end)
>           $result.=sprintf($format_single,$time_start);
>         else
>           $result.=sprintf($format_range,$time_start, 
> $time_end,__('to','ec3'));
>       }
>     }
> +    if ($location) {
> +        $result.=' ('.$location.')';
> +    }
>   }
>
>
> ****admin.php LINE 59****
>
>    function filter_edit_form()
>   {
>     global $ec3,$wp_version,$wpdb,$post_ID;
>     if(isset($post_ID))
>       $schedule = $wpdb->get_results(
>         "SELECT
>            sched_id,
>            DATE_FORMAT(start,'%Y-%m-%d %H:%i') AS start,
>            DATE_FORMAT(end,'%Y-%m-%d %H:%i') AS end,
>            allday,
> +           location,
>            rpt
>
> ****admin.php LINE 86****
>
>      <table width="100%" cellspacing="2" cellpadding="5"  
> class="editform">
>      <thead><tr>
>       <th><?php _e('Start','ec3'); ?></th>
>       <th><?php _e('End','ec3'); ?></th>
>       <th><?php _e('All Day','ec3'); ?></th>
> +      <th><?php _e('Location','ec3'); ?></th>
>       <!-- th><?php _e('Repeat','ec3'); ?></th -->
>
>
> ****admin.php LINE 96****
>
>     <?php
>       $ec3_rows=0;
>       if($schedule)
>       {
>         foreach($schedule as $s)
>             $this->schedule_row(
> -              $s->start,$s->end,$s->sched_id,'update',$s->allday,$s- 
> >location
> +              $s->start,$s->end,$s->sched_id,'update',$s->allday
>             );
>         $ec3_rows=count($schedule);
>       }
>       $default=ec3_strftime('%Y-%m-%d %H:00',3600+time());
> -      $this->schedule_row($default,$default,'_','create',False);
> +      $this->schedule_row($default,$default,'_','create',False,'');
>     ?>
>
>
> ****admin.php LINE 131****
>
> -  function schedule_row($start,$end,$sid,$action,$allday)
> +  function schedule_row($start,$end,$sid,$action,$allday, 
> $location='')
>   {
> +  global $wpdb;
>     $s="ec3_start_$sid";
>     $e="ec3_end_$sid";
>
> ****admin.php LINE 151****
>
>         <button type="reset" id="trigger_<?php echo $e; ? 
> >">&hellip;</button>
>        </td>
> +       <td>
> +        <input type="checkbox" name="ec3_allday_<?php echo $sid;
> +         ?>" value="1"<?php if($allday){ echo '  
> checked="checked"'; } ?> />
> +       </td>
> +       <td>
> +       <input type="text" name="ec3_location_<?php echo $sid;?>"/>
> +       </td>
>
> ****admin.php LINE 214****
>
>     // Find all of our parameters
>     $sched_entries=array();
> -    $fields =array('start','end','allday','rpt');
> +    $fields =array('start','end','allday','location','rpt');
>
>
> ****admin.php LINE 313****
>
>     if(!$table_exists)
>     {
>       $wpdb->query(
>         "CREATE TABLE $ec3->schedule (
>            sched_id BIGINT(20) AUTO_INCREMENT,
>            post_id  BIGINT(20),
>            start    DATETIME,
>            end      DATETIME,
>            allday   BOOL,
> +           location LONGTEXT,
>            rpt      VARCHAR(64),
>            PRIMARY KEY(sched_id),
>            KEY post_id (post_id)
>          )");
>     } // end if(!$table_exists)
>
> I made a post here (http://wordpress.org/support/topic/176537?replies=1#post-760184 
> ) to discuss about this !
>
> Benoit
>
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://penguin.firetree.net/pipermail/eventcalendar/attachments/20080516/da17633e/attachment.html


More information about the EventCalendar mailing list