the render link breaks if option link_to_user is set to FALSE.
Because in that case the uid additional_field is not included in views_handler_field_user.
So I suggest a slight reshuffling of this function from

  function render_link($data, $values) {
    $uid = $this->get_value($values, 'uid');
    if (!empty($this->options['link_to_user']) && user_access('access user profiles') && $uid) {
      $this->options['alter']['make_link'] = TRUE;
      $this->options['alter']['path'] = 'user/' . $uid;
    }
    if (empty($data)) {
      $lang = language_default();
    }
    else {
      $lang = language_list();
      $lang = $lang[$data];
    }

    return $this->sanitize_value($lang->name);
  }

to

function render_link($data, $values) {
    if (!empty($this->options['link_to_user'])) {
      $uid = $this->get_value($values, 'uid');
      if (user_access('access user profiles') && $uid) {
        $this->options['alter']['make_link'] = TRUE;
        $this->options['alter']['path'] = 'user/' . $uid;
      }
    }
    if (empty($data)) {
      $lang = language_default();
    }
    else {
      $lang = language_list();
      $lang = $lang[$data];
    }

    return $this->sanitize_value($lang->name);
  }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

It would be kind of cool if you could provide a real pach, see http://drupal.org/patch/submit how to do it, if you don't know it already.

With a pach it's much easier to apply/review the changes.

matslats’s picture

Status: Postponed (maintainer needs more info) » Active

Sorry my engagement doesn't stretch that far!

dawehner’s picture

Status: Active » Needs work

Common, you know how to write patches...

matslats’s picture

ok here's my first drupal patch
I don't see why my making a patch is so much more helpful...
If it was my module I would want to review the code line by line anyhow.
I guess it means the code is more likely to be tested.
I haven't tested this coz I've completely lost the context where I found the bug.

dawehner’s picture

Status: Needs work » Reviewed & tested by the community

The change looks perfect, thanks! Let's see what the testbot thinks about that, but i doubt that there is a test in this region.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Needs review

I don't understand the problem from the OP enough to grasp what this patch solves.
Can we have a better description? Sorry.

tim.plunkett’s picture

Version: 7.x-3.3 » 7.x-3.x-dev
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Here is my short description.

If "link to user" is checked the field_user handler adds "uid" to the fields, so it can be used for linking a field to it's user.
The field_language handler though require to have uid set because

$uid = $this->get_value($values, 'uid');

is called everytime, also if "link to user" is not checked.

The patch simply moves this into the if.

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Marking this as RTBC wasn't meant to be a april fool hoax, sorry.

Committed this to 7.x-3.x and 8.x-3.x, maybe this needs to be backported to 6.x-3.x

peterpoe’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Issue summary: View changes
Status: Patch (to be ported) » Needs review
FileSize
602 bytes

The patch didn't move the call to get_value, it just duplicated it. This causes errors when some module executes full bootstrap in a custom language provider (don't ask me why). It's crazy that nobody noticed in 4 years!

Anyway, patch attached.

Chris Matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 3 year old patch in #10 to views_handler_field_user_language.inc does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.

Checking patch modules/user/views_handler_field_user_language.inc...
error: while searching for:
class views_handler_field_user_language extends views_handler_field_user {

  function render_link($data, $values) {
    $uid = $this->get_value($values, 'uid');
    if (!empty($this->options['link_to_user'])) {
      $uid = $this->get_value($values, 'uid');
      if (user_access('access user profiles') && $uid) {

error: patch failed: modules/user/views_handler_field_user_language.inc:13
error: modules/user/views_handler_field_user_language.inc: patch does not apply
dev16.addweb’s picture

Status: Needs work » Needs review
FileSize
633 bytes

@Chris2, Please review my updated patch that will work for you in the latest views 7.x-3.x-dev. Let me know if you are facing any challenges.

Thanks!,.

DamienMcKenna’s picture

Issue tags: -Needs reroll