CoreFiles by mySites.guru
consents.php57 lines, 1,534 bytes, from Joomla_3.9.21-Stable-Full_Package.zip
Raw History Compare with 3.9.20
md5
52c4a21896a6de7724d2e9f3fdaf1632
sha1
a8b827696f1841a93fa35e217b6427465e69b8f6
sha256
84e048a63a7c97944761675c8fca0af7fba93152f6d4430d384d1af0876c4fc2
<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Privacy.consents
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('PrivacyPlugin', JPATH_ADMINISTRATOR . '/components/com_privacy/helpers/plugin.php');

/**
 * Privacy plugin managing Joomla user consent data
 *
 * @since  3.9.0
 */
class PlgPrivacyConsents extends PrivacyPlugin
{
	/**
	 * Processes an export request for Joomla core user consent data
	 *
	 * This event will collect data for the core `#__privacy_consents` table
	 *
	 * @param   PrivacyTableRequest  $request  The request record being processed
	 * @param   JUser                $user     The user account associated with this request if available
	 *
	 * @return  PrivacyExportDomain[]
	 *
	 * @since   3.9.0
	 */
	public function onPrivacyExportRequest(PrivacyTableRequest $request, JUser $user = null)
	{
		if (!$user)
		{
			return array();
		}

		$domain    = $this->createDomain('consents', 'joomla_consent_data');

		$query = $this->db->getQuery(true)
			->select('*')
			->from($this->db->quoteName('#__privacy_consents'))
			->where($this->db->quoteName('user_id') . ' = ' . (int) $user->id)
			->order($this->db->quoteName('created') . ' ASC');

		$items = $this->db->setQuery($query)->loadAssocList();

		foreach ($items as $item)
		{
			$domain->addItem($this->createItemFromArray($item));
		}

		return array($domain);
	}
}

The same content is in 30 releases, Joomla 3.9.15-rc to 3.10.0-alpha1. See them all, or every version of this file.