I'm building a tool to allow users to subscribe and unsubscribe from various broadcast emails. It's an intranet, so all users are logged in, which is a nice start.
Matrix has two assets - the User Group Manager Page, and the BulkMail Subscribe Page - which both do a similar thing, link and unlink the current user to the prescribed user groups. So far so good.
Unfortunately, they're not very smart. They don't have awareness of which user groups you are already linked in, so they'll offer all the options to subscribe/unsubscribe, even though they're redundant. On a test BulkMail Subscribe Page, I've been able to use Javascript and some pattern matching to hide the redundant options, but that's pretty hacky.
Am I missing something here? are there undocumented alternatives to %subscriptions_picker% and %unsubscriptions_picker% which are more 'aware' of the status of the current user?
Even so, my client really just wants a single button, so essentially, a list of offerings, with a single button to subscribe or unsubscribe based on whether the currently logged in user is already a member of a group or not. eg:
- List 1 [ Subscribe ]
- List 2 [ Unsubscribe ]
The action is easy enough - I can use a trigger to do that, but I'm a bit stumped in just rendering the list. Ideally it would be an Asset Listing of the User Groups, and use a paint layout applied to each asset with conditional keywords to determine whether to show the subscribe or unsubscribe button. Unfortunately, this seems a bridge too far.
At the moment, I am stuck with the prospect of manually building the list in the paint layout, and hard coding an "In User Group Condition"keyword for each user group. It'll work, but it's not very elegant and manually maintaining stuff like this sucks.
Any brilliant ideas?
Apologies for length!