function aitDirShowDetailsData($empty = '', $column_name, $id) { if ($column_name == 'items') { return getAuthorItemsCount($id); } if ($column_name == 'activation_time') { $data = get_user_meta($id, 'dir_activation_time', true); if ($data) { $dateFormat = get_option('date_format', 'm/d/Y'); return date($dateFormat, $data['time']); } } if ($column_name == 'days_before_expiration') { $user = new WP_User($id); if (isDirectoryUser($user)) { return aitDirGetDaysLeft($user->ID); } else { return ''; } } if ($column_name == 'transaction_id') { $data = get_user_meta($id, 'dir_paypal_transaction_id', true); if ($data) { return $data; } } if ($column_name == 'recurring_profile_id') { $data = get_user_meta($id, 'dir_paypal_recurring_profile_id', true); if ($data) { return $data; } } }
$radius = array($radiusKm, $latteParams['options']['gpsLatitude'], $latteParams['options']['gpsLongitude']); $items = getItems($categoryID, $location, $search, $radius); $latteParams['term'] = $terms[0]; $latteParams['items'] = $items; $latteParams['ancestors'] = $ancestors; } else { // no category selected // all items $items = getItems(); $thisItem; for ($i = 0; $i < count($items); $i++) { if ($items[$i]->ID == $latteParams['post']->id) { $thisItem = $items[$i]; } } unset($items); $latteParams['term'] = null; $latteParams['items'] = array($thisItem); $latteParams['ancestors'] = array(); } } $latteParams['isDirSingle'] = true; $latteParams['sidebarType'] = 'item'; $latteParams['rating'] = get_post_meta($latteParams['post']->id, 'rating', true); // claim listing $user = new WP_User(intval($GLOBALS['wp_query']->post->post_author)); $latteParams['hasAlreadyOwner'] = isDirectoryUser($user); /** * Fire! */ WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
function aitRatingShowCorrectTableNumbers($views) { if (isDirectoryUser()) { global $wpdb; $user = wp_get_current_user(); $type = 'ait-rating'; //$cache_key = $type; $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s AND post_author = %d"; $query .= ' GROUP BY post_status'; //$count = wp_cache_get($cache_key, 'counts'); //if ( false !== $count ) // return $count; $count = $wpdb->get_results($wpdb->prepare($query, $type, $user->ID), ARRAY_A); $stats = array(); foreach (get_post_stati() as $state) { $stats[$state] = 0; } foreach ((array) $count as $row) { $stats[$row['post_status']] = $row['num_posts']; } $stats = (object) $stats; //wp_cache_set($cache_key, $stats, 'counts'); global $locked_post_status, $avail_post_stati; $post_type = $type; if (!empty($locked_post_status)) { return array(); } $status_links = array(); $num_posts = $stats; $class = ''; $allposts = ''; $current_user_id = get_current_user_id(); $total_posts = array_sum((array) $num_posts); // Subtract post types that are not included in the admin all list. foreach (get_post_stati(array('show_in_admin_all_list' => false)) as $state) { $total_posts -= $num_posts->{$state}; } $class = empty($class) && empty($_REQUEST['post_status']) && empty($_REQUEST['show_sticky']) ? ' class="current"' : ''; $status_links['all'] = "<a href='edit.php?post_type={$post_type}{$allposts}'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts', 'ait'), number_format_i18n($total_posts)) . '</a>'; foreach (get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status) { $class = ''; $status_name = $status->name; if (!in_array($status_name, $avail_post_stati)) { continue; } if (empty($num_posts->{$status_name})) { continue; } if (isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status']) { $class = ' class="current"'; } $status_links[$status_name] = "<a href='edit.php?post_status={$status_name}&post_type={$post_type}'{$class}>" . sprintf(translate_nooped_plural($status->label_count, $num_posts->{$status_name}), number_format_i18n($num_posts->{$status_name})) . '</a>'; } return $status_links; } else { return $views; } }
function aitDirCheckAccountLogedUser() { global $aitThemeOptions, $current_user; if (isDirectoryUser() && isset($aitThemeOptions->members->paypalPaymentType) && $aitThemeOptions->members->paypalPaymentType == 'recurring') { $profileId = get_user_meta($current_user->ID, 'dir_paypal_recurring_profile_id', true); if (!empty($profileId) && !aitCheckPayPalSubscription($profileId)) { aitDirExpireUser($current_user->ID); } } }