Make User Notification Preferences for a Block Plugin Available Only to Selected Users or Roles

Re: Make User Notification Preferences for a Block Plugin Available Only to Selected Users or Roles

by Mike Henry -
Number of replies: 0

Think I got it!  Thanks for pointing me in the right direction.  I did have to use a role, it's not per user, but I'll give up on that and just tack a capability onto an existing role.  With the setup below, general users can submit feedback to the users in the recipient list, but only those users with the role assigned (and with the capability allowed in the role) are seeing the notification preferences.

db/access.php:  

$capabilities = array("block/site_feedback:notification_preferences" => array("captype" => "read", "contextlevel" => CONTEXT_SYSTEM));

db/messages.php:  
$messageproviders = array("submit" => array("capability" => "block/site_feedback:notification_preferences"));

lang/en/block_site_feedback.php:
$string["pluginname"] = "Site Feedback";
$string["messageprovider:submit"] = "Site feedback notifications";
$string["site_feedback:notification_preferences"] = "Manage site feedback notification preferences";