How do I change the following files in function.php:
if ( empty( $atts ) || ! isset( $atts['id'] ) ) {
return '';
}
/**
* Applies a filter to override the 'users_can_register' setting.
*
* The 'ur_register_setting_override' filter allows developers to customize
* the 'users_can_register' setting by providing an alternative value.
*
* @param bool $default_value Default value retrieved from the 'users_can_register' setting.
*/
$users_can_register = apply_filters( 'ur_register_setting_override', get_option( 'users_can_register' ) );
if ( ! is_user_logged_in() ) {
if ( ! $users_can_register ) {
/**
* Applies a filter to customize the pre-form message for user registration.
*
* @param string $default_message Default pre-form message.
*/
return apply_filters( 'ur_register_pre_form_message', '<p class="alert" id="ur_register_pre_form_message">' . __( 'Only administrators can add new users.', 'user-registration' ) . '</p>' );
}
} else {
/**
* Applies a filter to customize the capability required for user registration.
*
* @param string $default_capability Default user capability.
*/
$current_user_capability = apply_filters( 'ur_registration_user_capability', 'create_users' );
if ( ! current_user_can( $current_user_capability ) ) {
global $wp;
$user_ID = get_current_user_id();
$user = get_user_by( 'ID', $user_ID );
$current_url = home_url( add_query_arg( array(), $wp->request ) );
$display_name = ! empty( $user->data->display_name ) ? $user->data->display_name : $user->data->user_email;
/**
* Applies a filter to customize the pre-form message for user registration.
*
* @param string $default_message Default pre-form message.
*/
/* translators: 1: Link and username of user 2: Logout url */
return apply_filters( 'ur_register_pre_form_message', '<p class="alert" id="ur_register_pre_form_message">' . sprintf( __( 'You are currently logged in as %1$1s. %2$2s', 'user-registration' ), '<a href="#" title="' . $display_name . '">' . $display_name . '</a>', '<a href="' . wp_logout_url( $current_url ) . '" title="' . __( 'Log out of this account.', 'user-registration' ) . '">' . __( 'Logout', 'user-registration' ) . ' »</a>' ) . '</p>', $user_ID );
}
}
$atts = shortcode_atts(
array(
'id' => '',
),
$atts,
'user_registration_form'
);
/**
* Fires when rendering scripts for the 'user_registration_form' shortcode.
*
* The 'user_registration_form_shortcode_scripts' action allows developers
* to enqueue custom scripts or perform actions related to the 'user_registration_form' shortcode.
*
* @param array $atts Shortcode attributes passed for customization.
*/
do_action( 'user_registration_form_shortcode_scripts', $atts );
ob_start();
self::render_form( $atts['id'] );
return ob_get_clean();
}
I want to remove this code:
if ( ! $users_can_register ) {
/**
* Applies a filter to customize the pre-form message for user registration.
*
* @param string $default_message Default pre-form message.
*/
return apply_filters( 'ur_register_pre_form_message', '<p class="alert" id="ur_register_pre_form_message">' . __( 'Only administrators can add new users.', 'user-registration' ) . '</p>' );
}
I'm currently not allowing everyone to register, but this form plugin isn't working either. If I remove the above code, it can work fine. However I don't want to change the original code of the plugin.
I don't allow someone to register using wordpress' native registration feature. I want my customers to register using a custom registration form. Many of my customers register using the default registration form, this makes me confused about dealing with them.
I would be very grateful if someone could provide an answer.