While I logged in as authenticated user and manage my account, I found that there is the language setting block appear in user-edit page.
I've tried to hide the language setting block , but failed.
Any idea to solve this problem?

Thanks.

Comments

hass’s picture

Category: task » support
Status: Active » Fixed

no

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

geraldito’s picture

Looking with Devel Themer Info I see that form is called "locale" so for hiding it you could make a module with code like this:

function lang_hide_form_alter(&$form, $form_state, $form_id) {
  // hide language selection settings for non-admin users
  if ($form_id == 'user_profile_form' && !user_access('administer users')) {
    unset($form['locale']);
  }
}

You also need an info file like this:

; $Id: lang_hide.info,v 1.0 2009/09/27 11:26:54 geraldo Exp $
name = Hide Language Form
description = "Hides the language form on user pages"
dependencies[] = i18n
package = User interface
; Information added by drupal.org packaging script on 2009-09-27
version = "6.x-1.0"
core = "6.x"
project = "lang_hide"
datestamp = "1228700966"
arski’s picture

Category: support » feature
Status: Closed (fixed) » Active

lol, answering "no" and setting the status to "fixed" - what a joke maintainer.

altering form appears to be indeed the only way to go at the moment.. although the module should really offer a setting or a permission to control this.

chinita7’s picture

Status: Closed (won't fix) » Active
chinita7’s picture

I tried "Disable user language" module and worked.It can disable the language setting on the user pages and also can give permissions per role to allow setting the language.

I also tried to code from #3 modified a bit for my need and worked. #3 was better solution for me because it just hide the setting option on user's account page but the user still can have the default language. I'm also using Registration language to set the user's default language on registration automatically and "Registration language"didn't work with"Disable user language".
The issue is here
Thanks @geraldito

jose reyero’s picture

Component: Code » Blocks
Status: Active » Closed (won't fix)

We are not adding more features to the 6.x version. And anyway I don't think this is an interesting one to add to the module.

Status: Active » Closed (won't fix)
AlexRos’s picture

I just posted here a solution I came to during my research.
Hope it will help somebody else.

You can desactivate the Language settings block by using the module Rules Forms Support.
With this module, you can target any element of a form (core or contributed) and hide it via a rule.
The rule I set up basically stated : When the User profile form is being built, the system hides the fieldset:locale.
The documentation will help you to set up the rule correctly.

marcel.jtf’s picture

Issue summary: View changes

Thanks AlexRos your #9 did the trick. I was looking for this solution. I've followed the following steps

  1. Install both "rules" and "rules_forms" modules
  2. Go to "/admin/config/workflow/rules/forms" and select "Enable event activation messages on forms"
  3. Go to the user editting page and you should see "Activate events for ....". Click on that
  4. Create a new rule
  5. Under "React on event" select "User profile form is being built"
  6. If needed add a condition (e.g. for to apply for specific roles)
  7. Add an acction "Hide an element in the form"
  8. Data selector = "form"
  9. Form element = "Language settings"
  10. Hide = "True"
  11. Save it
  12. Under "/admin/config/workflow/rules/forms" you can deselect "Enable event activation messages on forms"
xoruna’s picture

Another solution is to hide the field in custom template.php. I did this on a Drupal 7 site, using the code provided here: https://drupal.stackexchange.com/questions/76044/how-to-hide-certain-fie...
(replace the name of the function with your custom theme name et change de field to "locale", the machine name of the field)