public function fes_secure_logout()
 {
     $base_url = get_permalink(EDD_FES()->helper->get_option('fes-vendor-dashboard-page', false));
     $base_url = add_query_arg(array('view' => 'login', 'task' => false), $base_url);
     wp_redirect($base_url);
     exit;
 }
/**
* Plugin Name: Change Vendor Delete Product Redirect
* Author: Kyle Maurer
*/
function kjm_change_vendor_delete_product_redirect()
{
    $redirect_to = get_permalink(EDD_FES()->helper->get_option('fes-vendor-dashboard-page', false));
    $redirect_to = add_query_arg(array('task' => 'products'), $redirect_to);
    wp_redirect($redirect_to);
    exit;
}
 public function collaboration_locate_template($template_names, $load = false, $require_once = true)
 {
     // No file found yet
     $located = false;
     // Try to find a template file
     foreach ((array) $template_names as $template_name) {
         // Continue if template is empty
         if (empty($template_name)) {
             continue;
         }
         // Trim off any slashes from the template name
         $template_name = ltrim($template_name, '/');
         // Check child theme first
         if (file_exists(trailingslashit(get_stylesheet_directory()) . 'collaboration_templates/' . $template_name)) {
             $located = trailingslashit(get_stylesheet_directory()) . 'collaboration_templates/' . $template_name;
             break;
             // Check parent theme next
         } elseif (file_exists(trailingslashit(get_template_directory()) . 'collaboration_templates/' . $template_name)) {
             $located = trailingslashit(get_template_directory()) . 'collaboration_templates/' . $template_name;
             break;
             // Check theme compatibility last
         } elseif (file_exists(trailingslashit(EDD_FES()->templates->collaboration_get_templates_dir()) . $template_name)) {
             $located = trailingslashit(EDD_FES()->templates->collaboration_get_templates_dir()) . $template_name;
             break;
         }
     }
     if (true == $load && !empty($located)) {
         load_template($located, $require_once);
     }
     return $located;
 }
示例#4
0
/**
 * FES Vendor Dashboard Menu
 *
 * @since Marketify 1.0
 *
 * @param array $menu
 * @return array $menu
 */
function marketify_edd_fes_vendor_dashboard_menu($menu)
{
    if (EDD_FES()->integrations->is_commissions_active()) {
        $menu['earnings']['icon'] = 'graph';
    }
    $menu['home']['icon'] = 'house';
    $menu['orders']['icon'] = 'ticket';
    $menu['logout']['icon'] = 'logout';
    return $menu;
}
示例#5
0
 public function enqueue_styles($override = false)
 {
     if (is_admin()) {
         return;
     }
     global $post;
     if (is_page(EDD_FES()->helper->get_option('fes-vendor-dashboard-page', false)) || $override) {
         // FES outputs minified scripts by default on the frontend. To load full versions, hook into this and return empty string.
         $minify = apply_filters('fes_output_minified_versions', '.min');
         if (EDD_FES()->helper->get_option('fes-use-css', true)) {
             wp_enqueue_style('fes-css', fes_plugin_url . 'assets/css/frontend' . $minify . '.css');
         }
         wp_enqueue_style('jquery-ui', fes_plugin_url . 'assets/css/jquery-ui-1.9.1.custom.css');
     }
 }
 function save_meta($post_id, $post)
 {
     if (!isset($_POST['fes_cf_update']) || !isset($_POST['post_ID'])) {
         return;
     }
     if (!wp_verify_nonce($_POST['fes_cf_update'], 'fes_cf_update')) {
         return;
     }
     // Is the user allowed to edit the post or page?
     if (!current_user_can('edit_post', $_POST['post_ID'])) {
         return $_POST['post_ID'];
     }
     list($post_vars, $tax_vars, $meta_vars) = self::get_input_fields($_POST['fes_cf_form_id']);
     EDD_FES()->forms->update_post_meta($meta_vars, $_POST['post_ID']);
     do_action('fes_save_meta_download', $_POST['post_ID']);
 }
示例#7
0
文件: edd.php 项目: qhuit/UrbanPekor
/**
 * Add body class by filter
 *
 * @since 1.0
 */
