Executing PHP code

Hi, I am trying to use a code element to execute some PHP code. Execute is enabled and a code element shows the HTML from the default ok, so I know it works.

But when I add some PHP code I am getting an error …
Parse error : syntax error, unexpected ‘‘orderby’ => ‘display_name’’ (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) in /home/…/…/wp-content/themes/bricks/includes/elements/code.php(135) : eval()'d code on line 3

Here’s my code to get a list of users emails and display it ( At least that is what it is supposed to do )

<?php // WordPress get all user emails $args = array('orderby' => 'display_name'); $wp_user_query = new WP_User_Query($args); $authors = $wp_user_query->get_results(); if (!empty($authors)) { echo '
    '; foreach ($authors as $author) { $author_info = get_userdata($author->ID); echo '
  • ' . $author_info->user_email . '
  • '; } echo '
'; } else { echo 'No results'; } ?>

So is this a problem with the code? Or with Bricks?

Many thanks
Alan

Hi Alan,
i reported this already some days ago.

It will be fixed.

1 Like

Ah many thanks. I didn’t look in bugs as assumed it was my fault!
Cheers
Alan

Haha,
the error also occurs with:

<?php
  echo 'hello world';
?>

So it’s definitely a bricks problem :smiley:

1 Like