Changeset 1031106
- Timestamp:
- 11/23/2014 09:59:04 AM (11 years ago)
- File:
-
- 1 edited
-
super-events/trunk/superevents.php (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
super-events/trunk/superevents.php
r903749 r1031106 5 5 Description: A simple events management plugin with RSVP. 6 6 Author: Bharad 7 Version: 0. 47 Version: 0.5 8 8 Author URI: http://bharad.net/ 9 9 License: GPL2 … … 28 28 'search_items' => __( 'Search Events', 'superevents' ), 29 29 'not_found' => __( 'No events found', 'superevents' ), 30 'not_found_in_trash' => __( 'No events found in Trash', 'superevents' ), 30 'not_found_in_trash' => __( 'No events found in Trash', 'superevents' ), 31 31 'parent_item_colon' => '', 32 32 'menu_name' => __( 'Events', 'superevents' ) 33 33 34 34 ); 35 35 36 36 //Remember to add to below array 37 37 // / 'menu_icon' => ''. plugins_url( '/images/events-icon-20x20.png', __FILE__ ), 38 38 39 39 $args = array( 40 40 … … 55 55 'can_export' => true, 56 56 'show_in_nav_menus' => false 57 58 ); 59 57 58 ); 59 60 60 register_post_type( 'event', $args ); 61 61 … … 63 63 64 64 // Adds the taxonomy for event type 65 function superevents_register_taxonomy() 65 function superevents_register_taxonomy() 66 66 { 67 67 $labels = array( 68 68 69 69 'name' => __( 'Types', 'superevents' ), 70 70 'singular_name' => __( 'Type', 'superevents' ), … … 79 79 'new_item_name' => __( 'New Type Name', 'superevents' ), 80 80 'menu_name' => __( 'Types', 'superevents' ) 81 82 ); 83 81 82 ); 83 84 84 $args = array( 85 85 … … 91 91 'hierarchical' => true, 92 92 'rewrite' => array( 'slug' => 'type' ) 93 93 94 94 ); 95 95 … … 102 102 global $post, $post_ID; 103 103 104 $messages['event'] = array( 104 $messages['event'] = array( 105 105 106 106 0 => '', … … 128 128 { 129 129 $columns = array( 130 130 131 131 'cb' => '<input type="checkbox" />', 132 132 'title' => __( 'Event Name', 'superevents' ), … … 146 146 global $post; 147 147 148 switch ( $column ) 148 switch ( $column ) 149 149 { 150 150 case 'type' : … … 156 156 $table = $wpdb->prefix."events_rsvp"; 157 157 $rows = $wpdb->get_results($wpdb->prepare("SELECT rsvp, COUNT(*) AS headcount FROM $table WHERE event_id = %d GROUP BY rsvp ORDER BY rsvp DESC", $post->ID)); 158 foreach ($rows as $row) 158 foreach ($rows as $row) 159 159 echo ucfirst($row->rsvp) . ' : ' . $row->headcount . '<br/>'; 160 160 break; … … 201 201 { 202 202 if (isset($_POST['superevents_'. $field])) 203 update_post_meta($post->ID, "superevents_". $field, $_POST["superevents_". $field]); 203 update_post_meta($post->ID, "superevents_". $field, $_POST["superevents_". $field]); 204 204 } 205 205 } … … 212 212 { 213 213 global $post_type; 214 214 215 215 if ( ( isset( $_GET['post_type'] ) && $_GET['post_type'] == 'event' ) || ( isset( $post_type ) && $post_type == 'event' ) ) { 216 216 … … 229 229 if(is_single() && ('event' === $post_type)) 230 230 { 231 if ( file_exists( get_stylesheet_directory()."/superevents.css" ) ) 231 if ( file_exists( get_stylesheet_directory()."/superevents.css" ) ) 232 232 { 233 233 wp_enqueue_style( 'superevents', get_stylesheet_directory_uri() . '/superevents.css', array(), '1.0' ); 234 234 } 235 elseif ( file_exists( get_template_directory()."/superevents.css" ) ) 236 { 235 elseif ( file_exists( get_template_directory()."/superevents.css" ) ) 236 { 237 237 wp_enqueue_style( 'superevents', get_template_directory_uri() . '/superevents.css', array(), '1.0' ); 238 }else 238 }else 239 239 { 240 wp_enqueue_style( 'superevents', plugins_url('/css/superevents.css', __FILE__), array(), '1.0' ); 240 wp_enqueue_style( 'superevents', plugins_url('/css/superevents.css', __FILE__), array(), '1.0' ); 241 241 } 242 242 } … … 282 282 add_action( 'widgets_init', 'superevents_register_widget' ); 283 283 284 function superevents_register_widget() 284 function superevents_register_widget() 285 285 { 286 286 register_widget('superevents_rsvp_widget'); … … 301 301 /* Create the widget. */ 302 302 $this->WP_Widget( 'superevents_rsvp_widget', 'Events RSVP Widget', $widget_ops, $control_ops ); 303 303 304 304 } 305 306 function widget( $args, $instance ) 305 306 function widget( $args, $instance ) 307 307 { 308 308 $post_type = get_post_type( $GLOBALS['post']->ID); … … 358 358 } 359 359 /* After widget (defined by themes). */ 360 echo $after_widget; 360 echo $after_widget; 361 361 } 362 362 363 363 364 364 } 365 365 366 366 function update($new_instance, $old_instance) 367 367 { … … 370 370 return $instance; 371 371 } 372 372 373 373 function form($instance) 374 374 { … … 378 378 <label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label> 379 379 <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:95%;" /> 380 </p> 380 </p> 381 381 <?php 382 382 } … … 408 408 get_currentuserinfo(); 409 409 $user_id = $current_user->ID; 410 global $wpdb; 410 global $wpdb; 411 411 $table = $wpdb->prefix."events_rsvp"; 412 412 // Unique key on user_id, event_id … … 440 440 // } 441 441 442 // if you want better control over the template, 442 // if you want better control over the template, 443 443 // Use a file called single-event.php in your theme folder. 444 444 … … 458 458 $agenda = $event['superevents_agenda'][0]; 459 459 $minutes = $event['superevents_minutes'][0]; 460 460 461 461 $content .= "<div id='event_template_wrapper'> 462 462 <div class='event_label' id='location_label'>Location:</div>
Note: See TracChangeset
for help on using the changeset viewer.