function template_include($template) { appthemes_auth_redirect_login(); $order = get_order(); $currentuser = wp_get_current_user(); if ($order->get_author() != $currentuser->ID) { return appthemes_locate_template('404.php'); } // actions available only to pending & failed orders if (in_array($order->get_status(), array(APPTHEMES_ORDER_PENDING, APPTHEMES_ORDER_FAILED))) { // cancel gateway selection if (isset($_GET['cancel'])) { $order->clear_gateway(); $this->send_to_cancel_url(); // locate order summary if redirect failed return $this->get_template(); } // auto complete zero orders if ($order->get_total() == 0) { $order->complete(); $this->send_to_complete_url(); // locate order summary if redirect failed return $this->get_template(); } // ask to select gateway if (!$order->get_gateway()) { $this->send_to_cancel_url(); // locate order summary if redirect failed return $this->get_template(); } // none of above, so process order return $this->get_template('checkout'); } // redirect to 'complete_url' if it's not the same page or template if ($this->get_complete_url() != $order->get_return_url() && strpos($this->get_complete_url(), 'step=order-summary') === false) { $this->send_to_complete_url(); } // order processed, so display summary return $this->get_template(); }
<?php /* Template Name: User Profile */ nocache_headers(); appthemes_auth_redirect_login(); global $userdata; get_currentuserinfo(); // grabs the user info and puts into vars // check to see if the form has been posted. If so, validate the fields if (!empty($_POST['submit'])) { require_once ABSPATH . 'wp-admin/includes/user.php'; require_once ABSPATH . WPINC . '/registration.php'; check_admin_referer('update-profile_' . $user_ID); $errors = edit_user($user_ID); if (is_wp_error($errors)) { foreach ($errors->get_error_messages() as $message) { $errmsg = $message; } } // if there are no errors, then process the ad updates if ($errmsg == '') { // update the user fields do_action('personal_options_update', $user_ID); // update the custom user fields foreach (array('twitter_id', 'facebook_id', 'linkedin_profile') as $field) { update_user_meta($user_ID, $field, strip_tags(stripslashes($_POST[$field]))); } $d_url = $_POST['dashboard_url']; wp_redirect('./?updated=true&d=' . $d_url);
function appthemes_require_login($args = array()) { if (is_user_logged_in()) { return; } $page_url = scbUtil::get_current_url(); $args = wp_parse_args($args, array('login_text' => __('You must first login.', APP_TD), 'login_register_text' => __('You must first login or <a href="%s">register</a>.', APP_TD))); if (get_option('users_can_register')) { $register_url = appthemes_get_registration_url(); $register_url = add_query_arg('redirect_to', $page_url, $register_url); $message = sprintf($args['login_register_text'], $register_url); } else { $message = $args['login_text']; } set_transient('login_notice', array('error', $message), 300); appthemes_auth_redirect_login(); exit; }
function template_redirect() { // Prevent non-logged-in users from accessing the edit-profile.php page appthemes_auth_redirect_login(); add_action('appthemes_notices', array($this, 'show_notice')); }
function template_redirect() { // Prevent non-logged-in users from accessing the edit-profile.php page appthemes_auth_redirect_login(); }
function template_redirect() { // Prevent non-logged-in users from accessing the edit-profile.php page appthemes_auth_redirect_login(); add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); }
/** * Checks if a user is logged in, if not redirect them to the login page. * * @deprecated 3.4 * @deprecated Use appthemes_auth_redirect_login() * @see appthemes_auth_redirect_login() * * @return void */ function auth_redirect_login() { _deprecated_function(__FUNCTION__, '3.4', 'appthemes_auth_redirect_login'); appthemes_auth_redirect_login(); }
function template_redirect() { appthemes_auth_redirect_login(); add_action('appthemes_notice', array($this, 'show_notice')); }
function template_redirect() { appthemes_auth_redirect_login(); // if not logged in, redirect to login page nocache_headers(); // process actions if needed self::process_actions(); }
function template_redirect() { global $wpdb, $current_user; appthemes_auth_redirect_login(); // if not logged in, redirect to login page nocache_headers(); // check to see if we want to pause or restart the ad if (isset($_GET['action']) && !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 = %d AND post_author = %d", $aid, $current_user->ID); $checkauthor = $wpdb->get_row($sql); if ($checkauthor != null) { // author check is ok. now update ad status if ($d == 'pause') { $my_ad = array(); $my_ad['ID'] = $aid; $my_ad['post_status'] = 'draft'; wp_update_post($my_ad); $redirect_url = add_query_arg(array('paused' => 'true'), CP_DASHBOARD_URL); wp_redirect($redirect_url); exit; } elseif ($d == 'restart') { $my_ad = array(); $my_ad['ID'] = $aid; $my_ad['post_status'] = 'publish'; wp_update_post($my_ad); $redirect_url = add_query_arg(array('restarted' => 'true'), CP_DASHBOARD_URL); wp_redirect($redirect_url); exit; } elseif ($d == 'delete') { cp_delete_ad_listing($aid); $redirect_url = add_query_arg(array('deleted' => 'true'), CP_DASHBOARD_URL); wp_redirect($redirect_url); exit; } elseif ($d == 'freerenew') { cp_renew_ad_listing($aid); $redirect_url = add_query_arg(array('freerenewed' => 'true'), CP_DASHBOARD_URL); wp_redirect($redirect_url); exit; } elseif ($d == 'setSold') { update_post_meta($aid, 'cp_ad_sold', 'yes'); $redirect_url = add_query_arg(array('markedsold' => 'true'), CP_DASHBOARD_URL); wp_redirect($redirect_url); exit; } elseif ($d == 'unsetSold') { update_post_meta($aid, 'cp_ad_sold', 'no'); $redirect_url = add_query_arg(array('unmarkedsold' => 'true'), CP_DASHBOARD_URL); wp_redirect($redirect_url); exit; } } } add_action('appthemes_notices', array($this, 'show_notice')); }
function template_redirect() { appthemes_auth_redirect_login(); }