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; } } }
function aitRenderDirectoryAccountPage() { global $aitThemeOptions, $current_user; $user = new WP_User($current_user->ID); $usrRoles = $user->roles; if (!isset($GLOBALS['aitThemeOptions']->members->easyAdminEnable)) { echo '<div class="wrap">'; echo '<div id="icon-users" class="icon32"><br></div>'; echo '<h2>' . __('Directory Account', 'ait') . '</h2>'; } $firstRole = array_shift(array_values($usrRoles)); if ($firstRole) { if (strpos($firstRole, 'directory_') !== false) { $roleName = $GLOBALS['wp_roles']->role_names[$firstRole]; $roleNumber = intval(substr($firstRole, 10)); $roleCodePrice = 'role' . $roleNumber . 'Price'; } else { $roleName = __('None', 'ait'); $roleNumber = 0; $roleCodePrice = 'none'; } if (isset($aitThemeOptions->members->paypalPaymentType) && $aitThemeOptions->members->paypalPaymentType == 'recurring') { $recurringProfileId = get_user_meta($user->ID, 'dir_paypal_recurring_profile_id', true); $recurringDescription = get_user_meta($user->ID, 'dir_paypal_recurring_profile_active_desc', true); global $paypal; $recurringCheck = $paypal->request('GetRecurringPaymentsProfileDetails', array('PROFILEID' => $recurringProfileId)); if (is_array($recurringCheck) && $recurringCheck['ACK'] == 'Success') { $recurringStatus = $recurringCheck['STATUS']; } else { $recurringStatus = __('Non-active', 'ait'); } } if (!isset($GLOBALS['aitThemeOptions']->members->easyAdminEnable)) { ?> <form method="post" action="<?php echo admin_url('/profile.php?dir-register=upgrade'); ?> " class="wp-user-form"> <?php } ?> <input type="hidden" name="user_id" value="<?php echo $user->ID; ?> "> <table class="form-table"> <tbody> <tr> <th><label for="user_account_type"><?php echo __('Account type', 'ait'); ?> </label></th> <td><input type="text" name="user_account_type" id="user_account_type" value="<?php echo $roleName; ?> " disabled="disabled" class="regular-text"></td> </tr> <?php if (isset($aitThemeOptions->members->paypalPaymentType) && $aitThemeOptions->members->paypalPaymentType == 'recurring') { ?> <?php if (!empty($recurringDescription) && isDirectoryUser()) { ?> <tr> <th><label for="user_account_recurring_profile_desc"><?php echo __('PayPal profile', 'ait'); ?> </label></th> <td><input type="text" name="user_account_recurring_profile_desc" id="user_account_recurring_profile_desc" value="<?php echo $recurringDescription; ?> " disabled="disabled" class="regular-text"></td> </tr> <?php } ?> <?php if (!empty($recurringProfileId) && isDirectoryUser()) { ?> <tr> <th><label for="user_account_recurring_profile_id"><?php echo __('PayPal profile ID', 'ait'); ?> </label></th> <td><input type="text" name="user_account_recurring_profile_id" id="user_account_recurring_profile_id" value="<?php echo $recurringProfileId; ?> " disabled="disabled" class="regular-text"></td> </tr> <?php } ?> <tr> <th><label for="user_account_recurring_status"><?php echo __('PayPal profile status', 'ait'); ?> </label></th> <td><input type="text" name="user_account_recurring_status" id="user_account_recurring_status" value="<?php echo $recurringStatus; ?> " disabled="disabled" class="regular-text"></td> </tr> <?php } else { ?> <tr> <th><label for="user_account_expiration"><?php echo __('Days left before expiration', 'ait'); ?> </label></th> <td><input type="text" name="user_account_expiration" id="user_account_expiration" value="<?php echo aitDirGetDaysLeft(); ?> " disabled="disabled" class="regular-text"></td> </tr> <?php } ?> <?php if (!(isset($aitThemeOptions->members->paypalPaymentType) && $aitThemeOptions->members->paypalPaymentType == 'recurring' && $recurringStatus == 'Pending')) { ?> <tr> <input type="hidden" name="directory-role-current-price" value="<?php echo $roleCodePrice; ?> "> <?php global $aitThemeOptions; $output = '<th><label for="directory-role">' . __('Upgrade account', 'ait') . '</label></th><td><select name="directory-role" id="ait_dir_user_account_update">'; $currency = isset($aitThemeOptions->members->paypalCurrencyCode) ? $aitThemeOptions->members->paypalCurrencyCode : 'USD'; $roleNumber++; $upCount = 0; for ($i = $roleNumber; $i <= 5; $i++) { $roleEnable = 'role' . $i . 'Enable'; $roleName = 'role' . $i . 'Name'; $rolePrice = 'role' . $i . 'Price'; if (isset($aitThemeOptions->members->paypalPaymentType) && $aitThemeOptions->members->paypalPaymentType == 'recurring') { $periodName = 'role' . $i . 'Period'; $rolePeriod = __('year', 'ait'); switch ($aitThemeOptions->members->{$periodName}) { case 'Year': $rolePeriod = __('year', 'ait'); break; case 'Month': $rolePeriod = __('month', 'ait'); break; case 'Week': $rolePeriod = __('week', 'ait'); break; case 'Day': $rolePeriod = __('day', 'ait'); break; } } $free = trim($aitThemeOptions->members->{$rolePrice}) == '0' ? true : false; if (isset($aitThemeOptions->members->{$roleEnable})) { $output .= '<option value="directory_' . $i . '"'; if ($free) { $output .= ' class="free"'; } $output .= '>' . $aitThemeOptions->members->{$roleName}; if (!$free) { if ($roleCodePrice == 'none') { $upgradePrice = trim($aitThemeOptions->members->{$rolePrice}); } else { $upgradePrice = floatval(trim($aitThemeOptions->members->{$rolePrice})) - floatval(trim($aitThemeOptions->members->{$roleCodePrice})); } if (isset($aitThemeOptions->members->paypalPaymentType) && $aitThemeOptions->members->paypalPaymentType == 'recurring') { $output .= ' - ' . trim($aitThemeOptions->members->{$rolePrice}) . ' ' . $currency . ' ' . __('per', 'ait') . ' ' . $rolePeriod; } else { $output .= ' (' . $upgradePrice . ' ' . $currency . ')'; } } else { $output .= ' (' . __('Free', 'ait') . ')'; } $output .= '</option>'; $upCount++; } } $output .= '</select></td>'; if ($upCount > 0) { echo $output; } ?> </tr> <?php } ?> </tbody> </table> <?php if (!(isset($aitThemeOptions->members->paypalPaymentType) && $aitThemeOptions->members->paypalPaymentType == 'recurring' && $recurringStatus == 'Pending')) { ?> <?php if ($upCount > 0) { echo '<p class="submit"><input type="submit" name="user-submit" data-form-url="' . admin_url('/profile.php?dir-register=upgrade') . '" value="' . __('Upgrade Account', 'ait') . '" class="user-submit button button-primary" /></p>'; } } if (isset($aitThemeOptions->members->easyAdminEnable)) { ?> <div class="icon32" id="icon-profile"><br></div> <h2><?php _e('Profile', 'ait'); ?> </h2> <?php } else { ?> </form> <?php } } else { } if (!isset($aitThemeOptions->members->easyAdminEnable)) { echo '</div>'; } }