Exemple #1
0
 function template_redirect()
 {
     global $cp_options;
     // if not logged in, redirect to login page
     //appthemes_auth_redirect_login();
     // this is needed for IE to work with the go back button
     header("Cache-control: private");
     global $current_user;
     if ($current_user->roles[0] != 'administrator') {
         cp_redirect_membership();
     }
     //cp_redirect_membership();
     // redirect to dashboard if can't renew
     if (isset($_GET['renew'])) {
         CP_Add_New::can_renew_ad();
     }
     // needed for image uploading and deleting to work
     require_once ABSPATH . 'wp-admin/includes/file.php';
     require_once ABSPATH . 'wp-admin/includes/image.php';
     // include all the functions needed for this form
     require_once get_template_directory() . '/includes/forms/step-functions.php';
     // load up the validate and tinymce scripts
     add_action('wp_enqueue_scripts', 'cp_load_form_scripts');
     // load app-plupload scripts
     if (isset($_POST['cat']) && !isset($_POST['step1']) && $cp_options->ad_images && appthemes_plupload_is_enabled()) {
         add_action('wp_enqueue_scripts', 'appthemes_plupload_enqueue_scripts');
     }
 }
Exemple #2
0
 function template_redirect()
 {
     // if not logged in, redirect to login page
     auth_redirect_login();
     // this is needed for IE to work with the go back button
     header("Cache-control: private");
     // if not meet membership requirement, redirect to membership purchase page
     cp_redirect_membership();
     // redirect to dashboard if can't renew
     if (isset($_GET['renew'])) {
         CP_Add_New::can_renew_ad();
     }
     // needed for image uploading and deleting to work
     include_once ABSPATH . 'wp-admin/includes/file.php';
     include_once ABSPATH . 'wp-admin/includes/image.php';
     // include all the functions needed for this form
     include_once TEMPLATEPATH . '/includes/forms/step-functions.php';
     // load up the validate and tinymce scripts
     add_action('wp_print_scripts', 'cp_load_form_scripts');
     //load ajax child categories scripts
     add_action('wp_head', 'cp_ajax_addnew_js_header');
     // load app-plupload scripts
     if (isset($_POST['cat']) && !isset($_POST['step1']) && get_option('cp_ad_images') == 'yes' && appthemes_plupload_is_enabled()) {
         add_action('wp_print_scripts', 'appthemes_plupload_enqueue_scripts');
     }
     add_action('appthemes_notices', array($this, 'show_notice'));
 }
Exemple #3
0
 function template_redirect()
 {
     appthemes_require_login(array('login_text' => __('You must first login to renew an ad listing.', APP_TD), 'login_register_text' => __('You must first login or <a href="%s">register</a> to renew an ad listing.', APP_TD)));
     // if not meet membership requirement, redirect to membership purchase page
     cp_redirect_membership();
     if (!current_user_can('edit_posts')) {
         appthemes_add_notice('denied-listing-edit', __('You are not allowed to renew ad listings.', APP_TD), 'error');
         wp_redirect(CP_DASHBOARD_URL);
         exit;
     }
     // redirect to dashboard if can't renew
     self::can_renew_ad();
     // load up the validate
     add_action('wp_enqueue_scripts', 'cp_load_form_scripts');
 }