我安装了一个jobroller主题。单击位于右上角的登录按钮时,它会显示两个带单选按钮的选项。 1.雇主2.Job-Seeker和Admin
我想删除第一个选项,即雇主并保留求职者选项。我修改了名为register-form.php的文件。问题是它工作了两次三次,但单选按钮没有显示,当登录表单填写并单击提交按钮时,它会生成一个角色错误,这意味着选择角色或选中单选按钮然后提交。
我曾尝试再次复制register-form.php文件,以便它可以工作,但它不显示。您可以通过此链接访问该页面。
http://www.selfreliance.com.pk/login/
register-form.php的代码在这里。
<?php
/**
* JobRoller Registration Form
* Function outputs the registration form
*
*
* @version 1.6.3
* @author AppThemes
* @package JobRoller
* @copyright 2010 all rights reserved
*
*/
add_action( 'jr_display_register_form', 'jr_register_form', 10, 2 );
function jr_register_form( $redirect = '', $role = 'job_lister' ) {
global $posted, $app_abbr;
if ( get_option('users_can_register') ) {
if ( ! $redirect ) $redirect = get_permalink( JR_Dashboard_Page::get_id() );
$show_password_fields = apply_filters('show_password_fields_on_registration', true);
?>
<h2><?php _e('Create a free account', APP_TD); ?></h2>
<form action="<?php echo appthemes_get_registration_url(); ?>" method="post" class="account_form" name="registerform" id="login-form">
<?php
if ( 'yes' == get_option('jr_allow_job_seekers') ) :
if ( ! $role || 'yes' == get_option( $app_abbr.'_allow_recruiters' ) ) :
?>
<p class="role">
<?php if ( ! is_page( JR_Job_Submit_Page::get_id() ) ): ?>
<label class="alt"><input type="radio" tabindex="6" name="role" value="job_seeker" <?php checked( isset($posted['role']) && $posted['role']=='job_seeker' ); ?> /> <?php _e( 'I am a <strong>Job Seeker</strong>', APP_TD ); ?></label>
<?php endif; ?>
</p>
<?php if ( 'yes' == get_option( $app_abbr.'_allow_recruiters' ) ) : ?>
<p class="role"><label class="alt"><input type="radio" tabindex="7" name="role" value="recruiter" <?php checked( isset($posted['role']) && $posted['role']=='recruiter' ); ?> /> <?php _e( 'I am a <strong>Recruiter</strong>', APP_TD ); ?></label></p>
<?php endif; ?>
<?php
elseif ( $role == 'job_lister' ) :
echo '<input type="hidden" name="role" value="job_lister" />';
elseif ( $role == 'job_seeker') :
echo '<input type="hidden" name="role" value="job_seeker" />';
elseif ( $role == 'recruiter' && 'yes' == get_option( $app_abbr.'_allow_recruiters' ) ) :
echo '<input type="hidden" name="role" value="recruiter" />';
endif;
endif;
?>
<div class="account_form_fields">
<p>
<label for="user_login"><?php _e('Username', APP_TD); ?></label><br/>
<input type="text" class="text" tabindex="8" name="user_login" id="user_login" value="<?php if (isset($_POST['user_login'])) echo esc_attr(stripslashes($_POST['user_login'])); ?>" />
</p>
<p>
<label for="user_email"><?php _e('Email', APP_TD); ?></label><br/>
<input type="text" class="text" tabindex="9" name="user_email" id="user_email" value="<?php if (isset($_POST['user_email'])) echo esc_attr(stripslashes($_POST['user_email'])); ?>" />
</p>
<?php if ( $show_password_fields ) : ?>
<p>
<label for="your_password"><?php _e('Enter a password', APP_TD); ?></label><br/>
<input type="password" class="text" tabindex="10" name="pass1" id="pass1" value="" />
</p>
<p>
<label for="your_password_2"><?php _e('Enter password again', APP_TD); ?></label><br/>
<input type="password" class="text" tabindex="11" name="pass2" id="pass2" value="" />
</p>
<p>
<div id="pass-strength-result" class="hide-if-no-js"><?php _e( 'Strength indicator', APP_TD ); ?></div>
<p><span class="description indicator-hint"><?php _e( 'Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).', APP_TD ); ?></span></p>
</p>
<?php endif; ?>
<?php
// include the spam checker if enabled();
if ( current_theme_supports( 'app-recaptcha' ) )
appthemes_recaptcha();
?>
<?php if ( get_option('jr_terms_page_id') > 0 || 'yes' == get_option('jr_enable_terms_conditions') ) : ?><p>
<input type="checkbox" name="terms" tabindex="12" value="yes" id="terms" <?php if (isset($_POST['terms'])) echo 'checked="checked"'; ?> /> <label for="terms"><?php _e('I accept the ', APP_TD); ?><a href="<?php echo get_permalink( JR_Terms_Conditions_Page::get_id() ); ?>" target="_blank"><?php _e('terms & conditions', APP_TD); ?></a>.</label>
</p><?php endif; ?>
<?php do_action('register_form'); ?>
<p>
<input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect); ?>" />
<input type="submit" class="submit" tabindex="13" name="register" value="<?php _e('Create Account →', APP_TD); ?>" />
</p>
</div>
<!-- autofocus the field -->
<script type="text/javascript">try{document.getElementById('user_login').focus();}catch(e){}</script>
</form>
<?php
}
}
答案 0 :(得分:1)
<?php
/**
* JobRoller Registration Form.
* Outputs the registration form.
*
* @version 1.6.3
* @author AppThemes
* @package JobRoller\Forms\Register
* @copyright 2010 all rights reserved
*/
add_action( 'jr_display_register_form', 'jr_register_form', 10, 2 );
function jr_register_form( $redirect = '', $role = 'job_lister' ) {
global $posted, $jr_options;
if ( ! get_option('users_can_register') ) {
return;
}
if ( ! $redirect ) {
$redirect = get_permalink( JR_Dashboard_Page::get_id() );
}
$show_password_fields = apply_filters( 'show_password_fields_on_registration', true );
?>
<h2><?php _e( 'Create a free account', APP_TD ); ?></h2>
<form action="<?php echo appthemes_get_registration_url(); ?>" method="post" class="account_form" name="registerform" id="login-form">
<?php /* if ( $jr_options->jr_allow_job_seekers ): ?>
<?php if ( ! $role || $jr_options->jr_allow_recruiters ): ?>
<p class="role">
<label><input type="radio" name="role" tabindex="5" value="job_lister" <?php checked( empty( $posted['role'] ) || $posted['role'] == 'job_lister' ); ?> /> <?php _e( 'I am an <strong>Employer</strong>', APP_TD ); ?></label >
<?php if ( ! is_page( JR_Job_Submit_Page::get_id() ) ): ?>
<label class="alt"><input type="radio" tabindex="6" name="role" value="job_seeker" <?php checked( isset( $posted['role'] ) && $posted['role'] == 'job_seeker' ); ?> /> <?php _e( 'I am a <strong>Job Seeker</strong>', APP_TD ); ?></label>
<?php endif; ?>
</p ?>
<?php if ( $jr_options->jr_allow_recruiters ): ?>
<p class="role"><label class="alt"><input type="radio" tabindex="7" name="role" value="recruiter" <?php checked( isset( $posted['role'] ) && $posted['role'] == 'recruiter' ); ?> /> <?php _e( 'I am a <strong>Recruiter</strong>', APP_TD ); ?></label></p>
<?php endif; ?>
<?php
elseif ( $role == 'job_lister' ) :
echo '<input type="hidden" name="role" value="job_lister" />';
elseif ( $role == 'job_seeker') :
echo '<input type="hidden" name="role" value="job_seeker" />';
elseif ( $role == 'recruiter' && $jr_options->jr_allow_recruiters ) :
echo '<input type="hidden" name="role" value="recruiter" />';
endif;
?>
<?php endif; */ ?>
<div class="account_form_fields">
<p>
<label for="user_login"><?php _e( 'First Name', APP_TD ); ?></label><br/>
<input type="text" class="text required" tabindex="8" name="user_login" id="user_login" value="<?php if ( isset( $_POST['user_login'] ) ): esc_attr_e( stripslashes( $_POST['user_login'] ) ); endif; ?>" />
</p>
<p>
<label for="user_login"><?php _e( 'Last Name', APP_TD ); ?></label><br/>
<input type="text" class="text required" tabindex="8" name="user_login" id="user_login" value="<?php if ( isset( $_POST['user_login'] ) ): esc_attr_e( stripslashes( $_POST['user_login'] ) ); endif; ?>" />
</p>
<p>
<label for="user_login"><?php _e( 'Username', APP_TD ); ?></label><br/>
<input type="text" class="text required" tabindex="8" name="user_login" id="user_login" value="<?php if ( isset( $_POST['user_login'] ) ): esc_attr_e( stripslashes( $_POST['user_login'] ) ); endif; ?>" />
</p>
<input type="hidden" name="role" value="job_seeker" />
<p>
<label for="user_email"><?php _e( 'Email', APP_TD ); ?></label><br/>
<input type="text" class="text required" tabindex="9" name="user_email" id="user_email" value="<?php if ( isset( $_POST['user_email'] ) ): esc_attr_e( stripslashes( $_POST['user_email'] ) ); endif; ?>" />
</p>
<?php if ( $show_password_fields ) : ?>
<p>
<label for="your_password"><?php _e( 'Enter a password', APP_TD ); ?></label><br/>
<input type="password" class="text required" tabindex="10" name="pass1" id="pass1" value="" />
</p>
<p>
<label for="your_password_2"><?php _e( 'Enter password again', APP_TD ); ?></label><br/>
<input type="password" class="text required" tabindex="10" name="pass2" id="pass" value="" />
</p>
<!--p>
<label for="your_password_2"><?php //_e( 'Enter password again', APP_TD ); ?></label><br/>
<input type="password" class="text required" tabindex="10" name="pass2" id="pass2" value="" />
</p-->
<br/><div id="pass-strength-result" class="hide-if-no-js"><?php _e( 'Strength indicator', APP_TD ); ?></div>
<p><span class="description indicator-hint"><?php _e( 'Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).', APP_TD ); ?></span></p>
<?php endif; ?>
<?php if ( jr_display_recaptcha('app-recaptcha') ): ?>
<?php appthemes_recaptcha(); ?>
<?php endif; ?>
<div class="g-recaptcha" data-sitekey="6LfVZQwTAAAAAE-nJl6EWMz3QC8cHUvWCGvl7ioo"></div>
<?php if ( $jr_options->jr_terms_page_id > 0 || $jr_options->jr_enable_terms_conditions ): ?>
<p>
<input type="checkbox" name="terms" tabindex="12" value="yes" id="terms" class="required" <?php checked( isset( $_POST['terms'] ) ); ?> />
<label for="terms"><?php _e( 'I accept the ', APP_TD ); ?><a href="<?php echo esc_url( get_permalink( JR_Terms_Conditions_Page::get_id() ) ); ?>" target="_blank"><?php _e( 'terms & conditions', APP_TD ); ?></a>.</label>
</p>
<?php endif; ?>
<?php do_action('register_form'); ?>
<p>
<input type="hidden" name="redirect_to" value="<?php esc_attr_e( $redirect ); ?>" />
<input type="submit" class="submit" tabindex="13" name="register" value="<?php _e( 'Create Account →', APP_TD ); ?>" />
</p>
</div>
<!-- autofocus the field -->
<script type="text/javascript">try{document.getElementById('user_login').focus();}catch(e){}</script>
</form>
<?php
}