<?php /* * Template Name: User Dashboard * * This template must be assigned to a page * in order for it to work correctly * */ auth_redirect_login(); // if not logged in, redirect to login page nocache_headers(); $current_user = wp_get_current_user(); // grabs the user info and puts into vars if ('fb-' == substr($current_user->user_login, 0, 3)) { $display_user_name = $current_user->display_name; } else { $display_user_name = $current_user->user_login; } // include the payment gateway code include_once TEMPLATEPATH . '/includes/gateways/paypal/paypal.php'; // check to see if we want to pause or restart the ad if (!empty($_GET['action'])) { $d = trim($_GET['action']); $aid = trim($_GET['aid']); // make sure author matches ad. Prevents people from trying to hack other peoples ads $sql = $wpdb->prepare("SELECT wposts.post_author " . "FROM {$wpdb->posts} wposts " . "WHERE ID = %s " . "AND post_author = %s", $aid, $current_user->ID); $checkauthor = $wpdb->get_row($sql); if ($checkauthor != null) { // author check is ok. now update ad status if ($d == 'pause') {
function template_redirect() { // if not logged in, redirect to login page auth_redirect_login(); // include all the functions required to process the order include_once TEMPLATEPATH . '/includes/forms/step-functions.php'; }