Advertisement
Guest User

Add TinyMCE editor to the "Bio info" field in a user profile

a guest
Jan 28th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. // USER PROFILE STUFF
  2. // Add TinyMCE editor to the "Bio info" field in a user profile
  3. function pands_user_bio_visual_editor( $user ) {
  4. // Requires WP 3.3+ and author level capabilities
  5. if ( function_exists('wp_editor') && current_user_can('publish_posts') ):
  6. ?>
  7. <script type="text/javascript">
  8. (function($){
  9. // Remove the textarea before displaying visual editor
  10. $('#description').parents('tr').remove();
  11. })(jQuery);
  12. </script>
  13.  
  14. <table class="form-table">
  15. <tr>
  16. <th><label for="description"><?php _e('Biographical Info'); ?></label></th>
  17. <td>
  18. <?php
  19. $description = get_user_meta( $user->ID, 'description', true);
  20. wp_editor( $description, 'description' );
  21. ?>
  22. <p class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p>
  23. </td>
  24. </tr>
  25. </table>
  26. <?php
  27. endif;
  28. }
  29. add_action('show_user_profile', 'pands_user_bio_visual_editor');
  30. add_action('edit_user_profile', 'pands_user_bio_visual_editor');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement