Last active
December 28, 2015 11:28
-
-
Save sidharrell/7493110 to your computer and use it in GitHub Desktop.
default to a ticket id
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function espresso_ticket_dd($current_value = 0){ | |
| if ($current_value == 0) | |
| $current_value = 2; // Change this to the id of the ticket that you would like to be the default ticket. | |
| global $espresso_premium; if ($espresso_premium != true) return; | |
| global $wpdb; | |
| $sql = "SELECT id, ticket_name FROM " .EVENTS_TICKET_TEMPLATES; | |
| $sql .= " WHERE ticket_name != '' ORDER BY ticket_name "; | |
| //echo $sql; | |
| $tickets = $wpdb->get_results($sql); | |
| $num_rows = $wpdb->num_rows; | |
| //return print_r( $tickets ); | |
| $field = '<select name="ticket_id" id="ticket_id">\n'; | |
| $field .= '<option value="0">'.__('Select a Ticket', 'event_espresso').'</option>'; | |
| if ($num_rows > 0) { | |
| foreach ($tickets as $ticket){ | |
| $selected = $ticket->id == $current_value ? 'selected="selected"' : ''; | |
| $field .= '<option '. $selected .' value="' . $ticket->id .'">' . $ticket->ticket_name. '</option>\n'; | |
| } | |
| } | |
| $field .= '</select>'; | |
| if ( function_exists('espresso_version') && espresso_version() >= '3.2' ){ | |
| $ee_help = '<a class="thickbox" target="_blank" href="#TB_inline?height=400&width=500&inlineId=custom_ticket_info"><span class="question"> [?]</span></a>'; | |
| }else{ | |
| $ee_help = ' <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=status_types_info"><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . '/images/question-frame.png" width="16" height="16" /></a>'; | |
| } | |
| $html = '<p><label for="ticket_id">' .__('Custom Ticket ','event_espresso') . '</label>' . $field . $ee_help . '</p>'; | |
| return $html; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment