created materio_user_rules module
This commit is contained in:
parent
c3c0c71945
commit
d35f79e2cf
25
materio_user_rules.info
Normal file
25
materio_user_rules.info
Normal file
@ -0,0 +1,25 @@
|
||||
name = Materio User Rules
|
||||
description = "Materio user rules generalist module"
|
||||
|
||||
; Core version (required)
|
||||
core = 7.x
|
||||
|
||||
; Package name (see http://drupal.org/node/542202 for a list of names)
|
||||
package = Materio
|
||||
|
||||
; PHP version requirement (optional)
|
||||
; php = 5.2
|
||||
|
||||
; Loadable code files
|
||||
|
||||
; Module dependencies
|
||||
dependencies[] = user
|
||||
dependencies[] = logintoboggan
|
||||
dependencies[] = simplenews
|
||||
dependencies[] = rules
|
||||
|
||||
; Configuration page
|
||||
; configure = admin/config/materiobasemod
|
||||
|
||||
; For further information about configuration options, see
|
||||
; - http://drupal.org/node/542202
|
26
materio_user_rules.module
Normal file
26
materio_user_rules.module
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Implement hook_user()
|
||||
*
|
||||
*/
|
||||
function materio_user_rules_user_update(&$edit, $account) {
|
||||
if (!empty($account->logintoboggan_email_validated)) {
|
||||
$subscritpions = ;
|
||||
rules_invoke_event('materio_logintoboggan_validated', $account, $subscritpions);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_simplenews_unsubscribe_user().
|
||||
*/
|
||||
function materio_user_rules_simplenews_subscribe_user($subscriber, $subscription) {
|
||||
if (!empty($subscriber->logintoboggan_email_validated)) {
|
||||
$args = array(
|
||||
'mail' => $subscriber->mail,
|
||||
'tid' => $subscription->tid,
|
||||
);
|
||||
rules_invoke_event_by_args('simplenews_rules_event_subscribe', $args);
|
||||
}
|
||||
}
|
45
materio_user_rules.rules.inc
Normal file
45
materio_user_rules.rules.inc
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Implement hook_rules_event_info().
|
||||
* @ingroup rules
|
||||
*/
|
||||
|
||||
|
||||
function materio_user_rules_rules_event_info() {
|
||||
return array(
|
||||
'materio_logintoboggan_validated' => array(
|
||||
'label' => t("When the user account is validated."),
|
||||
'group' => 'Materio',
|
||||
'variables' => array(
|
||||
'account' => array(
|
||||
'type' => 'user',
|
||||
'label' => t("The validated user's account"),
|
||||
),
|
||||
'simplenews' => array(
|
||||
'type' => 'simplenews',
|
||||
'label' => t("The Simplenews info from the account validated"),
|
||||
),
|
||||
),
|
||||
'group' => t('User'),
|
||||
),
|
||||
'materio_simplenews_rules_event_subscribe' => array(
|
||||
'label' => t('A user has been subscribed and verified'),
|
||||
'group' => t('Simplenews'),
|
||||
'variables' => array(
|
||||
'mail' => array(
|
||||
'type' => 'text',
|
||||
'label' => t('E-Mail'),
|
||||
'description' => t('The e-mail address that has been subscribed.'),
|
||||
),
|
||||
'tid' => array(
|
||||
'type' => 'integer',
|
||||
'label' => t('Simplenews category'),
|
||||
'descrption' => t('The newsletter category of the subscription.'),
|
||||
'options list' => 'simplenews_category_list',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user