WordPress.org

Ready to get started?Download WordPress

Forums

Theme My Login
[resolved] Hide profile fields from theme my login? (19 posts)

  1. ellebillias
    Member
    Posted 2 years ago #

    So this plugin is awesome, but I want to be able to specify which fields a user can actually update in their profile, depending on which role they are registered as.

    How can I do this?

    Thanks

    http://wordpress.org/extend/plugins/theme-my-login/

  2. tzeldin88
    Member
    Posted 2 years ago #

    This may not be the ideal approach, but I was able to hide fields (and their associated labels and the parent p/div/tr element) using a little jQuery, if you're familiar with that. Just target the input to hide, climb up to its parent element, and hide it.

    <?php
    // this code goes in header.php, in the <head> section.
    if(is_page('edit-profile') ) { ?>
    	<script type="text/javascript">
    		jQuery(document).ready(function() {
    			// hide fields (the entire <tr>)
    			jQuery('#id-of-field').parent().parent().parent().hide();
    		});
    	</script>
    <?php }

    This assumes that the <input> element is nested 3 levels down from the element i actually need to hide.. a <tr> in my case. And i use a wp conditional to run this code only on the 'edit-profile' page.

  3. Jeff Farthing
    Member
    Plugin Author

    Posted 2 years ago #

    First you'll want to copy the profile form (theme-my-login/templates/profile-form.php) to your current theme directory. Then, editing that file, you'll want to put the user role into a variable:

    $user_role = reset( $profileuser->roles );

    Once you have that, it's just simple conditional statements:

    <?php if ( 'subscriber' == $user_role ) : ?>
    	HTML here
    <?php endif; ?>
  4. ellebillias
    Member
    Posted 2 years ago #

    thanks, i will give that a go.

    also is it possible to exclude the admin role from having a themed profile?

  5. Jeff Farthing
    Member
    Plugin Author

    Posted 2 years ago #

    In the development version, it is possible.

  6. ellebillias
    Member
    Posted 2 years ago #

    Cool stuff, any idea of an ETA?

  7. ellebillias
    Member
    Posted 2 years ago #

    Hi Jeff,

    I downloaded the development version and have installed it on my test site. One suggestion I have so far is for the widget - can the "Dashboard" link be removed because effectively this is the same as the "Profile" link.

    I'll let u know if I find any other bugs - what are the other changes?

  8. Jeff Farthing
    Member
    Plugin Author

    Posted 2 years ago #

    Just activate the Custom User Links module and you can remove the "Dashboard" link.

  9. ellebillias
    Member
    Posted 2 years ago #

    Sweet!

    One more question...how can I alter the title of the profile page "Your Profile" and also the widget title "Welcome, username" or "Log In" depending on the state?

    There doesn't seem to be a line in the template?

  10. Jeff Farthing
    Member
    Plugin Author

    Posted 2 years ago #

    This issue has been discussed numerous times here and on my forum. Please search on either one.

  11. ellebillias
    Member
    Posted 2 years ago #

    Well I did actually search over there and couldn't find anything so if you could direct me to the solutions please?

  12. Jeff Farthing
    Member
    Plugin Author

    Posted 2 years ago #

    It seems that the old posts may have been pruned...

    Try this one: http://wordpress.org/support/topic/plugin-theme-my-login-change-page-title-for-profile-page

  13. sassyfrass475
    Member
    Posted 2 years ago #

    I found an easier way to change the sidebar widget's "Welcome" to whatever you want.

    DIRECTIONS

    1.) In your WordPress install go to the folder: wordpress/wp-content/plugins/theme-my-login/includes/
    2.) Open the file: class-theme-my-login-template.php
    3.) Locate the word "Welcome" and replace it with whatever greeting you'd like. For example, replace "Welcome" with "Hello".
    4.) Save the edited class-theme-my-login-template.php document to wordpress/wp-content/plugins/theme-my-login/includes/
    6.) Refresh the page. Now, instead of "Welcome" it should have "Hello" or whatever you put as your personal greeting.

  14. Jeff Farthing
    Member
    Plugin Author

    Posted 2 years ago #

    @sassyfrass475 - I would never recommend modifying core files. What happens when you update the plugin? You lose the changes. This is why I've provided numerous hooks throughout the plugin, in order to customize it properly.

  15. thatwastaxing
    Member
    Posted 2 years ago #

    Hi Jeff,

    Thanks for the plugin. I found a way to hide profile fields using functions here: http://brassblogs.com/tidbits/hiding-information-from-the-wordpress-admin

    Can this be adapted to use with TML?

  16. Jeff Farthing
    Member
    Plugin Author

    Posted 2 years ago #

    Of course it can. But why use javascript to remove the fields when TML let's you do it with a template? What happens if someone turns off javascript? Oops, now they see the hidden fields. I hope you're not hiding anything sensitive like that.

  17. thatwastaxing
    Member
    Posted 2 years ago #

    I thought this somehow was a better way. I just reailzed that I have to COPY over the profile-form.php to my template directory. I thought I was editing the plugin file and wanted to stay away from doing that.

    Thanks!

  18. somendrakm
    Member
    Posted 1 year ago #

    here the best plugin to hide profile fields you can check it from here
    Hide WordPress Profile Field

  19. Jeff Farthing
    Member
    Plugin Author

    Posted 1 year ago #

    Advertising a paid plugin - I sure hope the moderators remove that post.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic