[英]Redirect after register wordpress
I have a form that is created by the Tutor LMS plugin.我有一个由 Tutor LMS 插件创建的表单。 It is a registration form.
这是一张登记表。 I have a form that is created by the Tutor LMS plugin.
我有一个由 Tutor LMS 插件创建的表单。 It is a registration form.
这是一张登记表。 I have a form that is created by the Tutor LMS plugin.
我有一个由 Tutor LMS 插件创建的表单。 It is a registration form.
这是一张登记表。 sorry for typing that too many times, because I could not submit it cus the question has too many code and I had to type more.
抱歉输入太多次,因为我无法提交它,因为问题代码太多,我不得不输入更多。
<?php
/**
* @package TutorLMS/Templates
* @version 1.4.3
*/
?>
<?php if ( ! get_option( 'users_can_register', false ) ) : ?>
<?php
$args = array(
'image_path' => tutor()->url . 'assets/images/construction.png',
'title' => __( 'Oooh! Access Denied', 'tutor' ),
'description' => __( 'You do not have access to this area of the application. Please refer to your system administrator.', 'tutor' ),
'button' => array(
'text' => __( 'Go to Home', 'tutor' ),
'url' => get_home_url(),
'class' => 'tutor-button tutor-button-primary',
),
);
tutor_load_template( 'feature_disabled', $args );
?>
<?php else : ?>
<?php do_action( 'tutor_before_instructor_reg_form' ); ?>
<form method="post" enctype="multipart/form-data">
<?php do_action( 'tutor_instructor_reg_form_start' ); ?>
<?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
<input type="hidden" value="tutor_register_instructor" name="tutor_action"/>
<?php
$errors = apply_filters( 'tutor_instructor_register_validation_errors', array() );
if ( is_array( $errors ) && count( $errors ) ) {
echo '<div class="tutor-alert-warning"><ul class="tutor-required-fields">';
foreach ( $errors as $error_key => $error_value ) {
echo '<li>' . $error_value . '</li>';
}
echo '</ul></div>';
}
?>
<div class="tutor-form-row">
<div class="tutor-form-col-6">
<div class="tutor-form-group">
<label>
<?php _e( 'First Name', 'tutor' ); ?>
</label>
<input type="text" name="first_name" value="<?php echo esc_attr( tutor_utils()->input_old( 'first_name' ) ); ?>" placeholder="<?php _e( 'First Name', 'tutor' ); ?>" required autocomplete="given-name">
</div>
</div>
<div class="tutor-form-col-6">
<div class="tutor-form-group">
<label>
<?php _e( 'Last Name', 'tutor' ); ?>
</label>
<input type="text" name="last_name" value="<?php echo esc_attr( tutor_utils()->input_old( 'last_name' ) ); ?>" placeholder="<?php _e( 'Last Name', 'tutor' ); ?>" required autocomplete="family-name">
</div>
</div>
</div>
<div class="tutor-form-row">
<div class="tutor-form-col-6">
<div class="tutor-form-group">
<label>
<?php _e( 'User Name', 'tutor' ); ?>
</label>
<input type="text" name="user_login" class="tutor_user_name" value="<?php echo esc_attr( tutor_utils()->input_old( 'user_login' ) ); ?>" placeholder="<?php _e( 'User Name', 'tutor' ); ?>" required autocomplete="username">
</div>
</div>
<div class="tutor-form-col-6">
<div class="tutor-form-group">
<label>
<?php _e( 'E-Mail', 'tutor' ); ?>
</label>
<input type="text" name="email" value="<?php echo esc_attr( tutor_utils()->input_old( 'email' ) ); ?>" placeholder="<?php _e( 'E-Mail', 'tutor' ); ?>" required autocomplete="email">
</div>
</div>
</div>
<div class="tutor-form-row">
<div class="tutor-form-col-6">
<div class="tutor-form-group">
<label>
<?php _e( 'Password', 'tutor' ); ?>
</label>
<input type="password" name="password" value="<?php echo esc_attr( tutor_utils()->input_old( 'password' ) ); ?>" placeholder="<?php _e( 'Password', 'tutor' ); ?>" required autocomplete="new-password">
</div>
</div>
<div class="tutor-form-col-6">
<div class="tutor-form-group">
<label>
<?php _e( 'Password confirmation', 'tutor' ); ?>
</label>
<input type="password" name="password_confirmation" value="<?php echo esc_attr( tutor_utils()->input_old( 'password_confirmation' ) ); ?>" placeholder="<?php _e( 'Password Confirmation', 'tutor' ); ?>" required autocomplete="new-password">
</div>
</div>
</div>
<?php
/**
* @since 2.8.1
*/
if(class_exists('Edumall')){
$privacy_page_id = get_option( 'wp_page_for_privacy_policy', 0 );
$privacy_link_html = esc_html__( 'Privacy Policy', 'edumall' );
if ( $privacy_page_id ) {
$privacy_link_html = sprintf( '<a href="%1$s" class="edumall-privacy-policy-link" target="_blank">%2$s</a>',
esc_url( get_permalink( $privacy_page_id ) ),
$privacy_link_html
);
}
$terms_conditions_page_id = Edumall::setting( 'page_for_terms_and_conditions', 0 );
$terms_conditions_link_html = esc_html__( 'Terms', 'edumall' );
if ( $terms_conditions_page_id ) {
$terms_conditions_link_html = sprintf( '<a href="%1$s" class="edumall-terms-conditions-link" target="_blank">%2$s</a>',
esc_url( get_permalink( $terms_conditions_page_id ) ),
$terms_conditions_link_html
);
}
}
?>
<div class="form-group accept-account">
<label class="form-label form-label-checkbox" for="ip_accept_account">
<input type="checkbox" id="ip_accept_account" class="form-control"
name="accept_account" required value="1">
<?php
if(isset($privacy_link_html, $privacy_link_html)){
printf( esc_html__( 'Accept the %1$s and %2$s', 'edumall' ), $terms_conditions_link_html, $privacy_link_html );
}
?>
</label>
<p>
<label id="mc4wp-subscribe" style="display: none;">
<input type="checkbox" name="mc4wp-subscribe" value="1" checked/>
اشترك فى نشرتنا البريدية.
</label>
</p>
</div>
<div class="tutor-form-row">
<div class="tutor-form-col-12">
<div class="tutor-form-group">
<?php
// providing register_form hook
do_action( 'tutor_instructor_reg_form_middle' );
do_action( 'register_form' );
?>
</div>
</div>
</div>
<?php do_action( 'tutor_instructor_reg_form_end' ); ?>
<div class="tutor-form-row">
<div class="tutor-form-col-12">
<div class="tutor-form-group tutor-reg-form-btn-wrap">
<button type="submit" name="tutor_register_instructor_btn" value="register" class="tutor-button"><?php _e( 'Register as instructor', 'tutor' ); ?></button>
[bws_google_captcha]
</div>
</div>
</div>
</form>
<?php do_action( 'tutor_after_instructor_reg_form' ); ?>
<?php endif; ?>
I want when someone registers successfully, it redirects them to another page.我希望当有人成功注册时,它将他们重定向到另一个页面。
How to do that?怎么做? please advise me..........
请建议我..........
You have to use a filter to set the redirect URL. Here is a snippet from the Developer Docs:您必须使用过滤器来设置重定向 URL。这是开发人员文档中的一个片段:
add_filter( 'registration_redirect', 'my_redirect_home' );
function my_redirect_home( $registration_redirect ) {
return home_url();
}
https://developer.wordpress.org/reference/hooks/registration_redirect/ https://developer.wordpress.org/reference/hooks/registration_redirect/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.