michael-milette / moodle-filter_filtercodes

FilterCodes filter for Moodle enables content creators to easily customize and personalize course and site content using plain text tags (no HTML). For premium support, contact us at https://www.tngconsulting.ca/contact
https://moodle.org/plugins/filter_filtercodes
GNU General Public License v3.0
30 stars 42 forks source link

Bug: Compatibility with Moodle 4.2 #271

Closed juanfortuna closed 9 months ago

juanfortuna commented 9 months ago

Prerequisites

What happened?

Hi, I'm installing Moodle 4.2.2 with a MySQL 8.0.34 database, all on Linux. I downloaded the FilterCodes plugin, installed it without any problem, and when I activate it, I no longer have access to Moodle, on any screen. The browser is left with a blank page. If I delete the directory in /filter I have Moodle working again. Maybe it is a known error or you can help me know how to solve it. Thank you.

What do you think should have happened?

This is not the first time I have used it, and I understand that after activating it I can easily access the display of the information on the Moodle variables.

Steps to reproduce

Inglés

I carried out several tests, until I tried the most basic of all, I installed Moodle 4.2.2 completely clean, I only installed the FilterCode plugin, activated it, and I had the same behavior again, the browser screen was blank.

Screenshots

No response

Moodle version

Moodle 4.2.2+ build:20230926

Installed Moodle UI Language packs.

If other language(s), please specify

Spanish International

Workaround

No response

Additional information

No response

System information

Client Device type: (e.g. Desktop, iPhone or iPad, Android phone or tablet, Other - specify) Client Operating System: (e.g. Windows, Linux, Mac OS, Android, iOS, Other - specify) Client Web Browser: (e.g. Chrome, Edge, Firefox, Safari, Safe Exam Browser, Moodle Mobile App) Server Operating System: (e.g. Windows, Linux, Mac OS, Other - specify) Server Webserver: (e.g. Apache, Nginx, IIS, Other - specify) Server PHP: (e.g. 7.3, 7.4, 8.x, Other - specify)

Code of Conduct

michael-milette commented 9 months ago

Hi @juanfortuna ,

I am running FilterCodes on Moodle Version 4.2.2+ (Build: 20230926) with PHP 8.0 and PHP 8.1 and it seems to be working fine. If you are not using the version here on GitHub already, please give it a try and let me know if it works any better.

If it is still not working for you, another thing you can try is to set debugging to DEVELOPER mode and then enable FilterCodes. You should get a lot more information about the error. Please share that back here so that I can try to figure out what is happening for you.

Best regards,

Michael

juanfortuna commented 9 months ago

Maybe you can help me with this error: Fatal error: Duplicate declaration of static variable $profilefields in /var/www/html/moodle2/filter/filtercodes/filter.php on line 2676. Thank you very much.

michael-milette commented 9 months ago

Hi @juanfortuna ,

Thanks for the information. That was exactly what I needed. Don't forget to turn debugging off again.

The issue should now be resolved. If you would be so kind, could you please try out the version available here on GitHub and let me know if this takes care of the problem for you? If it does, this fix will be included in the upcoming release of FilterCodes on moodle.org within the next few weeks.

Best regards,

Michael

juanfortuna commented 9 months ago

Thank you for the quickly answer, can you tell if I just copy the code over the one I have just installed before? or how do I do it? I am not familiar with the procedure.

juanfortuna commented 9 months ago

I unzipped the file, overwrote the contents of the FilterCodes directory in my Moodle installation and managed to fix the white screen but not the one that takes the user's last name variable. Here I attach some screenshots so you can see it. in_course_02 in_frontpage_01 in_frontpage_02

michael-milette commented 9 months ago

Hi @juanfortuna ,

Thank you for testing the new version of FilterCodes.

If {lastname} works when not in a URL but not when used in a URL, it is then very unlikely that the issue is with FilterCodes.

Are you using nginx by chance? If so, the issue may be a configuration issue with nginx. Over the years, I've had 2-3 of people mention this issue when using FilterCodes tags in URLs. I have not personally been able to reproduce the issue but I know that they did eventually fix it by modifying the nginx configuration. Unfortunately they did not share the solution with me.

If you are not using nginx, it could be an issue with the theme depending on where it is used.

If you need premium support to help you resolve the issue, please feel free to contact me through my website at https://www.tngconsulting.ca/contact.

As the original issue for this ticket has been addressed, I will be closing it. If you still believe that this is a problem with FilterCodes, please feel free to create a ticket for the new issue.

Best regards,

Michael

michael-milette commented 9 months ago

Hi @juanfortuna ,

I just noticed your question. To update a plugin:

  1. Download the ZIP file from GitHub.
  2. As a Moodle Admin, navigate to Site Administration > Plugins.
  3. Click "Install plugins" (its the first link at the top of the list.
  4. Drag and drop the zip file into the box for "ZIPpackage". Wait for the file to finish uploading and then click Install plugin from the ZIP file.
  5. Follow the prompts to complete the installation/update.

It will tell you that the plugin is already installed and will be updated. That is fine.

That said, the way you did it was fine too. It would only be a potential problem if the author of the code was restructured resulting in obsolete files not being removed. The other possible problem you can create by copying the files is that they may not end up with the correct permissions which could create new problems.

If you are not sure what you are doing, I recommend doing updating from within Moodle.

Best regards,

Michael