• Hello everyone

    i have created theme-my-login-custom.php file in to the plugins folder and have added this code inside it

    <?php
    function tml_user_register( $user_id ) {
            if ( !empty( $_POST['user_login'] ) )
               $encrypted_key = mb_substr (preg_replace("/[^A-Za-z0-9 ]|\W|\s/", "M",(wp_hash_password($_POST['user_login']))),8,10 );
                  update_user_meta( $user_id, 'encrypted_key', $encrypted_key );
    
    }
    add_action( 'user_register', 'tml_user_register' );
    ?>

    also

    I have copied profile-form.php from templates folder to my themes folder and have added this code inside

    <form action="<?php $template->the_action_url( 'key' ); ?>" method="post">
    <tr class="tml-key-wrap">
    <th><label for="key"><?php _e( 'Key', 'theme-my-login' ); ?></label></th>
    <td><input type="text" name="key" id="key" value="<?php echo esc_attr( $profileuser->encrypted_key ); ?>"
    disabled="disabled" class="regular-text" />
    
    <input type="submit" value="<?php esc_attr_e( 'Update Key', 'theme-my-login' ); ?>" name="submit1" />
    
    </td></tr>
    </form>

    and

    I have created key-form.php in the theme-my-login/templates folder and have added this code inside

    <?php
    
    if (isset($_POST['submit1']))
    {
       $encrypted_key = mb_substr (preg_replace("/[^A-Za-z0-9 ]|\W|\s/", "M",(wp_hash_password($_POST['key']))),8,10 );
       update_user_meta( $user_id, 'encrypted_key', $encrypted_key );
    }
    
    ?>

    now when the user is registerd encrypted_key is created and is written in db->wp_usermeta and is also shown on the profile page (it’s good till now ), but if I click on button (the button which have I added, not the mane update profile button) to update the key nothing happens.

    so how can I fix this issue?

    I am a beginner so any help will be greatly appreciated.

    Regards MK

    https://wordpress.org/plugins/theme-my-login/

The topic ‘Button inside profile page’ is closed to new replies.