matomo-for-wordpress
matomo-for-wordpress copied to clipboard
In Access settings tab let users choose to make their data public
Haven't added it yet as it's rarely needed.
- Add a new global setting "allow_anonymous_access"
- In Access Settings template show form (see below) to enable this feature => after successful change of setting value we should trigger a user re-sync
- In AccessSettings class process that form post and configure the above global setting accordingly
- Capabilitiy class needs to add the
MATOMO_VIEWcapability to all users when feature is enabled - User Sync needs to make sure to enable/disable anonymous access in Matomo by giving the anonymous user view access
Tests for all of this...
The form could look like this
<h2>
Public access: Give everyone view access to your reporting data - including not logged in users
</h2>
<p>Enabling this feature makes your reports available to everyone. Anyone will be able to view how many visitors you had, what pages have been viewed on your website how often, and more.
<a rel="noreferrer noopener" href="https://matomo.org/faq/how-to/faq_20130/">Learn more about making your report data public and viewable by anyone</a>
<br /><br />
<form method="post" onsubmit="confirm only if prompt('TEXT FROM BELOW').toLowerCase() === 'ok'">
<?php wp_nonce_field( AccessSettings::NONCE_NAME_ANONYMOUS ); ?>
<input type="hidden">
<input name="Submit" type="submit" class="button-primary"
value="<?php echo esc_attr__( 'Make all reports public', 'matomo' ) ?>"/>
</form>
</p>
<p id="MOVE THIS INTO CONFIRM">Are you sure you want to change anonymous's role to View for your reports?
Giving the anonymous user the View role will make this website's data public and available to everyone, even if they do not have a Matomo login. Please type OK to confirm this change</p>
</p>