SOLVED: {wp_user_id} in Code Widget crashes it

Browser: Chrome 110
OS: macOS / Windows / Linux / etc.
URL: Link to a page that illustrates this issue
Video: Short screen recording that illustrates this issue (free tool: jam.dev)

When I input the code everything is fine, it works on the page. However, I can’t edit it anymore. The code disappears in the editor, while still running on the page. I can only delete the widget, reload the site and put it in again. The issue seems to be the dynamic data tag {wp_user_id}, I don’t know if this happens with other dynamic data tags as well.

Confirmed. Tested exactly that use case with Bricks 1.10.1 and had the same results.
The code is still there but doesn’t get displayed in the textarea, nor can I edit that field anymore until I delete that Code element AND reload the builder.

Hi @Genosovic and @MattHias

this is interesting. I can not replicate this behavior. Can you paste your code here (or the minimum code that you have), so I can try with your?

Can you also test by adding quotes around the dynamic tag?

That’s the code I tested, and also without quotes around:
image

Thanks and best regards,
M

I tried the exact same code you show in your screenshot, but with

$user_id = {wp_user_id};

because an ID should not need quotes.

Tested again, with AT disabled (the only Bricks add-on on this site).
As soon I select dynamic data like “Post ID”, the field goes blank.
Browser console shows an error in this moment:

It seems to be caused by using dynamic tags without quotes.
$pid = {post_id}; => crashes
$pid = "{post_id}"; => works

Execution of the PHP code seems to take place (and cause fatal error) before the dynamic tags are replaced.

Hi @Genosovic & @MattHias,

Thank you for your report!

I could replicate it on Chrome & Safari but not on Firefox. I have added this to our bug tracker.

1 Like

Hi guys,

We’ve fixed this issue in Bricks 1.10.2, now available as a one-click update in your WordPress Dashboard.

Please let us know if you are still experiencing issues.

You can see the full changelog here: Bricks 1.10.2 Changelog – Bricks

Best regards,
M