message_plugin_flag.inc in Message 6
File
plugins/message/message_plugin_flag.inc
View source
<?php
if (module_exists('flag')) {
$plugin = array(
'title' => t('Flag realm'),
'description' => t("Determine access by a flaggings of a user."),
);
}
function message_plugin_flag_accessible_ids($account, $flag_name) {
$access = array();
if ($flag = flag_get_flag($flag_name)) {
if (($flaggings = flag_get_user_flags($flag->content_type, NULL, $account->uid)) && !empty($flaggings[$flag_name])) {
$access = array_keys($flaggings[$flag_name]);
}
}
return $access;
}
function message_plugin_flag_views_handlers() {
return array(
'message_handler_filter_realm_user_access_flag' => array(
'parent' => 'views_handler_filter_in_operator',
'path' => drupal_get_path('module', 'message') . '/includes',
),
);
}
function message_plugin_flag_views_data() {
$data = array();
$data['message_realm']['message_realm_flag'] = array(
'title' => t('Accessible realms by flag'),
'help' => t('The realms a user may access based on their flaggings.'),
'real field' => 'iid',
'filter' => array(
'handler' => 'message_handler_filter_realm_user_access_flag',
),
);
return $data;
}