Support

Home Forums Event Espresso Premium QR code not showing on ticket

QR code not showing on ticket

Posted: January 25, 2023 at 9:36 am


wmnf

January 25, 2023 at 9:36 am

We have the printable ticket addon and not seeing the QR code on our tickets. However, I activated on our staging server and see the QR code when using preview for the template. I inspected the browser code and it appears our live site is missing the canvas element of the QR code block in HTML. I enabled DEBUG for the site and do not see any errors. What can cause the canvas part of the HTML not get generated?


Tony

  • Support Staff

January 25, 2023 at 11:24 am

Hi there,

Can you link me to either a test event I can register onto to get a ticket link, or a ticket line for a test registration I can view, please?

You can mark your reply private so only EE staff can view it.


wmnf

January 25, 2023 at 2:13 pm

I registered as test for an event that has no cost, but it would still have aQR code? Here is the ticket link…

https://www.wmnf.org/?ee=ee-txn-tickets-approved-url&token=1-fc8b0c860eb5aeb3248e9dae024f7b7c


Tony

  • Support Staff

January 25, 2023 at 2:57 pm

Are you using a plugin to move assets to the footer?

If you look at the above link all of the JavaScript files are loading at the bottom of the page, that’s not expected and it is why it’s not working above.


wmnf

January 25, 2023 at 3:32 pm

No plugin, perhaps some custom code. However, the same I tested on our staging server and the QR code is working:

https://staging.wmnf.org/?ee=ee-txn-tickets-approved-url&token=1-41870f5b145255f5553f8d6158be2888


Tony

  • Support Staff

January 25, 2023 at 3:42 pm

Whats the difference between the 2 sites?

Something is stripping out the script tags from the ticket output on staging as well as comments


wmnf

January 25, 2023 at 4:11 pm

Yes I see what you mean. The only difference is Cloudflare and Wordfence security plugin on the live site with the issue. I’ll see if I can track down. Thanks


Tony

  • Support Staff

January 25, 2023 at 4:42 pm

One thing to note is staging is using 4.10.41 of EE4, live is .40

We’ve released a couple.of updates related to sanitation and we are now on .43 so I’d first try updating to the latest version on staging to see if I makes any difference.


wmnf

January 26, 2023 at 8:39 am

No difference. I’ve matched all plugin versions. Our custom code is Git version-controlled. Any other ideas how this could be tracked down? Some way I could see the rendering in DEBUG? I’m assuming all the scripts in the bottom of the HTML you are putting there, I don’t find on any other page of the site.


wmnf

January 26, 2023 at 8:42 am

I do see one other difference. The staging server is using PHP 8.1 where the live server with the issue is using PHP 8.0.


Tony

  • Support Staff

January 26, 2023 at 8:56 am

Is any code hooking into wp_kses? pre_kses?

Some way I could see the rendering in DEBUG?

I’m not sure what you would like to see here?

I’m assuming all the scripts in the bottom of the HTML you are putting there, I don’t find on any other page of the site.

The scripts are being added to the output by the ticketing add-on through a hook within core AHEE__EE_Html_messenger__enqueue_scripts_styles, thats all normal and expected.

It looks like something is hooking into either the above, or possibly wp_kses and filtering the contract to remove script tags.

You can check this in \event-espresso-core-reg\core\libraries\messages\messenger\EE_Html_messenger.class.php

Around like 477 should be:

echo '<!doctype html>' . wp_kses($this->_get_main_template(), AllowedTags::getWithFullTags());

Change that to:

echo '<!doctype html>' . $this->_get_main_template();

Does it work then?

Note this is NOT a solution but help narrow down where the issue may be coming from.


Tony

  • Support Staff

January 26, 2023 at 8:58 am

I do see one other difference. The staging server is using PHP 8.1 where the live server with the issue is using PHP 8.0.

We don’t officially support PHP8.1 at this time, however I’ve just tested the ticketing output on it and didn’t run into anything like this.


wmnf

January 26, 2023 at 9:18 am

Yes, that change does work if you want to check out the problem ticket page now. Can you help me understand what that does to track the problem and if it is okay to leave as such until resolved fully?


wmnf

January 26, 2023 at 9:20 am

But another thing. Try to scan the QR code. When I scan with my phone camera, it gives me a text note, is that expected?


Tony

  • Support Staff

January 26, 2023 at 9:41 am

It gives you a text note?

Are you scanning with just your camera app or the ticketing app?

Can you help me understand what that does to track the problem

If you have the same versions on both sites them something else is hooking into wp_kses on the site and changing what is allowed. Something it setting script tags to be disallowed on the live site.

Search your codename for the site for the above 2 wp_kses filters I mentioned.

if it is okay to leave as such until resolved fully?

It is. Its sanitation to make sure only allowed tags are used in the output. It’s ‘better’ with it but not using won’t break anything.


wmnf

January 26, 2023 at 9:45 am

Thank you for the info. Although there are plenty of references to wp_kses, all in plugins I have diligently verified are the same versions. The theme is custom with no updates other than customizations. There are zero references to the function in the theme. Is this what you intended me to search? …

bash-4.2$ grep -rl wp_kses wp-content/themes/
bash-4.2$ grep -rl AHEE__EE_Html_messenger__enqueue_scripts_styles wp-content/themes/bsd-theme/ wp-content/themes/
bash-4.2$

Could be a plugin doing something through site settings (database)?


Tony

  • Support Staff

January 26, 2023 at 9:52 am

No, these:

Is any code hooking into wp_kses? pre_kses?

With regards to this:

Could be a plugin doing something through site settings (database)?

Yes, a plugin could have an option enabled on live that’s disabled on staging, generally I don’t see plugins storing the value used for this filtering within the DB… but it’s possible.


wmnf

January 26, 2023 at 10:05 am

I also find no references to pre_kses in the themes directory. Is there a way I can hook into this EE4 function to permanently override, perhaps with my own sanitization if you think is prudent?


Tony

  • Support Staff

January 26, 2023 at 10:28 am

wp_kses is a way to stript out tags from content, it’s being used for sanitation here so I’m not sure I follow.

What I would do next is use the Health Check plugin to de-activate all other plugins other than Event Espresso an the ticketing add-on: https://wordpress.org/plugins/health-check/

I recommend creating a database backup here, just to be safe.

Install it, activate and go to Tools -> Site Health -> Troubleshooting

Activate Troubleshooting mode, which de-activates all plugins and switches your site to a default theme, but just for you the logged in admin.

In the admin bar go to Troublehsooting Mode -> Manage Active plugins.

Click ‘Enable while troubleshooting’ for Event Espresso and Event Espresso – Ticketing.

Now check the ticketing output, does it work then? (Note you’ll need to revert the earlier change to confirm if working with wp_kses in use)


wmnf

January 26, 2023 at 11:05 am

I’ll bring the whole site down to the staging or dev server to see if hopefully can be duplicated and do what you suggested. Thanks for the help!


Tony

  • Support Staff

January 26, 2023 at 11:18 am

If your doing it on staging or dev then you don’t need the health check plugin. Just deactivate the plugins and switch to a default theme.

You want to find a ‘working’ setup… then activate plugins one by one refreshing the ticket each time until it happens again… then you know the likely cause and we can go from there.

You must be logged in to reply to this support post. Sign In or Register for an Account

Event Espresso