#38591 closed enhancement (duplicate)
Filter for languages select on profile-page
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7 |
Component: | Users | Keywords: | |
Focuses: | administration | Cc: |
Description
It would be great to have a filter on the user's profile page to edit the languages select.
This would come in handy - for example to allow only a selection of languages for different blogs in multi-site environments or to suppress the language select at all.
Patch is attached.
Attachments (2)
Change History (7)
#2
@
8 years ago
- Focuses ui removed
Hey there,
Thanks for your patch!
It might make more sense to add such a filter to wp_dropdown_languages()
in case it's used in other places too.
Also, have a look at the inline documentation standards for hooks: https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/
#3
@
8 years ago
Hmm, I think with the current implementation of wp_dropdown_languages()
, finding out if the select holds any options is only possible by an ugly string comparison.
Therefore a filter in wp_dropdown_languages
would not help in case $languages
is cleared by said filter to avoid extra markup in user-edit.php. Changing the implementation of wp_dropdown_languages()
to something that can be captured with empty()
would help, though.
I'm not sure what's the policy on selects, are they supposed to return an empty select <select></select>
w/o any option at all or would an empty string be alright? If so, what's recommended - empty string, null or false?
#4
@
8 years ago
- Resolution set to duplicate
- Status changed from new to closed
filter has been added in #38788
my implementation on the profile/user-edit page:
add_filter('get_available_languages', array($this, 'get_available_languages')); /* remove languages select from profile page */ function get_available_languages($languages) { if (in_array( $GLOBALS['pagenow'], array( 'user-edit.php', 'profile.php' ) )) return array(); return $languages; }
second version includes all spaces ;)