-4

in WordPress changed this code:

$highlight=$author_data->wp_capabilities['administrator']==1 ? "wall-admin" : "wall-registered";

to this:

if(isset(wp_capabilities['administrator']))
    {$highlight=$author_data->wp_capabilities['administrator']==1 ? "wall-admin" : "wall-registered";}

But result is this:

Parse error: syntax error, unexpected '[', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /wp-content/themes/oblivion/chat/wp-wall.php on line 196

Can anyone help me with this?

  • 1
    I know it's not the answer you hoped for, but please check google before asking around. – ToBe Mar 18 '14 at 10:14
  • Look at [this](http://stackoverflow.com/questions/592322/php-expects-t-paamayim-nekudotayim) – skywalker Mar 18 '14 at 10:14
  • Also, please use proper code formatting. This will help us understand what you are doing (and maybe help yourself too) – ToBe Mar 18 '14 at 10:17
  • i checked it but google doesn't tells where i have punctuation error in code, plus my knowledge in php is very poor – User_number Mar 18 '14 at 10:17
  • 1
    you forgot to learn Hebrew!!! https://bugs.php.net/bug.php?id=14492 – bansi Mar 18 '14 at 10:19

1 Answers1

-3

This line is wrong:

if (isset(wp_capabilities['administrator']))

wp_capabilities is not considered a variable, but like class name or function.

Obviously it should be:

if (isset($author_data->wp_capabilities['administrator']))

u_mulder
  • 54,101
  • 5
  • 48
  • 64
  • Nep, this code not solving my problem, still getting error: Parse error: syntax error, unexpected '[', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /homez.194/renopoin/www/sub_unagi2014/wp-content/themes/oblivion/chat/wp-wall.php on line 196 – User_number Mar 19 '14 at 09:18