• Resolved agusgonzalezs

    (@agusgonzalezs)


    hello, I want to show a button to hide/show the password of the login form. Is there any custom code to do it?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Jair – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @agusgonzalezs,

    I hope you are doing well today!

    This issue has been flagged to our SLS (Second Line Support) Team so that they can dig into this further. We will post an update here as soon as more information is available.

    Thank you for your patience while we look into this further.

    Kind regards,
    Zafer

    Plugin Support Jair – WPMU DEV Support

    (@wpmudevsupport15)

    Hi again @agusgonzalezs,

    You can use the following code snippet as mu-plugin.

    add_filter( 'forminator_field_password_markup', 'wpmudev_password_html_render', 10, 2 );
    function wpmudev_password_html_render( $html, $field ) {
    	$pos = strpos( $html, '</div>' );
    	if ( $pos !== false ) {
    		$html = substr_replace($html, '<span id="toggle_pwd" class="forminator-description forminator-description-password"> Show/Hide Password </span></div>', $pos, strlen('</div>'));
    	}
    	return $html;
    }
    
    add_action( 'wp_footer', function(){
    	global $post;
    	if( ! $post instanceof WP_Post || ! has_shortcode( $post->post_content, 'forminator_form' ) ) {
    		return;
    	}
    	?>
    	<style>
    	#toggle_pwd{
    		cursor: pointer;
    		text-align:right;
    	}
    	</style>
    	<script type="text/javascript">
    	jQuery( document ).ready( function($) {
    		setTimeout(function() {
    			$('.forminator-custom-form').trigger('after.load.forminator');
    		},100);
    
    		$(document).on('after.load.forminator', function(event, form_id) {
    			if ( event.target.id == 'forminator-module-3643' ) {
    				$("#toggle_pwd").click(function () {
    					$(this).toggleClass("fa-eye fa-eye-slash");
    					var type = $(this).hasClass("fa-eye-slash") ? "text" : "password";
    					$("#password-1 input").attr("type", type);
    				});
    			}
    		});
    	});
    	</script>
    	<?php
    },9999);

    You will need to replace the form ID from 3643 to their form’s ID here.
    if ( event.target.id == 'forminator-module-3643' ) {

    Please find more information below on how to use mu-plugins.
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Kind regards,
    Zafer

    Thread Starter agusgonzalezs

    (@agusgonzalezs)

    Thank you very much for the reply. Although I added the plugin as indicated in the tutorial and the Hide/Show Password text appears, it does not allow clicking or performs any action.

    https://riosdeaguaviva.wnpower.host/registro/

    Plugin Support Jair – WPMU DEV Support

    (@wpmudevsupport15)

    Hi again @agusgonzalezs,

    I tested again on my lab without issues, did you change the line where module number added like this?

    if ( event.target.id == 'forminator-module-33844' ) {

    Did you also create a php file under /wp-content/mu-plugins directory and add <?php to the top of the file as a first line?

    Kind regards,
    Zafer

    Thread Starter agusgonzalezs

    (@agusgonzalezs)

    Yes to everything. The id would be the same as the shortcode of the form ?

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @agusgonzalezs

    I hope you are doing well.

    Yes, it is the same ID of shortcode, you can also find it while editing the Form in the URL.

    Best Regards
    Patrick Freitas

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @agusgonzalezs ,

    We haven’t heard from you for some time now, so it looks like you don’t need our assistance anymore.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘hide/show password’ is closed to new replies.