Make WordPress Core

Changes between Version 4 and Version 5 of Ticket #51188


Ignore:
Timestamp:
08/31/2020 11:44:26 AM (5 years ago)
Author:
carike
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #51188 – Description

    v4 v5  
    3232Adding too many consent types would make it unwieldy and unnecessarily complicated for website visitors.
    3333However, there are certainly use cases in which site owners / admins may need more granular control.
    34 Let's say, for example, that the website offers a newsletter, but also wants user permission for third party targeted advertising on the website. The site owner may not want to exclude everyone who opts out of the latter from receiving their newsletter.
    35 Another possible use case may be notifications. A site owner / admin may not wish to exclude someone from setting their preferred admin colour scheme if they do not wish to consent to notifications.
    3634
    3735It seems that the best way to do this would be to provide a function in Core that would allow plugins to register **sub**-consent types.
     
    4442It does not seem desirable to save multiple user_meta values relating to consent per user, for performance reasons.
    4543A possible model might look something like the meta value for user capabilities.
     44
     45Example 1:
     46
     47The website offers a newsletter, but also wants user permission for third party targeted advertising on the website. The site owner does not want to exclude everyone who opts out of the latter from receiving their newsletter.
     48The website offers notifications. The site owner / admin does not wish to exclude someone from setting their preferred admin colour scheme if they do not wish to consent to notifications.
    4649
    4750{{{#!php
     
    8285The above should be appropriately serialized before being saved to the database.
    8386
     87Example 2:
     88
     89This shows a use case for which one additional top-level consent type (not exposed to the front end, only available on /wp-admin/) would be very useful.
     90Plugin authors are currently allowed to advertise / provide notices, as long as they don't hijack the admin panel.
     91One of the most common ways to permanently dismiss a notice is to add a user_meta value for it - which isn't the best use of the database / ideal for performance.
     92
     93The below may allow for theme authors to be able to provide installation / setup instructions via admin notifications as well. This ticket only shows a possible way it could be done. All discussion about the theme guidelines themselves should happen during Team meetings and on the relevant P2 posts.
     94In this example, the notice has not yet been permanently dismissed. Once the notice has been permanently dismissed for that user, the boolean value for that theme under "repos" should be set to "false".
     95
     96{{{#!php
     97<?php
     98$consents = array(
     99   'functional' => array(
     100      'comprehensive' => true,
     101      'remainder' => true
     102   ),
     103   'preferences' => array(
     104      'comprehensive' => false,
     105      'remainder' => true
     106   ),
     107   'anon_stats' => array(
     108      'comprehensive' => true,
     109      'remainder' => true
     110   ),
     111   'stats' => array(
     112      'comprehensive' => false,
     113      'remainder' => false
     114   ),
     115   'marketing' => array(
     116      'comprehensive' => false,
     117      'remainder' => true
     118   ),
     119   'repos' => array(
     120      'comprehensive' => false,
     121      'exampleTheme" => true,
     122      'remainder' => false
     123   )
     124);
     125}}}
     126
     127The above should be appropriately serialized before being saved to the database.
     128
    84129**Acknowledgements:**
    85130