1

I really don't understand how the "User: Data" field works. Couldn't find any documentation of this.

I want to set the Display format to "A certain key" to output the identifier value from this serialized data (relevant snippet):

a:1:{s:10:"hybridauth";a:26:{s:10:"identifier";s:17:"76561198181833179";

When I enter identifier as key, I only get this notice and no output.

Notice: Undefined index: identifier in views_handler_field_serialized->render() (line 60 of www/htdocs/****/sites/all/modules/views/handlers/views_handler_field_serialized.inc).

What do I have to enter in the "Which key should be displayed" field exactly, to display the identifier value?

1
  • "When I enter identifier as key" - show us your code, we can't tell you what's wrong with it if we can't see it.
    – Mołot
    Commented Jul 1, 2015 at 8:27

2 Answers 2

0

You need to add an Global PHP field and put the following code in output value to get the identifier field value.

<?php 
 $result = unserialize($row->data); 
 print $result['identifier'];
?>

Note : You should exclude Data field from display.

Since you very cautious in not using PHP, did you try the following option, change the ckeditor_skin to identifier. But it will produce the output as 76561198181833179['identifier'].

enter image description here

2
  • 1
    I wanted to avoid PHP in views. I've heard it's bad for performance and is insecure. But when nobody can help me with the "User: Data"-field, I'll fall back to this option. Thanks.
    – Oddy
    Commented Jul 1, 2015 at 8:10
  • I already tried this. It outputs nothing and gives me this notice as stated above: Notice: Undefined index: identifier in views_handler_field_serialized->render() (line 60 of /www/htdocs/*drupalsite*/sites/all/modules/views/handlers/views_handler_field_serialized.inc).
    – Oddy
    Commented Jul 1, 2015 at 8:36
-1

Try %ckeditor_skin in the field 'Which key should be displayed'.

If the error message

Notice: Undefined index: identifier in views_handler_field_serialized-render() (line 60 of /www/htdocs/drupalsite/sites/all/modules/views/handlers/views_handler_field_se‌​rialized.inc).

still exists but the number of the error messages is less than before, try to change the code

return check_plain($value[$this->options['key']])

to:

if (!empty($value[$this->options['key']])) { 
  return check_plain($value[$this->options['key']]);
}

in line 60 of the module file to avoid the error message.

1
  • You shouldn't hack core or contributed modules!
    – Elin Y.
    Commented Feb 21, 2016 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.