added rights for simplenews subscriptions by roles
This commit is contained in:
@@ -13,7 +13,7 @@ function materio_user_init() {
|
||||
* Implements hook_permission().
|
||||
*/
|
||||
function materio_user_permission() {
|
||||
return array(
|
||||
$perms = array(
|
||||
'view own user profile' => array(
|
||||
'title' => t('view own user profile'),
|
||||
'description' => t('view own user profile'),
|
||||
@@ -23,6 +23,18 @@ function materio_user_permission() {
|
||||
'description' => t('Access to online payment'),
|
||||
),
|
||||
);
|
||||
|
||||
$simplenews_cats = simplenews_category_list();
|
||||
// dsm($simplenews_cats);
|
||||
|
||||
foreach ($simplenews_cats as $tid => $name) {
|
||||
$perms["subscribe to simplenews category $tid"] = array(
|
||||
'title' => t("subscribe to simplenews category $name"),
|
||||
// 'description' => t('Access to online payment'),
|
||||
);
|
||||
}
|
||||
|
||||
return $perms;
|
||||
}
|
||||
|
||||
function materio_user_menu(){
|
||||
@@ -199,6 +211,17 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
|
||||
// //dsm($form, '$form');
|
||||
// $form['account']['pass']['#type'] = "new_password_confirm";
|
||||
// }
|
||||
|
||||
if ( $form_id == "simplenews_subscriptions_multi_block_form"){
|
||||
dsm($form);
|
||||
$options = array();
|
||||
foreach ($form['newsletters']['#options'] as $tid => $name) {
|
||||
if(user_access("subscribe to simplenews category $tid")){
|
||||
$options[$tid] = $name;
|
||||
}
|
||||
}
|
||||
$form['newsletters']['#options'] = $options;
|
||||
}
|
||||
}
|
||||
|
||||
// function materio_user_user_register_form_submit($form, &$form_state){
|
||||
@@ -684,3 +707,12 @@ function materio_user_mandrill_mailsend_result($result) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function materio_user_simplenews_subscriptions_multi_block_form_form_alter(&$form, &$form_state, $form_id){
|
||||
dsm($form_id, 'form_id');
|
||||
dsm($form, "form");
|
||||
dsm($form_state, "form_state");
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user