Posted by GregoryHeller on March 24, 2006 at 10:44pm
Jump to:
| Project: | Mailing List Manager |
| Version: | master |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Mailing lists should be "public" or "private", or role based, so that users can only see mailing lists based upon their user role.
Comments
#1
I did this on this node:
http://drupal.org/node/69002
#2
Please submit patches by issue, not in rollup patches.
I would prefer not to add complexity or hijack the status flag, which means something very different already. This also does not provide any role/permissions functionality, or allow the list to be usable/meaningful in any other way if Drupal thinks it's unpublished.
Perhaps the most appropriate solution for this is "subscribe to " on the admin/access page?
Without the use of node_access modules, we won't be able to hide it completely. I suspect this is why you're trying to hijack status. But we can hide it from the /mlm page by respecting the access settings.
One use case we will definitely want to address is providing a mechanism for people who are subscribed, don't want to be, and still need the ability to unsubscribe themselves.
#3
Ok so I see the logic for display being:
if the user is a subscriber, display, else if the list is not hidden, display
Now the question is where do we want to store this value if we're not using the node status- it seems like we could use the mlm settings table, or we could store something in the variables table. Variables table seems like a less sustainable way to do this and since we already have the mlm settings table, might be a logical place to put it.
#4
so maybe name = visibility, value = 0 or 1 ?
#5
Here's the code I'm using to do it via access roles:
function mlm_perm() {
$prems =array(
'administer mlm',
'administer mailing lists',
'administer own mailing list');
foreach (mlm_lists() as $list) {
$prems[] = "subscribe to: " . $list->title;
}
return $prems;
}
and
unction mlm_lists($list_type=null, $backend=null, $mail=null) {
$lists = array();
if (is_object($mail)) $mail = $mail->mail;
$res = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n
LEFT JOIN {mlm} USING ( nid )
WHERE n.type = 'mlm'
ORDER BY n.title"));
while ($row = db_fetch_object($res)) {
$list = node_load($row->nid);
if ($mail) {
$list->subscribed = mlm_is_subscribed($list, $mail);
}
// only return accessible lists
if (user_access("subscribe to: " . $list->title)) {
$lists[$list->nid] = $list;
}
}
return $lists;
}
#6
Upcoming work on this will involve node access settings, since node access modules are no longer mutually exclusive, and you get list hiding 'for free'.
The biggest hangup is UI.