❌

Normal view

How could this AI custom module go wrong?

Look, before you judge me...

I'm not a programmer.

I'm working for a very small nonprofit outfit with a very limited budget.

I was tasked with fixing a problem with a Opigno Drupal server, where clicking a "Register" when NOT logged in button causes the server for 500.

After going the usual route of updates and looking for bug fixes and getting nowhere, I resorted to talking to AI. After a very lengthy conversation and lots of testing, I ended up with this:

/** * Implements hook_query_alter(). */ function anonymous_subscribe_fix_query_alter(Drupal\Core\Database\Query\AlterableInterface $query) { // Only alter queries for anonymous users on subscribe pages if (\Drupal::currentUser()->isAnonymous() && strpos(\Drupal::request()->getPathInfo(), '/subscribe') !== FALSE) { // Limit membership queries to prevent loading all members if ($query->hasTag('entity_query') || $query->hasTag('group_content_query')) { $query->range(0, 10); } } } 

Surprise surprise, it totally fixed the issue.

According to the AI,

All your groups are set to semiprivate visibility. When an anonymous user clicks "Register", Opigno is loading every single group and all their memberships to determine which ones the anonymous user can see and join.

The fix is simple - we need to tell Opigno: "Don't check all memberships for anonymous users, just show them the join form."

My questions are these:

What possible blowback could this module cause? Is there a better, cleaner way you can think of doing this?

submitted by /u/ThrowRA_932049092
[link] [comments]

Cloud Control Panel and API

Mar 16, 17:39 UTC
Resolved - From 16:14 to 16:38 UTC, Our Engineering team observed an issue impacting Cloud control panel and API. During this time, users may experienced errors when trying to access the Cloud control panel and when trying to use the API. Our team has fully resolved the issues as of 16:38 UTC. If you continue to experience problems, please open a ticket with our support team from within your Cloud Control Panel. We apologize for any inconvenience caused.

❌