Make WordPress Core

Opened 15 years ago

Last modified 2 years ago

#12295 accepted enhancement

More support to customize user profile edit page

Reported by: pampfelimetten's profile pampfelimetten Owned by: nacin's profile nacin
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.0
Component: Users Keywords: has-patch needs-testing dev-feedback
Focuses: Cc:

Description

Right now I can edit the contact methods via the user_contactmethods filter, but I can not modify or remove the Personal Options or the Name Options.
I want to keep the interface as simple as possible for my users, and I don't think that they need to edit this settings at all.
If wp wants to be a cms, it should give me control over this aspect as well.
At least, give me custom css-ids, so I can remove it via css!

Attachments (17)

user-edit.php.diff (6.3 KB) - added by pampfelimetten 15 years ago.
12295.002.diff (2.7 KB) - added by pampfelimetten 15 years ago.
12295.002.2.diff (2.7 KB) - added by pampfelimetten 15 years ago.
12295.003.diff (11.4 KB) - added by pampfelimetten 15 years ago.
First Cut, missing only the about yourself section
12295.004.diff (12.1 KB) - added by pampfelimetten 15 years ago.
Updated to latest trunk
12295.005.diff (13.4 KB) - added by pampfelimetten 14 years ago.
Updated to latest trunk
12295.006.diff (10.9 KB) - added by pampfelimetten 14 years ago.
Update to latest trunk
12295.diff (13.1 KB) - added by JohnONolan 13 years ago.
Updated patch to latest trunk + more IDs
12295.2.diff (12.3 KB) - added by Japh 12 years ago.
Refreshed
12295.3.diff (12.5 KB) - added by DrewAPicture 12 years ago.
12295.4.diff (13.0 KB) - added by JustinSainton 12 years ago.
12295.5.diff (13.6 KB) - added by ericlewis 12 years ago.
12295.6.diff (13.6 KB) - added by ericlewis 12 years ago.
12295.7.diff (13.6 KB) - added by ericlewis 12 years ago.
In .6, I forgot to change a checked to $echo = false. .7 fixes this
12295.8.diff (30.6 KB) - added by flabadab 11 years ago.
Using metaboxes would allow for complete customization
0001-Users-Add-filter-to-hide-fields-from-user-page.diff (8.5 KB) - added by jvcdk 5 years ago.
Patch in "simple" format
0001-Users-Add-filter-to-hide-fields-from-user-page.patch (9.4 KB) - added by jvcdk 5 years ago.
Patch in git format

Download all attachments as: .zip

Change History (74)

#1 @pampfelimetten
15 years ago

  • Keywords has-patch needs-testing added; wp-admin user profile cms edit removed
  • Owner set to nacin
  • Status changed from new to reviewing

After wds-brad2 suggested to write a css based patch, here it is.
I'm no expert with the backend-styles, so please give me a hint, if I have used a wrong naming scheme.

Code works fine for me, with the following test-css you can hide and unhide every single option:

#form-table-personal-options-title,
#form-table-personal-options-admin-color-scheme,
#form-table-personal-options-visual-editor,
#form-table-personal-options-keyboard-shortcuts,
#form-table-name-title,
#form-table-name-user-login,
#form-table-name-first-name,
#form-table-name-last-name,
#form-table-name-nickname,
#form-table-name-display-name,
#form-table-contact-info-title,
#form-table-contact-info-email,
#form-table-contact-info-url,
#form-table-about-yourself-title,
#form-table-about-yourself-description
{
	display:none !important;
}

With the following test-css you can hide each section:

#form-table-personal-options,
#form-table-name,
#form-table-contact-info,
#form-table-about-yourself,
#form-table-caps
{
	display:none !important;
}

The password table row already got an ID, so I didn't touch it.

Feedback very welcome!

#2 @nacin
15 years ago

  • Keywords needs-patch added; has-patch needs-testing removed

CSS isn't really the way to go here. I think we should abstract it out with filters and default actions, similar to contact methods and the idea in #6837.

#3 @nacin
15 years ago

  • Owner nacin deleted

#4 @pampfelimetten
15 years ago

Thanks for the Info, thats what I thought at the beginning as well, but I think this is beyond my skills. Anybody else wants to look into this?

#5 @nacin
15 years ago

  • Milestone changed from 3.0 to Future Release

@pampfelimetten
15 years ago

First Cut, missing only the about yourself section

#6 @pampfelimetten
15 years ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Milestone changed from Future Release to 3.1
  • Owner set to nacin
  • Version set to 3.0

