Advertisement
Guest User

Untitled

a guest
Jul 13th, 2020
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. add_action('user_register', 'my_on_user_register');
  2. function my_on_user_register($user_id){
  3.  
  4. $args = array(
  5. 'length' => 6,
  6. 'before' => date("Y")
  7. );
  8. $random_number = my_random_string($args);
  9. update_user_meta($user_id, 'random_number', $random_number);
  10.  
  11. }
  12.  
  13. add_action('show_user_profile', 'my_extra_user_profile_fields');
  14. add_action('edit_user_profile', 'my_extra_user_profile_fields');
  15. function my_extra_user_profile_fields($user){
  16.  
  17. $random_number = get_the_author_meta('random_number', $user->ID);
  18. ?>
  19. <h3><?php _e('Custom Properties'); ?></h3>
  20.  
  21. <table class="form-table">
  22. <tr>
  23. <th><label for="address"><?php _e('Random Number'); ?></label></th>
  24. <td><?php echo $random_number; ?></td>
  25. </tr>
  26. </table>
  27. <?php
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement