Title: Button inside profile page
Last modified: August 30, 2016

---

# Button inside profile page

 *  [mk](https://wordpress.org/support/users/mk-ned/)
 * (@mk-ned)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/button-inside-profile-page/)
 * 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/](https://wordpress.org/plugins/theme-my-login/)

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

 * ![](https://ps.w.org/theme-my-login/assets/icon-256x256.png?rev=1891232)
 * [Theme My Login](https://wordpress.org/plugins/theme-my-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/theme-my-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/theme-my-login/)
 * [Active Topics](https://wordpress.org/support/plugin/theme-my-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/theme-my-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/theme-my-login/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [mk](https://wordpress.org/support/users/mk-ned/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/button-inside-profile-page/)
 * Status: not a support question