Advertisement
kustomdesigner

function I added field to

Jan 30th, 2014
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. function bp_group_calendar_widget_create_event($date) {
  2.  
  3. global $bp, $bgc_locale;
  4.  
  5.  
  6.  
  7. $calendar_capabilities = bp_group_calendar_get_capabilities();
  8.  
  9.  
  10.  
  11. //don't display widget if no capabilities
  12.  
  13. if ($calendar_capabilities == 'none')
  14.  
  15. return;
  16.  
  17.  
  18.  
  19. //if date given and valid, default form to it
  20.  
  21. $default_date = '';
  22.  
  23. if ( !empty($date['year']) && !empty($date['month']) && !empty($date['day']) ) {
  24.  
  25. $timestamp = strtotime($date['month'].'/'.$date['day'].'/'.$date['year']);
  26.  
  27. if ($timestamp >= time())
  28.  
  29. $default_date = date('Y-m-d', $timestamp);
  30.  
  31. }
  32.  
  33.  
  34.  
  35. $url = bp_get_group_permalink( $bp->groups->current_group ).'calendar/';
  36.  
  37.  
  38.  
  39. ?>
  40.  
  41. <div class="bp-widget">
  42.  
  43. <h4><?php _e('Create Event', 'groupcalendar'); ?></h4>
  44.  
  45. <form action="<?php echo $url; ?>" name="add-event-form" id="add-event-form" class="standard-form" method="post" enctype="multipart/form-data">
  46.  
  47. <label for="event-title"><?php _e('Title', 'groupcalendar'); ?> *</label>
  48.  
  49. <input name="event-title" id="event-title" value="" type="text">
  50.  
  51.  
  52.  
  53. <label for="event-date"><?php _e('Date', 'groupcalendar'); ?> *
  54.  
  55. <input name="event-date" id="event-date" value="<?php echo $default_date; ?>" type="text"></label>
  56.  
  57.  
  58.  
  59. <label for="event-time"><?php _e('Time', 'groupcalendar'); ?> *
  60.  
  61. <select name="event-hour" id="event-hour">
  62.  
  63. <?php
  64.  
  65. if ($bgc_locale['time_format']==24)
  66.  
  67. $bgc_locale['time_format'] = 23;
  68.  
  69. for ($i = 1; $i <= $bgc_locale['time_format']; $i++) {
  70.  
  71. $hour_check = ($i == 7) ? ' selected="selected"' : '';
  72.  
  73. echo '<option value="'.$i.'"'.$hour_check.'>'.$i."</option>\n";
  74.  
  75. }
  76.  
  77. ?>
  78.  
  79. </select>
  80.  
  81. <select name="event-minute" id="event-minute">
  82.  
  83. <option value="00">:00</option>
  84.  
  85. <option value="15">:15</option>
  86.  
  87. <option value="30">:30</option>
  88.  
  89. <option value="45">:45</option>
  90.  
  91. </select>
  92.  
  93. <?php if ($bgc_locale['time_format']==12) : ?>
  94.  
  95. <select name="event-ampm" id="event-ampm">
  96.  
  97. <option value="am">am</option>
  98.  
  99. <option value="pm">pm</option>
  100.  
  101. </select>
  102.  
  103. <?php endif; ?>
  104.  
  105. </label>
  106.  
  107.  
  108.  
  109. <label for="event-desc"><?php _e('Description', 'groupcalendar'); ?></label>
  110.  
  111. <?php
  112.  
  113. if (function_exists('wp_editor')) {
  114.  
  115. wp_editor('', 'event-desc', array('media_buttons' => false, 'dfw' => false));
  116.  
  117. } else {
  118.  
  119. the_editor('', 'event-desc', 'event-desc', false);
  120.  
  121. }
  122.  
  123. ?>
  124. <br/>
  125.  
  126. <span class="plugin_loc_notice">(*Please get address from Google Maps and paste into location field so that map links will work for other users)</span>
  127. <label for="event-loc"><?php _e('Location', 'groupcalendar'); ?></label>
  128.  
  129. <input name="event-loc" id="event-loc" value="" type="text">
  130.  
  131. /***********THIS IS WHERE I ADDED THE FIELD****************/
  132. /*********************************************************************************/
  133. <?php require ('plugin_state_selector.php'); ?>
  134.  
  135.  
  136.  
  137. <label for="event-map"><?php _e('Show Map Link?', 'groupcalendar'); ?>
  138.  
  139. <input name="event-map" id="event-map" value="1" type="checkbox" checked="checked" />
  140.  
  141. <small><?php _e('(Note: Location must be an address)', 'groupcalendar'); ?></small>
  142.  
  143. </label>
  144.  
  145.  
  146.  
  147. <input name="create-event" id="create-event" value="1" type="hidden">
  148.  
  149. <input name="group-id" id="group-id" value="<?php echo $bp->groups->current_group->id; ?>" type="hidden">
  150.  
  151. <?php wp_nonce_field('bp_group_calendar'); ?>
  152.  
  153.  
  154.  
  155. <p><input value="<?php _e('Create Event', 'groupcalendar'); ?> &raquo;" id="save" name="save" type="submit"></p>
  156.  
  157.  
  158.  
  159. </form>
  160.  
  161.  
  162.  
  163. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement