Function Reference: geodir_event_get_my_listings
Summary
This function has not been documented yet.
Source File
geodir_event_get_my_listings() is located in geodir_event_manager/gdevents_functions.php [Line: 1115]
Source Code
function geodir_event_get_my_listings( $post_type = 'all', $search = '', $limit = 5 ) { global $wpdb, $current_user; if( empty( $current_user->ID ) ) { return NULL; } $geodir_postypes = geodir_get_posttypes(); $search = trim( $search ); $post_type = $post_type != '' ? $post_type : 'all'; if( $post_type == 'all' ) { $geodir_postypes = implode( ",", $geodir_postypes ); $condition = $wpdb->prepare( " AND FIND_IN_SET( post_type, %s )" , array( $geodir_postypes ) ); } else { $post_type = in_array( $post_type, $geodir_postypes ) ? $post_type : 'gd_place'; $condition = $wpdb->prepare( " AND post_type = %s" , array( $post_type ) ); } $condition .= !current_user_can( 'manage_options' ) ? $wpdb->prepare( "AND post_author=%d" , array( (int)$current_user->ID ) ) : ''; $condition .= $search != '' ? $wpdb->prepare( " AND post_title LIKE %s", array( $search . '%%' ) ) : ""; $orderby = " ORDER BY post_title ASC"; $limit = " LIMIT " . (int)$limit; $sql = $wpdb->prepare( "SELECT ID, post_title FROM $wpdb->posts WHERE post_status = %s AND post_type != 'gd_event' " . $condition . $orderby . $limit, array( 'publish' ) ); $rows = $wpdb->get_results($sql); return $rows; }