function ym_user_is_test($args = array()) { if (!is_array($args)) { return NULL; } if (count($args) != 1) { // error return NULL; } //Ok now to match an argument $package_id = isset($args['package']) ? $args['package'] : ''; $type = isset($args['package_type']) ? $args['package_type'] : ''; $username = isset($args['username']) ? $args['username'] : ''; $role = isset($args['role']) ? $args['role'] : ''; $purchased = isset($args['purchased']) ? $args['purchased'] : ''; global $ym_user; // cron call check if (empty($ym_user)) { // grab current user global $current_user; get_currentuserinfo(); $ym_user = new YourMember_User($current_user->ID); } // commence checks if ($package_id) { if ($ym_user->pack_id == $package_id) { // woot return TRUE; } } if ($type) { if (strtolower($ym_user->account_type) == strtolower($type)) { return TRUE; } } get_currentuserinfo(); global $current_user; if ($username) { if (strtolower($current_user->user_login) == strtolower($username)) { return TRUE; } } if ($role) { if (current_user_can($role)) { return TRUE; } } if ($purchased) { $ipns = ym_get_all_logs(10, $current_user->ID); if ($ipns) { foreach ($ipns as $ipn) { $data = unserialize($ipn->data); //payment was processed by another gateway if ($data['ym_process'] != 'ym_free') { return TRUE; } } } else { //If user hasn't an IPN he definately hasn't purchased! return FALSE; } } return FALSE; }
function ym_show_timeline_log_home($limit = 20) { if ($transactions = ym_get_all_logs(false, false, false, false, 'unixtime DESC LIMIT ' . $limit)) { echo '<table class="form-table widefat">'; foreach ($transactions as $transaction) { $user = get_userdata($transaction->user_id); echo '<tr>'; $action = ym_get_transaction_action($transaction->action_id); if (is_object($action)) { echo '<td>' . $action->name . ' <span style="display: none;">' . $action->id . '</span></td>'; } else { echo '<td>' . __('Unknown', 'ym') . ' (' . $transaction->action_id . ') <span style="display: none;">' . $transaction->id . '</span></td>'; } echo '<td>'; if (isset($transaction->user_id) && isset($user->user_login)) { echo '<a href="?page=' . YM_ADMIN_FUNCTION . '&ym_page=user-edit&user_id=' . $transaction->user_id . '&TB_iframe=true&height=700&width=800" class="thickbox">'; echo $user->user_login . '</a>'; } else { echo 'DeletedUser'; } echo '</td>'; echo '<td>'; echo '<a href="?page=' . YM_ADMIN_FUNCTION . '&ym_page=ym-logs&user_id=' . $transaction->user_id . '&TB_iframe=true&height=700&width=800" class="thickbox ym_node_tree"></a></td>'; echo '</td>'; if (is_serialized($transaction->data)) { $data = unserialize($transaction->data); echo '<td><a href="#nowhere" class="ym_packetize_show">' . __('Click to Show Packet', 'ym') . '<div class="ym_packetize_packet"><table class="ym_packetize_data">'; foreach ($data as $name => $value) { echo '<tr><th>' . $name . '</th><td>'; $is = gettype($value); if ($is == 'object' || $is == 'array') { // echo print_r($value, TRUE); echo '<table>'; foreach ($value as $k => $v) { echo '<tr><td>' . $k . '</td><td><pre>' . print_r($v, true) . '</pre></td></tr>'; } echo '</table>'; } else { echo $value; } echo '</td></tr>'; } echo '</table></div></a></td>'; } else { if ($transaction->action_id == YM_ACCESS_EXTENSION || $transaction->action_id == YM_ACCESS_EXPIRY) { // TODO: for YM 11 only if (strpos($transaction->data, ' ') || strpos($transaction->data, '-')) { $transaction->data = strtotime($transaction->data); } echo '<td>'; if ($transaction->data) { echo date(YM_DATE, $transaction->data + get_option('gmt_offset') * 3600); } else { echo 'No Data'; } echo '</td>'; } else { echo '<td>' . $transaction->data . '</td>'; } } echo '<td>' . date(YM_DATE, $transaction->unixtime + get_option('gmt_offset') * 3600) . '</td>'; echo '</tr>'; } echo '</table>'; } else { echo '<p>' . __('There is nothing to report at the moment. Check back soon though!', 'ym') . '</p>'; } }
<td>' . $profile . '</td> <td>' . $transaction->user_email . '</td> <td>' . '(' . $post_id . ') ' . $title . '</td> <td>' . date(YM_DATE, $transaction->unixtime) . '</td> </tr>'; } echo '</tbody> <tfoot>' . $form . '</tfoot> </table>'; } else { echo __('<em>There are no Purchases logged.</em>', 'ym'); } echo ym_end_box(); echo ym_start_box(__('Bundles Purchases', 'ym')); echo '<p>' . __('Once again this section shows a log of all the Bundles that have been purchased and by whom. Use the Content Management menu above to get more data on Bundles sold.', 'ym') . '</p>'; if ($transactions = ym_get_all_logs(YM_PPP_PACK_PURCHASED, $user_id, $limit, $start, $order_by, $deleted)) { $form = '<tr><td colspan="5" style="text-align: center;"><form action="" method="post"> <input type="hidden" name="start" value="' . $start . '" />'; if ($start) { $form .= '<input type="submit" name="back" value="' . __('Back a Page', 'ym') . '" style="float: left;" />'; } $count = count($transactions); if ($count == $limit) { $form .= '<input type="submit" name="next" value="' . __('Next Page', 'ym') . '" style="float: right;" />'; } $page = $start; if ($page == 0) { $page = 1; } else { $page = $start / $limit + 1; }
$start = 0; $limit = 50; $cur = ym_post('start'); if (ym_post('next')) { $start = $cur + $limit; } if (ym_post('back')) { $start = $cur - $limit; if ($start < 0) { $start = 0; } } $user_id = FALSE; $order_by = 'id DESC'; $deleted = TRUE; if ($transactions = ym_get_all_logs(YM_USER_STATUS_UPDATE, $user_id, $limit, $start, $order_by, $deleted)) { $form = '<tr><td colspan="5" style="text-align: center;"><form action="" method="post"> <input type="hidden" name="start" value="' . $start . '" />'; if ($start) { $form .= '<input type="submit" name="back" value="' . __('Back a Page', 'ym') . '" style="float: left;" />'; } $count = count($transactions); if ($count == $limit) { $form .= '<input type="submit" name="next" value="' . __('Next Page', 'ym') . '" style="float: right;" />'; } $page = $start; if ($page == 0) { $page = 1; } else { $page = $start / $limit + 1; }
$start = 0; $limit = 50; $cur = ym_post('start'); if (ym_post('next')) { $start = $cur + $limit; } if (ym_post('back')) { $start = $cur - $limit; if ($start < 0) { $start = 0; } } $user_id = FALSE; $order_by = 'id DESC'; $deleted = TRUE; if ($transactions = ym_get_all_logs(YM_IPN, $user_id, $limit, $start, $order_by, $deleted)) { $form = '<tr><td colspan="5" style="text-align: center;"><form action="" method="post"> <input type="hidden" name="start" value="' . $start . '" />'; if ($start) { $form .= '<input type="submit" name="back" value="' . __('Back a Page', 'ym') . '" style="float: left;" />'; } $count = count($transactions); if ($count == $limit) { $form .= '<input type="submit" name="next" value="' . __('Next Page', 'ym') . '" style="float: right;" />'; } $page = $start; if ($page == 0) { $page = 1; } else { $page = $start / $limit + 1; }