} else {
        $post_resume = get_post($_GET['jid']);
        if ($post_resume->post_type != 'resume') {
            wp_redirect(get_permalink(get_the_id()));
            exit;
        }
    }
    //endif;
}
//endif;
if (jobboard_get_user_type(get_current_user_id()) == 'job_lister') {
    wp_redirect(jobboard_get_permalink('dashboard'));
    exit;
}
// Enable Package
$is_limit = jobboard_package_is_limit(get_current_user_id(), '_package_resume');
if ($is_limit) {
    wp_redirect(jobboard_get_permalink('dashboard'));
    exit;
}
ob_end_clean();
require_once get_template_directory() . '/includes/frontend-submission/form-submit.php';
//Include Frontend Submission functions
get_header();
?>
<div id="page-title-wrapper">
	<div class="container">
		<?php 
$page_title = __('POST A RESUME', 'jobboard');
$default = array('resume_id' => '', 'resume_title' => '', 'resume_job_title' => '', 'resume_location' => '', 'resume_photo' => '', 'resume_category' => '', 'resume_content' => '', 'resume_skills' => '', 'resume_url' => array(), 'resume_education' => array(), 'resume_experience' => array(), 'resume_file' => '', 'year_experience' => '', 'proposed_monthly_sallary' => '');
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
Example #2
0
/**
 * Payment
 */
