admin管理员组

文章数量:1125629

I am using WP Form Locker Add-on Plugin.

When you confirm your email the plugin sends you email with verification link.

The email reaches in English.

I want to make it reach in Arabic

This is the Filter Hook from the Plugin:

private function send_email( $email, $form_id ) {

        $hash              = $this->generate_hash( $form_id, $email );
        $refer_link        = isset( $_SERVER['HTTP_REFERER'] ) ? esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : '';
        $refer_link        = remove_query_arg( 'wpforms_locker_email_verification_token' , $refer_link );
        $verification_link = esc_url( add_query_arg( 'wpforms_locker_email_verification_token', $hash, $refer_link ) );
        $subject           = apply_filters( 'wpforms_form_locker_email_send_email_subject', esc_html__( 'Email address confirmation', 'wpforms-form-locker' ) );
        $text              = sprintf(
            '%1$s <a href="' . $refer_link . '" class="break-all">' . $refer_link . '</a><br/><br/>'
            . '%2$s <a href="' . $verification_link . '"> %3$s </a> %4$s <br/><br/>'
            . '%5$s <br/><span class="break-all">' . $verification_link . '</span>',
            esc_html__( 'Email address confirmation is required to access the form at', 'wpforms-form-locker' ),
            esc_html__( 'To confirm your email address and access the form, please ', 'wpforms-form-locker' ),
            esc_html__( 'visit this link to', 'wpforms-form-locker' ),
            esc_html__( 'verify your email address', 'wpforms-form-locker' ),
            esc_html__( 'Alternately, you can copy and paste the following URL in your browser: ', 'wpforms-form-locker' )
        );
        $message           = apply_filters( 'wpforms_form_locker_email_send_email_message', $text );
        $message           = sprintf( '<tr><td class="field-name field-value">%1$s</td></tr>', $message );

        // If it's not a plain text template, replace line breaks.
        if ( Helpers::is_plain_text_template() ) {
            // Replace <br/> tags with line breaks.
            $message = str_replace( '<br/>', "\r\n", $message );
        }

        // Create an argument array for the template.
        $args = [
            'body' => [
                'message' => $message,
            ],
        ];

        /**
         * Filter to customize the email template name independently of the global setting.
         *
         * @since 2.6.0
         *
         * @param string $template_name The template name to be used.
         */
        $template_name  = apply_filters( 'wpforms_locker_lockers_email_template_name', Helpers::get_current_template_name() );
        $template_class = Helpers::get_current_template_class( $template_name );
        $template       = ( new $template_class() )->set_args( $args );

        $content = $template->get();

        if ( ! $content ) {
            return;
        }

        ( new Mailer() )
            ->subject( $subject )
            ->template( $template )
            ->to_email( $email )
            ->send();
    }

How to do it when the site is in Arabic Version and keep it in English in English version

The website uses www.example/ar/ for Arabic and www.example/en/ for English

I am using WPML for Languages.

Thank you so much in advanced.

本文标签: pluginsCustomize WP Filter Hook