No Code Attached Yet
avatar RosBort
RosBort
8 May 2026

Description

The System - Privacy Consent plugin (plg_system_privacyconsent) contains two related bugs
that together cause an infinite redirect loop for logged-in frontend users, even after
they have explicitly consented to the privacy policy.


Bug 1: state field not set when inserting consent record

File: plugins/system/privacyconsent/src/Extension/PrivacyConsent.php
Method: onUserAfterSave()

When a user consents, a record is inserted into #__privacy_consents without setting
the state field
, so the database default of 0 is used.

However, isUserConsented() queries for state = 1:

->where($db->quoteName('state') . ' = 1')


Since state is always 0, the consent is never recognized as valid.

Fix: Add 'state' => 1 to the $userNote object in onUserAfterSave():


$userNote = (object) [
    'user_id' => $userId,
    'subject' => 'PLG_SYSTEM_PRIVACYCONSENT_SUBJECT',
    'body'    => Text::sprintf('PLG_SYSTEM_PRIVACYCONSENT_BODY', $ip, $userAgent),
    'created' => Factory::getDate()->toSql(),
    'state'   => 1, // <-- missing!
];



-------

Bug 2: profile.apply task not handled
File: plugins/system/privacyconsent/src/Extension/PrivacyConsent.php
Methods: onUserBeforeSave() and onUserAfterSave()

The frontend "Save" button sends task profile.apply. Both methods only handle profile.save (= "Save & Close"). profile.apply is missing in both arrays:

// current (buggy):
\in_array($task, ['registration.register', 'profile.save'])

// fix:
\in_array($task, ['registration.register', 'profile.save', 'profile.apply'])


Steps to Reproduce
Enable the System – Privacy Consent plugin with a privacy article configured.
Register a new frontend user.
Log in – user is redirected to profile edit page to give consent.
Select "I agree" and click Save (not "Save & Close").
→ Consent is inserted with state = 0, loop continues.
Even "Save & Close" does not resolve it due to Bug 1.
Expected Behavior
Consent is stored with state = 1 and the redirect loop ends after clicking Save or Save & Close.

Actual Behavior
All consent records are stored with state = 0 (DB default). isUserConsented() always returns false. User is permanently stuck in redirect loop.

Joomla Version: 5.4.5
PHP Version: 8.5
Database: libmysql - mysqlnd 7.4.33-nmm8
Server: Localhost via UNIX socket
Server-Typ: MariaDB
Server-Version: 10.11.14-MariaDB-0ubuntu0.24.04.1-log - Ubuntu 24.04
Affected file: plugins/system/privacyconsent/src/Extension/PrivacyConsent.php
avatar RosBort RosBort - open - 8 May 2026
avatar joomla-cms-bot joomla-cms-bot - change - 8 May 2026
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 8 May 2026
avatar brianteeman
brianteeman - comment - 8 May 2026

I can not confirm this bug

Image
avatar brianteeman
brianteeman - comment - 8 May 2026

I can not confirm this bug

Image Image

-- Table structure for table `#__privacy_consents`
--
CREATE TABLE IF NOT EXISTS `#__privacy_consents` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL DEFAULT 0,
`state` int NOT NULL DEFAULT 1,
`created` datetime NOT NULL,
`subject` varchar(255) NOT NULL DEFAULT '',
`body` text NOT NULL,
`remind` tinyint NOT NULL DEFAULT 0,
`token` varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------

avatar RosBort
RosBort - comment - 9 May 2026

Thank you very much! I investigated further and found the error in my code.
I appologize for the inconveniences.

avatar RosBort RosBort - change - 9 May 2026
Status New Closed
Closed_Date 0000-00-00 00:00:00 2026-05-09 11:28:57
Closed_By RosBort
avatar RosBort RosBort - close - 9 May 2026

Add a Comment

Login with GitHub to post a comment