function checkout_body_class($classes)
{
    /**
     * Add body class to vendor dashboard pages
     */
    if (function_exists('EDD_FES') && is_page(EDD_FES()->helper->get_option('fes-vendor-dashboard-page', false))) {
        $classes[] = 'vendor-dashboard';
        if (!is_user_logged_in()) {
            $classes[] = 'not-signed-in';
        }
        $task = '';
        if (isset($_GET['task']) && !empty($_GET['task'])) {
            $task = $_GET['task'];
        }
        switch ($task) {
            case 'new-product':
                $classes[] = 'product-management';
                break;
            case 'edit-product':
                $classes[] = 'product-management';
                break;
            case 'earnings':
                $classes[] = 'vendor-earnings';
                break;
            case 'products':
                $classes[] = 'product-list';
                break;
        }
    }
    /**
     * Add body class to vendor pages
     */
    $vendor = get_query_var('vendor');
    if (!empty($vendor)) {
        $classes[] = 'vendor-archive';
    }
    return $classes;
}
示例#8
0
 private function save_default_values($slug, $page_id)
 {
     switch ($slug) {
         case 'fes-login-form':
             $login = array(1 => array('input_type' => 'text', 'template' => 'user_login', 'required' => 'yes', 'label' => __('Username', 'edd_fes'), 'name' => 'user_login', 'is_meta' => 'yes', 'size' => 40, 'help' => '', 'css' => '', 'placeholder' => '', 'default' => ''), 2 => array('input_type' => 'password', 'template' => 'password', 'required' => 'yes', 'label' => __('Password', 'edd_fes'), 'name' => 'password', 'is_meta' => 'yes', 'size' => '40', 'min_length' => '6', 'repeat_pass' => 'no', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => ''), 3 => array('input_type' => 'radio', 'template' => 'radio_field', 'required' => 'yes', 'label' => __('Login as a', 'edd_fes'), 'is_meta' => 'no', 'name' => 'fes_login_radio_button', 'css' => 'fes_login_radio_button', 'selected' => 'Vendor', 'options' => array(EDD_FES()->vendors->get_vendor_constant_name($plural = false, $uppercase = true), __('Customer', 'edd_fes')), 'help' => '', 'placeholder' => '', 'default' => ''), 4 => array('input_type' => 'recaptcha', 'template' => 'recaptcha', 'label' => ''));
             update_post_meta($page_id, 'fes-form', $login);
             break;
         case 'fes-profile-form':
             $login = array(0 => array('input_type' => 'text', 'template' => 'text_field', 'required' => 'yes', 'label' => 'Name of Store', 'name' => 'name_of_store', 'is_meta' => 'yes', 'help' => 'What would you like your store to be called?', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 1 => array('input_type' => 'email', 'template' => 'email_address', 'required' => 'yes', 'label' => 'Email to use for Contact Form', 'name' => 'email_to_use_for_contact_form', 'is_meta' => 'yes', 'help' => 'This email, if filled in, will be used for the vendor contact forms. If it is not filled in, the one from your user profile will be used.', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'));
             update_post_meta($page_id, 'fes-form', $login);
             break;
         case 'fes-registration-form':
             $register = array(1 => array('input_type' => 'text', 'template' => 'first_name', 'required' => 'yes', 'label' => 'First Name', 'name' => 'first_name', 'is_meta' => 'yes', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 2 => array('input_type' => 'text', 'template' => 'last_name', 'required' => 'yes', 'label' => 'Last Name', 'name' => 'last_name', 'is_meta' => 'yes', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 3 => array('input_type' => 'email', 'template' => 'user_email', 'required' => 'yes', 'label' => 'Email', 'name' => 'user_email', 'is_meta' => 'yes', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 4 => array('input_type' => 'text', 'template' => 'user_login', 'required' => 'yes', 'label' => 'Username', 'name' => 'user_login', 'is_meta' => 'yes', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 5 => array('input_type' => 'password', 'template' => 'password', 'required' => 'yes', 'label' => 'Password', 'name' => 'password', 'is_meta' => 'yes', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40', 'min_length' => '6', 'repeat_pass' => 'no'), 6 => array('input_type' => 'text', 'template' => 'display_name', 'required' => 'yes', 'label' => 'Display Name', 'name' => 'display_name', 'is_meta' => 'yes', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'));
             update_post_meta($page_id, 'fes-form', $register);
             break;
         case 'fes-vendor-contact-form':
             $contact = array(1 => array('input_type' => 'text', 'template' => 'first_name', 'required' => 'yes', 'label' => __('First Name', 'edd_fes'), 'name' => 'first_name', 'is_meta' => 'yes', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 2 => array('input_type' => 'text', 'template' => 'last_name', 'required' => 'yes', 'label' => __('Last Name', 'edd_fes'), 'name' => 'last_name', 'is_meta' => 'yes', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 3 => array('input_type' => 'email', 'template' => 'user_email', 'required' => 'yes', 'label' => __('Email', 'edd_fes'), 'name' => 'user_email', 'is_meta' => 'no', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 4 => array('input_type' => 'text', 'template' => 'text', 'required' => 'yes', 'label' => __('Subject', 'edd_fes'), 'name' => 'subject', 'is_meta' => 'no', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 5 => array('input_type' => 'textarea', 'template' => 'textarea', 'required' => 'yes', 'label' => __('Message', 'edd_fes'), 'name' => 'message', 'is_meta' => 'no', 'help' => '', 'css' => '', 'placeholder' => '', 'default' => '', 'size' => '40'), 6 => array('input_type' => 'recaptcha', 'template' => 'recaptcha', 'label' => ''));
             update_post_meta($page_id, 'fes-form', $contact);
             break;
         default:
             break;
     }
 }
 function get_bulk_actions()
 {
     $actions = array('approve_vendor' => __('Approve', 'edd_fes') . ' ' . EDD_FES()->vendors->get_vendor_constant_name($plural = true, $uppercase = true), 'decline_vendor' => __('Decline', 'edd_fes') . ' ' . EDD_FES()->vendors->get_vendor_constant_name($plural = true, $uppercase = true), 'revoke_vendor' => __('Revoke', 'edd_fes') . ' ' . EDD_FES()->vendors->get_vendor_constant_name($plural = true, $uppercase = true), 'suspend_vendor' => __('Suspend', 'edd_fes') . ' ' . EDD_FES()->vendors->get_vendor_constant_name($plural = true, $uppercase = true), 'unsuspend_vendor' => __('Unsuspend', 'edd_fes') . ' ' . EDD_FES()->vendors->get_vendor_constant_name($plural = true, $uppercase = true));
     return $actions;
 }
示例#10
0
function fes_forms_edit_form_area()
{
    global $post, $pagenow;
    if (get_the_ID() == EDD_FES()->helper->get_option('fes-submission-form', false)) {
        $form = __('Your submission form has no fields', 'edd_fes');
    } else {
        if (get_the_ID() == EDD_FES()->helper->get_option('fes-profile-form', false)) {
            $form = __('Your profile form has no fields', 'edd_fes');
        } else {
            $form = __('Your registration form has no fields', 'edd_fes');
        }
    }
    $form = apply_filters('fes_edit_form_area_no_fields', $form, get_the_ID());
    $form_inputs = get_post_meta($post->ID, 'fes-form', true);
    ?>

  <input type="hidden" name="fes-form-editor" id="fes-form-editor" value="<?php 
    echo wp_create_nonce("fes-form-editor");
    ?>
" />
  <div style="margin-bottom: 10px">
    <button class="button fes-collapse"><?php 
    _e('Toggle All Fields Open/Close', 'edd_fes');
    ?>
</button>
  </div>
  
  <?php 
    if (empty($form_inputs)) {
        ?>
    <div class="fes-updated">
      <p><?php 
        echo $form;
        ?>
</p>
    </div>
    <?php 
    }
    ?>
  
  <ul id="fes-form-editor" class="fes-form-editor unstyled">

  <?php 
    if ($form_inputs) {
        $count = 0;
        foreach ($form_inputs as $order => $input_field) {
            $name = ucwords(str_replace('_', ' ', $input_field['template']));
            $is_custom = apply_filters('fes_formbuilder_custom_field', false, $input_field);
            if ($is_custom) {
                $name = $input_field['input_type'];
                do_action('fes_admin_field_' . $name, $count, $name, $input_field);
                $count++;
            } else {
                if ($input_field['input_type'] == 'really_simple_captcha' || $input_field['input_type'] == 'google_map') {
                    continue;
                } else {
                    if ($input_field['template'] == 'taxonomy') {
                        FES_Formbuilder_Templates::$input_field['template']($count, $name, $input_field['name'], $input_field);
                        $count++;
                    } else {
                        FES_Formbuilder_Templates::$input_field['template']($count, $name, $input_field);
                        $count++;
                    }
                }
            }
        }
    }
    ?>
  </ul>
  <?php 
}
 public function process_vendor_email_submission($data)
 {
     if (!current_user_can('edit_shop_payments') && !EDD_FES()->vendors->vendor_is_vendor(get_current_user_id())) {
         wp_die(__('You do not have permission to submit email updates', 'edd-fes-product-updates'), __('Error', 'edd-fes-product-updates'), array('response' => 401));
     }
     if (!wp_verify_nonce($data['edd_fes_create_email'], 'edd_fes_create_email')) {
         wp_die(__('Nonce verification has failed', 'edd-fes-product-updates'), __('Error', 'edd-fes-product-updates'), array('response' => 401));
     }
     if (empty($data['fes-email-products'])) {
         wp_die(__('Please select at least one product', 'edd-fes-product-updates'), __('Error', 'edd-fes-product-updates'), array('response' => 401));
     }
     if (empty($data['fes-email-subject'])) {
         wp_die(__('Please enter a subject for the email', 'edd-fes-product-updates'), __('Error', 'edd-fes-product-updates'), array('response' => 401));
     }
     if (empty($data['fes-email-message'])) {
         wp_die(__('Please enter a message for the email', 'edd-fes-product-updates'), __('Error', 'edd-fes-product-updates'), array('response' => 401));
     }
     $products = $data['fes-email-products'];
     // Verify all included products belong to the current user
     foreach ($products as $key => $product_id) {
         $product = get_post($product_id);
         if ((int) get_current_user_id() !== (int) $product->post_author) {
             unset($products[$key]);
         }
     }
     // Re-verify there are products
     if (empty($products)) {
         wp_die(__('Please select at least one product', 'edd-fes-product-updates'), __('Error', 'edd-fes-product-updates'), array('response' => 401));
     }
     $author = get_userdata(get_current_user_id());
     $subject = sanitize_text_field($data['fes-email-subject']);
     $message = wp_kses_post($data['fes-email-message'] . "\n\n" . edd_get_option('fes_pu_default_footer'));
     $from_name = $author->display_name;
     $from_email = $author->user_email;
     $auto_send = $this->auto_send($author->ID);
     $args = array('post_type' => 'edd_pup_email', 'post_status' => 'draft', 'post_content' => $message, 'post_excerpt' => $subject, 'post_title' => sprintf(__('Vendor #%d: %s', 'edd-fes-product-updates'), $author->ID, $subject));
     $email_id = wp_insert_post($args);
     $recipients = edd_pup_customer_count($email_id, $products);
     update_post_meta($email_id, '_edd_pup_subject', $subject);
     update_post_meta($email_id, '_edd_pup_message', $message);
     update_post_meta($email_id, '_edd_pup_from_name', $from_name);
     update_post_meta($email_id, '_edd_pup_from_email', $from_email);
     update_post_meta($email_id, '_edd_pup_updated_products', $products);
     update_post_meta($email_id, '_edd_pup_recipients', $recipients);
     if ($auto_send) {
     } else {
         $this->notify_admins($email_id, $author);
     }
 }
示例#12
0
    function render_comments_table_row($comment)
    {
        $comment_date = get_comment_date('Y/m/d \\a\\t g:i a', $comment->comment_ID);
        $comment_author_img = EDD_FES()->vendors->get_avatar('comment_author_image', $comment->comment_author_email, 32);
        $purchased = edd_has_user_purchased($comment->user_id, $comment->comment_post_ID);
        ?>
	<tr>
		<td class="col-author" style="width:25%;">
			<div class="fes-author-img"><?php 
        echo $comment_author_img;
        ?>
</div>
			<span id="fes-comment-author"><?php 
        echo $comment->comment_author;
        ?>
</span>
			<br /><br />
			<?php 
        if ($purchased) {
            echo '<div class="fes-light-green">' . __('Has Purchased', 'edd_fes') . '</div>';
        } else {
            echo '<div class="fes-light-red">' . __('Has Not Purchased', 'edd_fes') . '</div>';
        }
        ?>
			<span id="fes-comment-date"><?php 
        echo $comment_date;
        ?>
&nbsp;&nbsp;&nbsp;</span><br />
			<span id="fes-product-name">
				<b><?php 
        echo EDD_FES()->vendors->get_product_constant_name($plural = false, $uppercase = true) . ': ';
        ?>
</b>
				<a href="<?php 
        echo esc_url(get_permalink($comment->comment_post_ID));
        ?>
"><?php 
        echo get_the_title($comment->comment_post_ID);
        ?>
</a>&nbsp;&nbsp;&nbsp;
			</span><br />
			<span id="fes-view-comment">
				<a href="<?php 
        echo esc_url(get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID);
        ?>
"><?php 
        _e('View Comment', 'edd_fes');
        ?>
</a>
			</span>
		</td>
		<td class="col-content" style="width:70%;">
			<div class="fes-comments-content"><?php 
        echo $comment->comment_content;
        ?>
</div>
			<hr/>
			<div id="<?php 
        echo $comment->comment_post_ID;
        ?>
" class="fes-vendor-comment-respond-form">
				<span><?php 
        _e('Respond:', 'edd_fes');
        ?>
</span><br/>
				<table>
					<tr>
						<form id="fes_comments-form" action="" method="post">
							<input type="hidden" name="cid" value="<?php 
        echo $comment->comment_ID;
        ?>
">
							<input type="hidden" name="pid" value="<?php 
        echo $comment->comment_post_ID;
        ?>
">
							<input type="hidden" name="aid" value="<?php 
        echo get_current_user_id();
        ?>
">
							<?php 
        wp_nonce_field('fes_comment_nonce', 'fes_nonce');
        ?>
							<textarea class="fes-cmt-body" name="newcomment_body" cols="50" rows="8"></textarea>
							<button class="fes-cmt-submit-form button" type="submit"><?php 
        _e('Post Response', 'edd_fes');
        ?>
</button>
						</form>
						<form id="fes_ignore-form" action="" method="post">
							<input type="hidden" name="cid" value="<?php 
        echo $comment->comment_ID;
        ?>
">
							<?php 
        wp_nonce_field('fes_ignore_nonce', 'fes_nonce');
        ?>
							<button class="fes-ignore button" type="submit"><?php 
        _e('Mark as Read', 'edd_fes');
        ?>
</button>
						</form>
					</tr>
				</table>
			</div>
		</td>
	</tr>
	<?php 
    }
示例#13
0
 public function combo_form_count()
 {
     if (EDD_FES()->vendors->can_see_registration() && EDD_FES()->vendors->can_see_login()) {
         return 2;
     }
     if (EDD_FES()->vendors->can_see_registration() || EDD_FES()->vendors->can_see_login()) {
         return 1;
     } else {
         return 0;
     }
 }
示例#14
0
 function validate_re_captcha()
 {
     $recap_challenge = isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : '';
     $recap_response = isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : '';
     $private_key = EDD_FES()->helper->get_option('fes-recaptcha-private-key', '');
     $resp = recaptcha_check_answer($private_key, $_SERVER["REMOTE_ADDR"], $recap_challenge, $recap_response);
     if (!$resp->is_valid) {
         $this->signal_error(__('reCAPTCHA validation failed', 'edd_fes'));
     }
 }
示例#15
0
<?php

if (EDD_FES()->integrations->is_commissions_active()) {
    ?>
	<h1 class="fes-headers" id="fes-commissions-page-title"><?php 
    _e('Commissions Overview', 'edd_fes');
    ?>
</h1>
	<?php 
    if (eddc_user_has_commissions()) {
        echo do_shortcode('[edd_commissions]');
    } else {
        echo __('You haven\'t made any sales yet!', 'edd_fes');
    }
} else {
    echo 'Error 4908';
}
示例#16
0
<?php

$task = !empty($_GET['task']) ? $_GET['task'] : '';
$icon_css = apply_filters("fes_vendor_dashboard_menu_icon_css", "icon-white");
//else icon-black/dark
$menu_items = EDD_FES()->dashboard->get_vendor_dashboard_menu();
?>
<nav class="fes-vendor-menu">
	<ul>
		<?php 
foreach ($menu_items as $item => $values) {
    ?>
			<li class="<?php 
    if (in_array($task, $values["task"])) {
        echo "active";
    }
    ?>
">
				<a href='<?php 
    echo add_query_arg('task', $values["task"][0], get_permalink());
    ?>
'>
					<i class="icon icon-<?php 
    echo esc_attr($values["icon"]);
    ?>
 <?php 
    echo esc_attr($icon_css);
    ?>
"></i> <span class="hidden-phone hidden-tablet"><?php 
    echo $values["name"];
    ?>
示例#17
0
/**
 * Show custom fields in post content area (beta)
 *
 * @global object $post
 * @param string $content
 * @return string
 */
function fes_show_custom_fields($content)
{
    global $post;
    // TODO: Disable till 2.3 implementation of per field settings
    return $content;
    if ($post->post_type != 'download') {
        return $content;
    }
    $show_custom = EDD_FES()->helper->get_option('fes-show-custom-meta', false);
    $form_id = EDD_FES()->helper->get_option('fes-submission-form', false);
    if (!$show_custom || !$form_id) {
        return $content;
    }
    $html = '<ul class="fes_customs">';
    $form_vars = get_post_meta($form_id, 'fes-form', true);
    $meta = array();
    if ($form_vars) {
        foreach ($form_vars as $attr) {
            if (isset($attr['is_meta']) && $attr['is_meta'] == 'yes') {
                $meta[] = $attr;
            }
        }
        if (!$meta) {
            return $content;
        }
        foreach ($meta as $attr) {
            $field_value = get_post_meta($post->ID, $attr['name']);
            if ($attr['input_type'] == 'hidden') {
                continue;
            }
            if ($attr['input_type'] == 'image_upload' || $attr['input_type'] == 'file_upload') {
                $image_html = '<li><label>' . $attr['label'] . ':</label> ';
                if ($field_value) {
                    foreach ($field_value as $attachment_id) {
                        if ($attr['input_type'] == 'image_upload') {
                            $thumb = wp_get_attachment_image($attachment_id, 'thumbnail');
                        } else {
                            $thumb = get_post_field('post_title', $attachment_id);
                        }
                        $full_size = wp_get_attachment_url($attachment_id);
                        $image_html .= sprintf('<a href="%s">%s</a> ', $full_size, $thumb);
                    }
                }
                $html .= $image_html . '</li>';
            } else {
                $value = get_post_meta($post->ID, $attr['name']);
                $html .= sprintf('<li><label>%s</label>: %s</li>', $attr['label'], make_clickable(implode(', ', $value)));
            }
        }
    }
    $html .= '</ul>';
    return $content . $html;
}
function get_unfinished_options()
{
    $form_id = EDD_FES()->helper->get_option('fes-submission-form', false);
    $form_vars = get_post_meta($form_id, 'fes-form', true);
    $options = array();
    foreach ($form_vars as $vals) {
        if ($vals['name'] == '_edd_product_status') {
            $options = $vals['options'];
        }
    }
    return $options;
}
<?php

$post_id = absint($_REQUEST['post_id']);
// check to make sure vendor is author of this download & can delete
if (!EDD_FES()->vendors->vendor_can_delete_product($post_id)) {
    _e('Access Denied: You may only delete your own products', 'edd_fes');
} else {
    ?>
	<h1 class="fes-headers" id="fes-delete-product-page-title"><?php 
    echo sprintf(__('Delete %s', 'edd_fes'), EDD_FES()->vendors->get_product_constant_name($plural = false, $uppercase = true)) . ' ' . __('#: ', 'edd_fes');
    echo $post_id;
    ?>
</h1>
	<p><?php 
    printf(__('Are you sure you want to delete this %s? This action is irreversible.', 'edd_fes'), EDD_FES()->vendors->get_product_constant_name($plural = false, $uppercase = false));
    ?>
</p>
	<form id="fes-delete-form" action="" method="post">
		<input type="hidden" name="pid" value="<?php 
    echo $post_id;
    ?>
">
		<?php 
    wp_nonce_field('fes_delete_nonce', 'fes_nonce');
    ?>
		<button class="fes-delete button" type="submit"><?php 
    _e('Delete', 'edd_fes');
    ?>
</button>
	</form>
	<?php 
示例#20
0
 function post_status($latest_status, $previous_status, $post)
 {
     global $current_user, $post;
     // Not an object if its not a draft yet. So prior to autosave this might throw warnings
     // We can prevent this by returning till it's been autosaved. This is when it becomes an obj.
     if (!is_object($post)) {
         return;
     }
     if ($post->post_type != 'download') {
         return;
     }
     if ($previous_status == 'pending' && $latest_status == 'trash') {
         $user = new WP_User($post->post_author);
         $to = apply_filters('fes_submission_declined_email_to', $user->user_email, $user);
         $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
         $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
         $subject = apply_filters('fes_submission_declined_message_subj', __('Submission Declined', 'edd_fes'), 0);
         $message = EDD_FES()->helper->get_option('fes-vendor-submission-declined-email', '');
         $type = "post";
         $id = $post->ID;
         $args['permissions'] = 'fes-vendor-submission-declined-email-toggle';
         EDD_FES()->emails->send_email($to, $from_name, $from_email, $subject, $message, $type, $id, $args);
         return;
     }
     if ($previous_status == 'publish' && $latest_status == 'trash') {
         $user = new WP_User($post->post_author);
         $to = apply_filters('fes_submission_revoked_email_to', $user->user_email, $user);
         $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
         $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
         $subject = apply_filters('fes_submission_revoked_message_subj', __('Submission Revoked', 'edd_fes'), 0);
         $message = EDD_FES()->helper->get_option('fes-vendor-submission-revoked-email', '');
         $type = "post";
         $id = $post->ID;
         $args['permissions'] = 'fes-vendor-submission-revoked-email-toggle';
         EDD_FES()->emails->send_email($to, $from_name, $from_email, $subject, $message, $type, $id, $args);
         return;
     }
 }
示例#21
0
 function process_bulk_action()
 {
     $ids = isset($_GET['vendor']) ? $_GET['vendor'] : false;
     if (empty($ids)) {
         return;
     }
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $current_action = $_GET['action'];
     foreach ($ids as $id) {
         if ('approve_vendor' === $current_action) {
             if ($id < 2) {
                 break;
             }
             if (user_can($id, 'fes_is_admin') || user_can($id, 'frontend_vendor')) {
                 break;
             }
             if (!user_can($id, 'pending_vendor')) {
                 break;
             }
             $user = new WP_User($id);
             $user->remove_role('pending_vendor');
             $user->add_role('frontend_vendor');
             $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
             $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
             $subject = apply_filters('fes_application_approved_message_subj', __('Application Approved', 'edd_fes'), 0);
             $message = EDD_FES()->helper->get_option('fes-vendor-app-approved-email', '');
             $type = "user";
             $args['permissions'] = 'fes-vendor-app-approved-email-toggle';
             EDD_FES()->emails->send_email($user->user_email, $from_name, $from_email, $subject, $message, $type, $id, $args);
             do_action('fes_approve_vendor_admin', $id);
             if (isset($_GET['redirect']) && $_GET['redirect'] == '2') {
                 wp_redirect(admin_url('admin.php?page=fes-vendors&vendor=' . $id . '&action=edit&approved=2'));
                 exit;
             }
         }
         if ('revoke_vendor' === $current_action) {
             if ($id < 2) {
                 break;
             }
             if (!(user_can($id, 'fes_is_admin') || user_can($id, 'frontend_vendor'))) {
                 break;
             }
             $user = new WP_User($id);
             $user->remove_role('frontend_vendor');
             $user->remove_cap('fes_is_admin');
             $user->add_role('subscriber');
             // remove all their posts
             $args = array('post_type' => 'download', 'author' => $id, 'posts_per_page' => -1, 'fields' => 'ids', 'post_status' => 'any');
             $query = new WP_Query($args);
             foreach ($query->posts as $id) {
                 wp_delete_post($id, false);
             }
             $to = $user->user_email;
             $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
             $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
             $subject = apply_filters('fes_application_revoked_message_subj', __('Application Revoked', 'edd_fes'), 0);
             $message = EDD_FES()->helper->get_option('fes-vendor-app-revoked-email', '');
             $type = "user";
             $id = $id;
             $args['permissions'] = 'fes-vendor-app-revoked-email-toggle';
             EDD_FES()->emails->send_email($to, $from_name, $from_email, $subject, $message, $type, $id, $args);
             do_action('fes_revoke_vendor_admin', $id);
         }
         if ('decline_vendor' === $current_action) {
             if ($id < 2) {
                 break;
             }
             if (user_can($id, 'fes_is_admin') || user_can($id, 'frontend_vendor')) {
                 break;
             }
             if (!user_can($id, 'pending_vendor')) {
                 break;
             }
             $user = new WP_User($id);
             $user->remove_role('pending_vendor');
             $to = $user->user_email;
             $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
             $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
             $subject = apply_filters('fes_application_declined_message_subj', __('Application Declined', 'edd_fes'), 0);
             $message = EDD_FES()->helper->get_option('fes-vendor-app-declined-email', '');
             $type = "user";
             $id = $id;
             $args['permissions'] = 'fes-vendor-app-declined-email-toggle';
             EDD_FES()->emails->send_email($to, $from_name, $from_email, $subject, $message, $type, $id, $args);
             do_action('fes_decline_vendor_admin', $id);
         }
         if ('suspend_vendor' === $current_action) {
             if ($id < 2) {
                 break;
             }
             if (user_can($id, 'pending_vendor')) {
                 break;
             }
             if (user_can($id, 'suspended_vendor')) {
                 break;
             }
             $user = new WP_User($id);
             $user->remove_role('frontend_vendor');
             $user->add_role('suspended_vendor');
             // remove all their posts
             $args = array('post_type' => 'download', 'author' => $id, 'posts_per_page' => -1, 'fields' => 'ids', 'post_status' => 'any');
             $query = new WP_Query($args);
             foreach ($query->posts as $id) {
                 $post = get_post($id);
                 update_post_meta($id, 'fes_previous_status', $post->post_status);
                 wp_delete_post($id, false);
             }
             $to = $user->user_email;
             $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
             $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
             $subject = apply_filters('fes_vendor_suspended_message_subj', __('Suspended', 'edd_fes'), 0);
             $message = EDD_FES()->helper->get_option('fes-vendor-suspended-email', '');
             $type = "user";
             $id = $id;
             $args['permissions'] = 'fes-vendor-suspended-email-toggle';
             EDD_FES()->emails->send_email($to, $from_name, $from_email, $subject, $message, $type, $id, $args);
             do_action('fes_vendor_suspended_admin', $id);
             if (isset($_GET['redirect']) && $_GET['redirect'] == '2') {
                 wp_redirect(admin_url('admin.php?page=fes-vendors&vendor=' . $id . '&action=edit&approved=2'));
                 exit;
             }
         }
         if ('unsuspend_vendor' === $current_action) {
             if ($id < 2) {
                 break;
             }
             if (user_can($id, 'pending_vendor')) {
                 break;
             }
             if (user_can($id, 'frontend_vendor')) {
                 break;
             }
             $user = new WP_User($id);
             $user->add_role('frontend_vendor');
             $user->remove_role('suspended_vendor');
             // remove all their posts
             $args = array('post_type' => 'download', 'author' => $id, 'posts_per_page' => -1, 'fields' => 'ids', 'post_status' => 'trash');
             $query = new WP_Query($args);
             foreach ($query->posts as $id) {
                 $status = get_post_meta($id, 'fes_previous_status', true);
                 if (!$status) {
                     $status = 'publish';
                 }
                 wp_update_post(array('ID' => $id, 'post_status' => $status));
             }
             $to = $user->user_email;
             $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
             $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
             $subject = apply_filters('fes_vendor_unsuspended_message_subj', __('Unsuspended', 'edd_fes'), 0);
             $message = EDD_FES()->helper->get_option('fes-vendor-unsuspended-email', '');
             $type = "user";
             $id = $id;
             $args['permissions'] = 'fes-vendor-unsuspended-email-toggle';
             EDD_FES()->emails->send_email($to, $from_name, $from_email, $subject, $message, $type, $id, $args);
             do_action('fes_vendor_unsuspended_admin', $id);
             if (isset($_GET['redirect']) && $_GET['redirect'] == '2') {
                 wp_redirect(admin_url('admin.php?page=fes-vendors&vendor=' . $id . '&action=edit&approved=2'));
                 exit;
             }
         }
     }
 }
示例#22
0
/**
 * Set the vendor header image to the image chosen by the vendor.
 * This requires a profile form field called 'header_image'.
 *
 * @since 1.2.0
 */
function dcs_custom_vendor_header()
{
    if (!class_exists('FES_Vendor_Shop')) {
        return;
    }
    $vendor = get_query_var('vendor');
    if (!empty($vendor)) {
        if (is_numeric($vendor)) {
            $vendor = get_userdata(absint($vendor));
        } else {
            $vendor = get_user_by('slug', $vendor);
        }
    }
    if (!$vendor) {
        return;
    }
    if (!is_page(EDD_FES()->helper->get_option('fes-vendor-page', false))) {
        return;
    }
    $header_image_id = EDD_FES()->helper->get_user_meta('header_image', $vendor->ID);
    if (!$header_image_id) {
        return;
    }
    // Set background image
    ?>
<style>
		#header, body.page-template-page-login-php { background-image: url( '<?php 
    echo wp_get_attachment_url($header_image_id);
    ?>
' ); }
	</style><?php 
}
<div id="fes-vendor-dashboard">
	<div id="fes-vendor-announcements">
		<?php 
echo apply_filters('fes_dashboard_content', do_shortcode(EDD_FES()->helper->get_option('fes-dashboard-notification', '')));
?>
	</div>

	<div id="fes-vendor-store-link">
		<?php 
echo EDD_FES()->vendors->get_vendor_store_url_dashboard();
?>
	</div>

	<div class="fes-comments-wrap">
		<table id="fes-comments-table">
			<tr>
				<th class="col-author"><?php 
_e('Author', 'edd_fes');
?>
</th>
				<th class="col-content"><?php 
_e('Comment', 'edd_fes');
?>
</th>
			</tr>
			<?php 
echo EDD_FES()->dashboard->render_comments_table(10);
?>
		</table>
	</div>
</div>
示例#24
0
    public function show_page()
    {
        $vendor = isset($_GET['vendor']) ? absint($_GET['vendor']) : false;
        if (!$vendor) {
            echo __('Invalid ID', 'edd_fes');
            exit;
        }
        if (!user_can(get_current_user_id(), 'manage_shop_settings')) {
            echo __('Access Denied', 'edd_fes');
            exit;
        }
        $user = get_userdata($vendor);
        echo '<div class="wrap about-wrap"><h2>' . __('Vendor: ', 'edd_fes') . $user->display_name . ' (' . __('ID', 'edd_fes') . ': ' . $user->ID . ')</h2>';
        $message = false;
        if (isset($_GET['approved']) && $_GET['approved'] == '2') {
            ?>
            <div class="updated">
                <p><?php 
            printf(__('%s approved!', 'edd_fes'), EDD_FES()->vendors->get_vendor_constant_name($plural = false, $uppercase = true));
            ?>
</p>
            </div>
            <?php 
        }
        ?>
        <style> #fes-vendor-edit-page{display:none;} div.fes-fields{clear:both;} </style>
        <script type="text/javascript">
            // This is super hackish but it works so well!
            (jQuery)(document).ready(function(){
                (jQuery)(".updated p").prepend("<?php 
        printf(__('%s updated!', 'edd_fes'), EDD_FES()->vendors->get_vendor_constant_name($plural = false, $uppercase = true));
        ?>
");
            });
        </script>
        <h2 class="nav-tab-wrapper">
            <a href="#fes-metabox" class="nav-tab" id="fes-editor-tab"><?php 
        printf(__('%s Overview', 'edd_fes'), EDD_FES()->vendors->get_vendor_constant_name($plural = false, $uppercase = true));
        ?>
</a>
            <a href="#fes-metabox-registration-form" class="nav-tab" id="fes-registration-form"><?php 
        _e('Application Form', 'edd_fes');
        ?>
</a>
            <a href="#fes-metabox-profile-form" class="nav-tab" id="fes-post-settings-form-tab"><?php 
        _e('Profile Form', 'edd_fes');
        ?>
</a>
            <a href="#fes-metabox-products" class="nav-tab" id="fes-products-tab"><?php 
        _e('Products', 'edd_fes');
        ?>
</a>
            <?php 
        if (EDD_FES()->integrations->is_commissions_active()) {
            ?>
            <a href="<?php 
            echo esc_url(admin_url('edit.php?post_type=download&page=edd-commissions&user='******'Commissions', 'edd_fes');
            ?>
</a>
            <?php 
        }
        ?>
            <?php 
        do_action('fes_edit_vendor_form_tab');
        ?>
        </h2>

        <div class="tab-content">
            <div id="fes-metabox" class="group">
                <div class="fes-form">
                    <fieldset>
                        <?php 
        _e('Name: ', 'edd_fes');
        ?>
</td><td><?php 
        echo $user->display_name;
        ?>
                    </fieldset>
                    <fieldset>
                        <?php 
        _e('Status: ', 'edd_fes');
        if (user_can($user->ID, 'fes_is_admin') || user_can($user->ID, 'frontend_vendor')) {
            _e('Frontend Vendor', 'edd_fes');
        } else {
            if (user_can($user->ID, 'pending_vendor')) {
                _e('Pending Vendor', 'edd_fes');
            } else {
                if (user_can($user->ID, 'suspended_vendor')) {
                    _e('Suspended Vendor', 'edd_fes');
                } else {
                    _e('Error!', 'edd_fes');
                }
            }
        }
        ?>
                    </fieldset>
                    <fieldset>
                        <?php 
        printf(__('Total %s: ', 'edd_fes'), EDD_FES()->vendors->get_product_constant_name($plural = true, $uppercase = true));
        ?>
</td><td><?php 
        echo EDD_FES()->vendors->get_all_products_count($user->ID, array('publish', 'pending', 'trash'));
        ?>
                              <br>
                        <?php 
        printf(__('Live %s: ', 'edd_fes'), EDD_FES()->vendors->get_product_constant_name($plural = true, $uppercase = true));
        ?>
</td><td><?php 
        echo EDD_FES()->vendors->get_all_products_count($user->ID, 'publish');
        ?>
                              <br>
                        <?php 
        printf(__('Pending %s: ', 'edd_fes'), EDD_FES()->vendors->get_product_constant_name($plural = true, $uppercase = true));
        ?>
</td><td><?php 
        echo EDD_FES()->vendors->get_all_products_count($user->ID, 'pending');
        ?>
                              <br>
                        <?php 
        printf(__('Trashed %s: ', 'edd_fes'), EDD_FES()->vendors->get_product_constant_name($plural = true, $uppercase = true));
        ?>
</td><td><?php 
        echo EDD_FES()->vendors->get_all_products_count($user->ID, 'trash');
        ?>
                              <br>
                    </fieldset>
                    <fieldset>
                        <?php 
        _e('Actions: ', 'edd_fes');
        if (user_can($user->ID, 'fes_is_admin') || user_can($user->ID, 'frontend_vendor')) {
            ?>
                            <a href="<?php 
            echo admin_url('admin.php?page=fes-vendors&vendor=' . $user->ID . '&action=revoke_vendor&redirect=2');
            ?>
"><?php 
            _e('Revoke', 'edd_fes');
            ?>
</a>&nbsp;
                            <a href="<?php 
            echo admin_url('admin.php?page=fes-vendors&vendor=' . $user->ID . '&action=suspend_vendor&redirect=2');
            ?>
"><?php 
            _e('Suspend', 'edd_fes');
            ?>
</a>
                        <?php 
        } else {
            if (user_can($user->ID, 'pending_vendor')) {
                ?>
                            <a href="<?php 
                echo admin_url('admin.php?page=fes-vendors&vendor=' . $user->ID . '&action=approve_vendor&redirect=2');
                ?>
"><?php 
                _e('Approve', 'edd_fes');
                ?>
</a>&nbsp;
                            <a href="<?php 
                echo admin_url('admin.php?page=fes-vendors&vendor=' . $user->ID . '&action=decline_vendor&redirect=2');
                ?>
"><?php 
                _e('Decline', 'edd_fes');
                ?>
</a>
                        <?php 
            } else {
                if (user_can($user->ID, 'suspended_vendor')) {
                    ?>
                            <a href="<?php 
                    echo admin_url('admin.php?page=fes-vendors&vendor=' . $user->ID . '&action=unsuspend_vendor&redirect=2');
                    ?>
"><?php 
                    _e('Unsuspend', 'edd_fes');
                    ?>
</a>&nbsp;
                            <a href="<?php 
                    echo admin_url('admin.php?page=fes-vendors&vendor=' . $user->ID . '&action=revoke_vendor&redirect=2');
                    ?>
"><?php 
                    _e('Revoke', 'edd_fes');
                    ?>
</a>
                        <?php 
                }
            }
        }
        ?>
                    </fieldset>
                </div>
            </div>

            <div id="fes-metabox-registration-form" class="group">
                <?php 
        EDD_FES()->forms->render_form('registration', $user->ID, true, $args = array('backend' => true));
        ?>
            </div>

            <div id="fes-metabox-profile-form" class="group">
                <?php 
        EDD_FES()->forms->render_form('profile', $user->ID, false, $args = array('backend' => true));
        ?>
            </div>

            <div id="fes-metabox-products" class="group">
                <?php 
        $concat = get_option("permalink_structure") ? "?" : "&";
        $products = EDD_FES()->vendors->get_all_products($user->ID);
        $sales = 0;
        $earnings = 0;
        if (!empty($products)) {
            ?>
                    <table class="widefat" id="fes-all-products">
                    <thead>
                         <tr>
                            <th><?php 
            _e('ID', 'edd_fes');
            ?>
</th>
                            <th><?php 
            _e('Title', 'edd_fes');
            ?>
</th>
                            <th><?php 
            _e('Status', 'edd_fes');
            ?>
</th>
                            <th><?php 
            _e('Sales', 'edd_fes');
            ?>
</th>
                        </tr>
                    </thead>
                     <tbody>

                     <?php 
            foreach ($products as $product) {
                ?>
                         <tr>
                            <td><?php 
                echo esc_html($product['ID']);
                ?>
</td>
                            <td><a href="<?php 
                echo esc_html($product['url']);
                ?>
"><?php 
                echo esc_html($product['title']);
                ?>
</a></td>
                            <td><?php 
                echo esc_html($product['status']);
                ?>
</td>
                            <td><?php 
                echo esc_html($product['sales']);
                ?>
</td>
                        </tr>
                    <?php 
                $sales += $product['sales'];
                ?>
                    <?php 
            }
            ?>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                    <tfoot>
                        <td><strong><?php 
            _e('Total Sales', 'edd_fes');
            ?>
</strong></td>
                            <td></td>
                            <td></td>
                            <td><?php 
            echo $sales;
            ?>
</td>
                    </tfoot>
                    </table>
                <?php 
        } else {
            printf(__('%s has no %s', 'edd_fes'), EDD_FES()->vendors->get_vendor_constant_name($plural = false, $uppercase = true), EDD_FES()->vendors->get_product_constant_name($plural = true, $uppercase = false));
        }
        ?>
            </div>
            <?php 
        if (EDD_FES()->integrations->is_commissions_active()) {
            ?>
            <div id="fes-metabox-commissions" class="group">
                <?php 
            if (eddc_user_has_commissions($user->ID)) {
                echo eddc_user_commissions($user->ID);
            } else {
                printf(__('This %s has no sales yet!', 'edd_fes'), EDD_FES()->vendors->get_vendor_constant_name($plural = false, $uppercase = false));
            }
            ?>
             </div>
            <?php 
        }
        do_action('fes_edit_vendor_tab_content');
        ?>
        </div>
        <?php 
    }
 public function vendor_page_updated($post_id)
 {
     if (!EDD_FES()->helper->get_option('fes-vendor-page', false)) {
         return;
     }
     $page_id = (int) EDD_FES()->helper->get_option('fes-vendor-page', false);
     if ($page_id !== $post_id) {
         return;
     }
     $this->add_rewrite_rules();
     // Set an option so we know to flush the rewrites at the next admin_init
     add_option('fes_permalinks_updated', 1, 'no');
     return $post_id;
 }
示例#26
0
function FES_Install()
{
    require_once fes_plugin_dir . 'classes/admin/class-install.php';
    $install = new FES_Install();
    $install->init();
    EDD_FES()->load_settings();
    do_action('fes_install_actions');
}
 /**
  * Alter the main loop to hide download using pre_get_posts
  * We're not using ! is_main_query because no matter what the query is on the page we want to hide them
  * @since 1.0
  */
 function pre_get_posts($query)
 {
     if (!isset($query)) {
         return;
     }
     if ($query->is_single || function_exists('is_bbpress') && is_bbpress() || is_admin()) {
         return;
     }
     // if a download is hidden, prevent it from being hidden on the FES vendor dashboard page
     if (function_exists('EDD_FES') && is_page(EDD_FES()->helper->get_option('fes-vendor-dashboard-page', false))) {
         return;
     }
     // hide downloads from all queries except singular pages, which will 404 without the conditional
     // is_singular('download') doesn't work inside pre_get_posts
     if (!$query->is_single) {
         $excluded_ids = isset($query->query_vars['post__not_in']) ? $query->query_vars['post__not_in'] : array();
         // make sure we're merging with existing post__not_in so we do not override it
         $query->set('post__not_in', array_merge($excluded_ids, $this->get_hidden_downloads()));
     }
 }
示例#28
0
				<td class = "fes-order-list-td"><?php 
        echo EDD_FES()->dashboard->order_list_total($order->ID);
        ?>
</td>
				<td class = "fes-order-list-td"><?php 
        echo EDD_FES()->dashboard->order_list_customer($order->ID);
        ?>
</td>
				<td class = "fes-order-list-td"><?php 
        EDD_FES()->dashboard->order_list_actions($order->ID);
        ?>
</td>
				<?php 
        do_action('fes-order-table-column-value', $order);
        ?>
				<td class = "fes-order-list-td"><?php 
        echo EDD_FES()->dashboard->order_list_date($order->ID);
        ?>
</td>
			</tr>
		<?php 
    }
} else {
    echo '<tr><td colspan="6">' . __('No orders found', 'edd_fes') . '</td></tr>';
}
?>
	</tbody>
</table>
<?php 
EDD_FES()->dashboard->order_list_pagination();
 /**
  * Mark a payment as shipped.
  *
  * @since 2.0
  *
  * @return void
  */
 function frontend_toggle_shipped_status()
 {
     $payment_id = absint($_GET['order_id']);
     $status = !empty($_GET['new_status']) ? absint($_GET['new_status']) : '1';
     $key = edd_get_payment_key($payment_id);
     if (function_exists('EDD_FES')) {
         if (!EDD_FES()->vendors->vendor_can_view_receipt(false, $key)) {
             wp_safe_redirect(wp_get_referer());
             exit;
         }
     }
     update_post_meta($payment_id, '_edd_payment_shipping_status', $status);
     wp_safe_redirect(wp_get_referer());
     exit;
 }
示例#30
0
 public function get_product_details()
 {
     global $post;
     $form_id = EDD_FES()->helper->get_option('fes-submission-form');
     if (!$form_id) {
         return;
     }
     $fields = get_post_meta($form_id, 'fes-form', true);
     $meta = array();
     if (!$fields) {
         return;
     }
     foreach ($fields as $field) {
         if (!isset($field['product_detail'])) {
             continue;
         }
         $value = get_post_meta($post->ID, $field['name'], true);
         switch ($field['input_type']) {
             case 'image_upload':
                 if ('featured_image' == $field['template']) {
                     $value = get_the_post_thumbnail($post->ID, 'thumbnail');
                 }
                 break;
             case 'file_upload':
                 $uploads = array();
                 foreach ($value as $attachment_id) {
                     $uploads[] = wp_get_attachment_link($attachment_id, 'thumbnail', false, true);
                 }
                 $value = implode('<br />', $uploads);
                 break;
             case 'checkbox':
             case 'multiselect':
                 if (!is_array($value)) {
                     $value = explode('|', $value);
                 } else {
                     $value = array_map('trim', $value);
                 }
                 $value = implode($this->multi_sep, $value);
                 break;
             case 'taxonomy':
                 $terms = wp_get_post_terms($post->ID, $field['name']);
                 if (!is_wp_error($terms)) {
                     switch ($field['type']) {
                         case 'checkbox':
                         case 'multiselect':
                         case 'text':
                             $_terms = array();
                             foreach ($terms as $term) {
                                 $_terms[] = sprintf('<a href="%s">%s</a>', get_term_link($term, $field['name']), $term->name);
                             }
                             $value = implode($this->multi_sep, $_terms);
                             break;
                         case 'select':
                             $value = sprintf('<a href="%s">%s</a>', get_term_link(current($terms), $field['name']), current($terms)->name);
                             break;
                     }
                 }
                 break;
             default:
                 if ('no' != $field['is_meta']) {
                     $value = get_post_meta($post->ID, $field['name'], true);
                 } else {
                     $value = get_post_field($field['name'], $post->ID);
                 }
                 break;
         }
         $label = apply_filters('edd_fpd_label', $field['label'], $field);
         $value = apply_filters('edd_fpd_value', $value, $field);
         if (empty($value)) {
             continue;
         }
         $meta[$label] = $value;
     }
     return $meta;
 }