please ignore the 12295.002* diff files.
In the 12295.003.diff I abstracted it with filters and functions, you can now enable and disable every field (expect for the last "about-yourself" section, i ran out of time for that).
One open question though: I skipped the class "code" for url field (why is it there anyway?)

And: How to add the disabled function for username? Should I make every function like the "personal options" section, with multidimensional arrays?

Please give me feedback!

@pampfelimetten
15 years ago

Updated to latest trunk

@pampfelimetten
14 years ago

Updated to latest trunk

#7 @nacin
14 years ago

  • Milestone changed from Awaiting Triage to Future Release

@pampfelimetten
14 years ago

Update to latest trunk

@JohnONolan
13 years ago

Updated patch to latest trunk + more IDs

#8 @JohnONolan
13 years ago

  • Keywords dev-feedback added
  • Severity changed from major to normal

I think this is pretty comprehensive now - only sense-check question I had was, is changing #password to #profile-about-password a problem? I don't think any JS hooks into it, can't find any core CSS targeting it.

#9 @JohnONolan
13 years ago

One more thing that should be accounted for:

Sometimes plugins add fields to user profiles (eg. After The Deadline and WordPress SEO) - these should be wrapped with divs with unique IDs based on the plugin name so that they can be styled differently or hidden depending on requirements. At present they cannot be targeted in any way at all other than some very unstable :nth-child hackery, which is a small but not insignificant problem.

#10 @pampfelimetten
13 years ago

Hi John, thanks for updating the patch, I just tested against the latest trunk and it works fine. It would be great if we could get it in 3.4 early!

#11 @dragunoff
13 years ago

  • Cc dragunoff@… added

#12 @Viruthagiri
13 years ago

  • Cc Viruthagiri added
  • Version changed from 3.0 to 3.3

Sorry. I'm new to core trac. Can i use this patch? Or should i wait until 3.4 release?

#13 @JohnONolan
13 years ago

  • Version changed from 3.3 to 3.0

#14 @JohnONolan
12 years ago

  • Keywords early added

Feedback? 3.5 Early?

#15 @JohnONolan
12 years ago

  • Keywords 3.5-early added; early removed

#17 @JohnONolan
12 years ago

  • Keywords OHMYGODPICKME added

Will literally have sex with the first core dev willing to take a look at my now-10-month-old-super-simple-yet-amazing-patch.

#18 @alex-ye
12 years ago

  • Cc nashwan.doaqan@… added

#19 @helenyhou
12 years ago

  • Keywords needs-refresh added

@Japh
12 years ago

Refreshed

#20 @Japh
12 years ago

  • Keywords needs-refresh removed

Refreshed @JohnONolan's last patch.

#21 @Japh
12 years ago

  • Cc japh@… added

#22 @DrewAPicture
12 years ago

  • Cc xoodrew@… added

12295.3.diff takes @japh's refresh and:

  • Adds requisite spacing to introduced code
  • Removes some unnecessary semicolons following closing braces
  • Adds phpdoc additions such as the version in @since's and an @param for $user_can_edit on _wp_get_user_personal_options().

#23 @kpdesign
12 years ago

  • Cc kparsell-wp@… added

#24 @JustinSainton
12 years ago

  • Basic pass at data sanity
  • Restores proper toolbar/admin bar language
  • Some additional coding standards formatting

#25 @ocean90
12 years ago

  • Keywords OHMYGODPICKME removed

#26 @SergeyBiryukov
12 years ago

#22973 was marked as a duplicate.

#27 @toscho
12 years ago

  • Cc info@… added

#28 @nacin
12 years ago

  • Milestone changed from Future Release to 3.6
  • Status changed from reviewing to accepted

#29 @helen
12 years ago

#7730 was marked as a duplicate.

#30 @SergeyBiryukov
12 years ago

#16181 was marked as a duplicate.

#31 @alex-ye
12 years ago

  • Cc nashwan.doaqan@… removed

@ericlewis
12 years ago

#32 @ericlewis
12 years ago

in 12295.5.diff:

  • Move $user_can_edit into _wp_get_user_personal_options to avoid spaghetti code; also removes necessity of a parameter for _wp_get_user_personal_options()
  • In _wp_get_user_personal_options(), move global definitions to beginning of function
  • In _wp_get_user_personal_options(), using an element with the key of 'action' will trigger that action in the field table cell. The explicit call to do_action for 'admin_color_scheme_picker' was being used, this still allows for this while opening up for extendability
  • Fix escaping 'scope' attribute of table headers, add scope element for comment_shortcuts (to avoid PHP notice)
  • Remove user_label_add_required() and associated filter - this wasn't in the scope of this ticket.
  • Modify _wp_get_user_namefields() to return a multidimensional array; restores disabled attr to username field