function jobboard_active_package_html($user_id, $cpt_args)
{
    $cpt = '';
    $package_heading = '';
    if (!empty($cpt_args) && ($cpt_args = array('resume_view'))) {
        if (jobboard_get_user_type($user_id) == 'job_lister') {
            $cpt = '_resume_subscription';
            $package_heading = __('Resume View Packages:', 'jobboard');
        }
    } else {
        if (jobboard_get_user_type($user_id) == 'job_lister') {
            $cpt = '_package_job';
            $package_heading = __('Job Packages:', 'jobboard');
        }
        if (jobboard_get_user_type($user_id) == 'job_seeker') {
            $cpt = '_package_resume';
            $package_heading = __('Resume Packages:', 'jobboard');
        }
    }
    $package_data = jobboard_get_packages_obj($cpt);
    $active_pack = jobboard_get_user_active_package_data($user_id, $cpt);
    $active_pack_id = $active_pack->ID;
    /**
     * Form processing
     */
    if (isset($_POST['update-package-frontend'])) {
        update_user_meta($user_id, 'jobboard_user' . $cpt, $_POST['jobboard_user' . $cpt]);
        wp_redirect(get_permalink());
        exit;
    }
    /**
     * Paypal payment starts
    */
    $action = '';
    if ('1' == jobboard_option('activate_payment')) {
        $action = jobboard_get_payment_mode();
        $custom = $cpt;
        $listener_url = add_query_arg('action', 'payment_success', esc_url(home_url('/')));
        $args = array('action' => 'payment_success', 'do' => 'update_package');
        $return_url = add_query_arg($args, esc_url(jobboard_get_permalink('dashboard')));
        ?>
			<div class="package-tabs">

			<?php 
        /** Tab Menu **/
        echo '<ul>';
        echo '<h4 class="package-heading">' . $package_heading . '</h4>';
        $user_package = jobboard_get_user_package($user_id, $cpt);
        if (!$user_package) {
            echo '<p class="active-note innactive">' . __('You don\'t have an active package. Please, select one of these available packages!', 'jobboard') . '</p>';
        }
        foreach ($package_data as $post) {
            setup_postdata($post);
            $checked = '';
            if ($post->ID == $active_pack_id) {
                $checked = 'checked="checked"';
            }
            $fieldname = 'jobboard_user' . $cpt;
            $package_info = array('ID' => $post->ID, 'name' => $post->post_title, 'price' => get_post_meta($post->ID, '_jboard' . $cpt . '_price', true));
            $active = '';
            if ($post->ID == $active_pack_id) {
                $active = 'class="ui-tabs-active ui-state-active"';
            }
            ?>


				<li <?php 
            echo $active;
            ?>
><a href="#package-<?php 
            echo $package_info['ID'];
            ?>
"><?php 
            echo $package_info['name'];
            ?>
</a></li>


			<?php 
        }
        wp_reset_postdata($post);
        echo '</ul><!-- /.package-menu -->';
        /** Tab Menu Ends **/
        ?>

			<?php 
        /** Tab Content **/
        foreach ($package_data as $post) {
            setup_postdata($post);
            $package_info = array('ID' => $post->ID, 'name' => $post->post_title, 'price' => get_post_meta($post->ID, '_jboard' . $cpt . '_price', true), 'notes' => get_post_meta($post->ID, '_jboard' . $cpt . '_notes', true), 'limit' => get_post_meta($post->ID, '_jboard' . $cpt . '_limit', true));
            // Unlimited is set
            $unlimited = get_post_meta($post->ID, '_jboard' . $cpt . '_is_unlimited', true);
            if ($unlimited == '1') {
                $package_info['limit'] = 'unlimited';
            }
            $button_text = __('Buy Package', 'jobboard');
            if ($cpt_args != '') {
                $subscription_id = get_user_meta($user_id, 'jobboard_user' . $cpt);
                if (empty($subscription_id)) {
                    $subscription_id = null;
                }
                $subscription_limit = get_user_meta($user_id, 'jobboard_user' . $cpt . '_max_entry');
                $disabled_view_pack = 'disabled';
                $active_note = '';
                $active_note_pack = '';
                if (empty($subscription_limit) || jobboard_get_user_view_remaining($user_id, 'resume') == '0') {
                    $disabled_view_pack = '';
                    $active_note_pack = '<span class="active-note innactive">' . __('Status: Innactive', 'jobboard') . '</span>';
                } else {
                    $active_note_pack = '<span class="active-note">' . __('Status: Active', 'jobboard') . '</span>';
                }
            } else {
                $subscription_id = null;
                $subscription_limit = '';
                $is_limit = jobboard_package_is_limit($user_id, $cpt);
                $disabled = 'disabled';
                if ($is_limit) {
                    $disabled = '';
                }
                $active_note = '';
                if ($post->ID == $active_pack_id && !$is_limit) {
                    $active_note = '<span class="active-note">' . __('Status: Active', 'jobboard') . '</span>';
                }
                if ($post->ID == $active_pack_id && $is_limit) {
                    $active_note = '<span class="active-note innactive">' . __('Status: Innactive', 'jobboard') . '</span>';
                    // $disabled = 'disabled';
                }
            }
            ?>


				<div id="package-<?php 
            echo $package_info['ID'];
            ?>
" class="package-details">


					<?php 
            if ((int) $subscription_id[0] == $package_info['ID']) {
                echo $active_note_pack;
            } else {
                echo $active_note;
            }
            ?>


					<div class="package-notes">
						<?php 
            echo $package_info['notes'];
            ?>
					</div><!-- /.package-notes -->

					<!-- Payment form -->

						<form id="paypal_approval" name="paypal_approval" action="<?php 
            echo esc_url($action);
            ?>
" method="POST" class="payment-button">
							<input type="hidden" name="cmd" value="_xclick" />
							<input class="package-price" type="hidden" name="amount" value="<?php 
            echo $package_info['price'];
            ?>
" />
							<input type="hidden" name="business" value="<?php 
            echo jobboard_option('paypal_email');
            ?>
" />
							<input class="package-name" type="hidden" name="item_name" value="<?php 
            echo $package_info['name'];
            ?>
" />
							<input class="package-id" type="hidden" name="item_number" value="<?php 
            echo $package_info['ID'];
            ?>
" />
							<input type="hidden" name="no_shipping" value="1" />
							<input type="hidden" name="no_note" value="1" />
							<input type="hidden" name="currency_code" value="<?php 
            echo jobboard_option('payment_currency');
            ?>
" />
							<input type="hidden" name="charset" value="UTF-8" />
							<input type="hidden" name="custom" value="<?php 
            echo esc_attr($custom . ', ' . $package_info['limit']);
            ?>
" />
							<input type="hidden" name="rm" value="2" />
							<input type="hidden" name="cbt" value="<?php 
            echo sprintf(__('Click here to complete the purchase on %s', 'jobboard'), esc_attr(get_bloginfo('name')));
            ?>
" />
							<input type="hidden" name="return" value="<?php 
            echo esc_url($return_url);
            ?>
" />
							<input type="hidden" name="notify_url" value="<?php 
            echo esc_url($listener_url);
            ?>
" />

							<?php 
            if ($cpt_args != '') {
                ?>

								<button <?php 
                echo $disabled_view_pack;
                ?>
 type="submit" name="paynow" class="btn btn-paypal"><?php 
                echo $button_text;
                ?>
</button>

							<?php 
            } else {
                ?>

							<button <?php 
                echo $disabled;
                ?>
 type="submit" name="paynow" class="btn btn-paypal"><?php 
                echo $button_text;
                ?>
</button>

							<?php 
            }
            ?>

					</form>

					<!-- Payment form ends -->


				</div><!-- /.package-details -->


			<?php 
        }
        /** Tab Content Ends **/
        echo '</div><!-- /.package-tabs -->';
        ?>


<?php 
        /**
         * Paypal payment ends
        */
    }
}