• Resolved cyberlp23

    (@cyberlp23)


    Hello,

    I’m trying to customize the appearance of the user admin profile page.

    1) I don’t want to go & modify the core code, so I’d preferably use a plugin (or is there a way to do it without plugin and without modifying the core files?)

    2) I’ve tried plugins such as Profile Builder, but the problem is that they allow to create brand new pages for user profiles. I just want to use the default admin profile (keeping the header and left sidebar of the user admin), but with a few modifications (for instance, getting rid of the choice of interface colours).

    Thank you!

    Mat

Viewing 15 replies - 1 through 15 (of 24 total)
  • lorro

    (@lorro)

    Hooks allow you to add additional elements to pages without altering core files:
    http://codex.wordpress.org/Plugin_API/Action_Reference

    Without knowing what you want to do I can’t say if there is a suitable hook. PHP skills will be required.

    Hiding sections can be achieved with some custom css. To hide the colour choice block, try:

    tr.user-admin-color-wrap {display:none}

    For admin-side css, most custom css options and plugins may not work, but you can use a plugin like this one:
    https://wordpress.org/plugins/add-admin-css/

    Thread Starter cyberlp23

    (@cyberlp23)

    What I want is only hiding sections of the admin user profile, all thr first ones before the name (colour choice, keyboard shortcuts…)

    I’m using a child theme style.css, which does work, although when I add your line:
    tr.user-admin-color-wrap {display:none}

    it doesn’t do anything though.

    So I’ve tried the plugin you mentioned, addind the CSS line, and it does work. Where can I find the lines matching the other elements I want to hide?

    And one issue though, how would it be possible not to hide those lines for specific users?

    Thanks!

    lorro

    (@lorro)

    .user-rich-editing-wrap,
    .user-admin-color-wrap,
    .user-comment-shortcuts-wrap,
    .user-admin-bar-front-wrap
    {display:none}

    Sorry I’m unable to hide the heading “Personal Options”.

    For specific users you’d be back to hooks and some heavy php code. Perhaps easier for those users to temporarily deactivate the plugin.

    Thread Starter cyberlp23

    (@cyberlp23)

    Thanks!
    Any idea why the option of using the style.css from the child theme doesn’t work?

    lorro

    (@lorro)

    Have a look at the source code for your admin page. Is the style sheet present? If it is present, its styles may be overridden by style sheets that are loaded later in the page. On my system there is a separate style sheet for the admin side.

    Thread Starter cyberlp23

    (@cyberlp23)

    No, you’re right, it doesn’t seem to be present…

    BUT, what gets weirder is that I’ve cleared out the Add Admin plugin, and instead put all the code you gave me in the child theme style.css.
    And it does work now, but only if the Add Admin plugin is activated (even if with no CSS information at all). If I deactivate it, it doesn’t work.

    lorro

    (@lorro)

    Sure its not cached somewhere?

    Thread Starter cyberlp23

    (@cyberlp23)

    I don’t think so. I’ve cleared out the browser cache, and also tried on a different browser, and it does the same thing.
    Well, it does work, anyway πŸ™‚ But it’s weird.

    lorro

    (@lorro)

    In Chrome, bring up the page and right click on the “Personal Options” heading, then “inspect element”, then come down to one of the classes which is now hidden, in the styles box it will tell you where the display:none style is coming from. Browser tools can be a steep learn but worthwhile if you like to change stuff.

    Thread Starter cyberlp23

    (@cyberlp23)

    Well it says it comes from “profile.php”, it doesn’t say it’s inherited from an external stylesheet. Or maybe I missed something?

    I can see two links on my admin page. The first “profile.php” is the current script as per the url, the second is load_style.php with parameters, which looks like its pulling in several stylesheets and minifying them. I’m not able to find out how load_styles.php gets its stylesheets or whether its caching them in some way.

    Perhaps the old AddAdmin styles are still in its settings record in the database. To test, deactivate and delete the plugin. This should delete its settings. Then reinstall it but without any css. Do the styles still take effect?

    Thread Starter cyberlp23

    (@cyberlp23)

    I just did that, and that verified that my added code in functions.php is now working:

    function my_admin_css( $css ) {
    	$css .= "
    .user-rich-editing-wrap,
    .user-admin-color-wrap,
    .user-comment-shortcuts-wrap,
    .user-admin-bar-front-wrap
    {display:none}
    	";
    	return $css;
    }
    add_filter( 'c2c_add_admin_css', 'my_admin_css' );

    I guess I don’t need the plugin anymore… Thanks for your help!

    Thread Starter cyberlp23

    (@cyberlp23)

    I’ve spoken too fast.
    Now that the plugin is deleted, it doesn’t work anymore.

    Looks like that filter is provided by Add Admin: its not a core WordPress filter:
    https://codex.wordpress.org/Plugin_API/Filter_Reference

    Thread Starter cyberlp23

    (@cyberlp23)

    Oh, ok. What should I do then to have a filter that is not Add Admin dependant?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Custom admin profile’ is closed to new replies.