removed newsletters which user doesn't have access to
This commit is contained in:
parent
4c32c73321
commit
f4b8bfa249
@ -175,6 +175,23 @@ function materio_user_block_view($delta = '') {
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_module_implements_alter().
|
||||
*/
|
||||
function materio_user_module_implements_alter(&$implementations, $hook){
|
||||
if ($hook == 'form_alter') {
|
||||
// It is to ensure that hook_form_alter of this module is called
|
||||
// after all other hooks
|
||||
$group = $implementations['materio_user'];
|
||||
if (isset($group)) {
|
||||
unset($implementations['materio_user']);
|
||||
// Then add it back, so it will be at the end of hook array
|
||||
$implementations['materio_user'] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_form_alter().
|
||||
*/
|
||||
@ -218,11 +235,19 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
|
||||
materio_user_uc_cart_checkout_form_alter($form, $form_state, $form_id);
|
||||
}
|
||||
|
||||
// if( $form_id == "user_profile_form" ){
|
||||
// //dsm($form, '$form');
|
||||
// $form['account']['pass']['#type'] = "new_password_confirm";
|
||||
// }
|
||||
// remove newsletters category if user doesn't have access to them
|
||||
if( $form_id == "user_profile_form" ){
|
||||
// dsm($form, '$form');
|
||||
$options = array();
|
||||
foreach ($form['subscriptions']['newsletters']['#options'] as $tid => $name) {
|
||||
if(user_access("subscribe to simplenews category $tid")){
|
||||
$options[$tid] = $name;
|
||||
}
|
||||
}
|
||||
$form['subscriptions']['newsletters']['#options'] = $options;
|
||||
}
|
||||
|
||||
// remove newsletters category if user doesn't have access to them
|
||||
if ( $form_id == "simplenews_subscriptions_multi_block_form"){
|
||||
// dsm($form);
|
||||
$options = array();
|
||||
|
@ -77,7 +77,7 @@ function materio_user_export(){
|
||||
$vals[] = $rec->mail;
|
||||
}
|
||||
$ret = "Liste des user utilisateur inscrits au daily<br />";
|
||||
$ret .= '<textarea >'.implode($vals, ' ').'</textarea>';
|
||||
$ret .= '<textarea cols="40" rows="30">'.implode($vals, ' ').'</textarea>';
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user