Last edited 12 years ago by ericlewis (previous) (diff)

@ericlewis
12 years ago

#33 @ericlewis
12 years ago

In 12295.6.diff:

  • The original patch changes the Show Toolbar setting output that's in trunk currently, reverts to this.
  • In _wp_get_user_namefields(), add a 'description' key to the namefield array elements, which outputs in a span after the input.
Last edited 12 years ago by ericlewis (previous) (diff)

#34 follow-up: @toscho
12 years ago

At a first glance I didn't see it: How do we remove the textarea for Biographical Info only now?

#35 in reply to: ↑ 34 @ericlewis
12 years ago

Replying to toscho:

At a first glance I didn't see it: How do we remove the textarea for Biographical Info only now?

The entire About section has a wrapper div#profile-about, which can be hidden with CSS. The table row for the Biographical info has the unique ID profile-about-description, also can be hidden with CSS.

Ideally, we'd give the same filter-ability treatment for this section. I'd guess because of the uniqueness of the textarea output it wasn't given its own _wp_get_user_aboutfields() in an earlier diff. Should we do that?

Last edited 12 years ago by ericlewis (previous) (diff)

#36 follow-up: @toscho
12 years ago

It is a common request and the current code doesn’t offer an elegant hook. So I think this is the best opportunity to introduce a specific hook.

#37 in reply to: ↑ 36 @ericlewis
12 years ago

Replying to toscho:

It is a common request and the current code doesn’t offer an elegant hook. So I think this is the best opportunity to introduce a specific hook.

The request you linked to is a user asking how to hide it - which can be done with the CSS selectors I mentioned. Whether we should add filterability to the About section to give the ability to add more fields there is what I was asking.

@ericlewis
12 years ago

In .6, I forgot to change a checked to $echo = false. .7 fixes this

#38 @ryan
11 years ago

  • Milestone changed from 3.6 to Future Release

#40 @dcowgill
11 years ago

  • Cc dcowgill@… added

#41 @ramiy
11 years ago

Related: #24952

#42 @SergeyBiryukov
11 years ago

#25383 was marked as a duplicate.

@flabadab
11 years ago

Using metaboxes would allow for complete customization

#43 @flabadab
11 years ago

  • Cc julian@… added

#44 follow-up: @tw2113
11 years ago

  • Cc michael.d.beckwith@… added

#45 in reply to: ↑ 44 @ericlewis
11 years ago

Replying to flabadab:

Using metaboxes would allow for complete customization

I'm thinking the same thing.

A User is not a post type, but it is a data object in WordPress. We already apply a post-like editing interface for comments, which are also a data object that's not technically a post. I don't see a reason why we couldn't apply the interface to Users. More unified UI.

#46 @goto10
11 years ago

  • Cc dromsey@… added

#47 @rachelbaker
11 years ago

  • Cc rachel@… added

#48 @Stagger Lee
10 years ago

I would like to se metaboxes as in Posts/Pages. With 2 columns.
Just those few lines of code in CSS make huge difference in profile screen:

.profile-php #your-profile .form-table {
  background: #fff;
  border-collapse:inherit;
  padding: 20px;
}
  .profile-php #your-profile h3 {
  background: none repeat scroll 0 0 #f1ebd3;
  color: #000;
  padding: 10px 15px;
}

#49 @desrosj
5 years ago

  • Keywords early added; 3.5-early removed

#50 @desrosj
5 years ago

  • Milestone set to Awaiting Review

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


5 years ago

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


5 years ago

#53 @jvcdk
5 years ago

I have a similar need / wish and have created a patch against version 5.3.2. Please find it attached.

The approach I have taken is to add a filter (user_profile_active_fields) that a dev can hook in to and customize which fields are shown.

I have uploaded 2 files:

  • A patch in git format-patch format (with commit message).
  • A "simple" standard diff (since you are using svn)

I am unsure which format serves you best. The files are named 0001-Users-Add-filter-to-hide-fields-from-user-page.diff and .patch.

I believe it is ready for merge, but of course needs a review and test (by other people than just me :-D ). One note:

In the API documentation, I left the @since fields as TBD as I do not know with which version this will be accepted.

@jvcdk
5 years ago

Patch in "simple" format

This ticket was mentioned in Slack in #core by sergey. View the logs.


5 years ago

This ticket was mentioned in Slack in #core-privacy by carike. View the logs.


4 years ago

#56 @johnbillion
3 years ago

  • Keywords early removed

#57 @SergeyBiryukov
2 years ago

#56053 was marked as a duplicate.

Note: See TracTickets for help on using tickets.