Example #1
0
			<a class="button" href="<?php 
    echo apply_filters('submit_job_form_logout_url', wp_logout_url(get_permalink()));
    ?>
"><?php 
    _e('Sign out', 'wp-job-manager');
    ?>
</a>
		</div>
	</fieldset>

<?php 
} else {
    $account_required = job_manager_user_requires_account();
    $registration_enabled = job_manager_enable_registration();
    $generate_username_from_email = job_manager_generate_username_from_email();
    $login_url = listable_get_login_url();
    $classes = listable_get_login_link_class('button');
    ?>
	<fieldset>
		<label><?php 
    _e('Have an account?', 'wp-job-manager');
    ?>
</label>
		<div class="field account-sign-in <?php 
    echo listable_using_lwa() ? 'lwa' : '';
    ?>
">
			<a class="<?php 
    echo $classes;
    ?>
" href="<?php 
Example #2
0
    public function widget($args, $instance)
    {
        global $post;
        $placeholders = $this->get_placeholder_strings();
        //only put in the default title if the user hasn't saved anything in the database e.g. $instance is empty (as a whole)
        $title = apply_filters('widget_title', empty($instance) || !isset($instance['title']) ? $placeholders['title'] : $instance['title'], $instance, $this->id_base);
        $claim_button_text = empty($instance) || !isset($instance['claim_button_text']) ? $placeholders['claim_button_text'] : $instance['claim_button_text'];
        $claim_description_text = empty($instance) || !isset($instance['claim_description_text']) ? $placeholders['claim_description_text'] : $instance['claim_description_text'];
        $classes = WP_Job_Manager_Claim_Listing()->listing->add_post_class(array());
        if (isset($classes[0]) && !empty($classes[0])) {
            if ($classes[0] == 'claimed') {
                return;
            }
        }
        echo $args['before_widget'];
        if (!empty($title) || !empty($claim_button_text)) {
            //make sure that Login with Ajax can work
            if (empty($paid_claims) && !is_user_logged_in() && listable_using_lwa()) {
                //we need a wrapper with the lwa class
                $args['before_title'] .= '<div class="lwa">';
                $args['after_title'] = '</div>' . $args['after_title'];
            }
            echo $args['before_title'] . $title;
            if (!empty($claim_button_text)) {
                $paid_claims = get_option('wpjmcl_paid_claiming');
                $paid_claim_listing_page = job_manager_get_permalink('claim_listing');
                $href = esc_url(wp_nonce_url(add_query_arg(array('action' => 'claim_listing', 'listing_id' => $post->ID), $paid_claim_listing_page), 'claim_listing', 'claim_listing_nonce'));
                $classes = 'listing-claim-button';
                if (empty($paid_claims) && !is_user_logged_in()) {
                    $href = listable_get_login_url();
                    $classes = listable_get_login_link_class($classes);
                }
                echo ' <a class="' . $classes . '" href="' . $href . '">' . $claim_button_text . '</a>';
            }
            echo $args['after_title'];
        }
        if (!empty($claim_description_text)) {
            echo '<small class="listing-claim-description">' . $claim_description_text . '</small>';
        }
        wc_print_notices();
        ?>

		<?php 
        echo $args['after_widget'];
    }