Created
September 26, 2011 13:59
-
-
Save chrisns/1242295 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff U domain_rules.rules.inc domain_rules.rules.inc | |
--- domain_rules.rules.inc Mon Jan 19 22:26:36 1970 | |
+++ domain_rules.rules.inc Mon Jan 19 22:26:36 1970 | |
@@ -40,0 +41,11 @@ | |
+ 'rules_action_remove_node_domain' => array( | |
+ 'label' => t('Remove domain from a node'), | |
+ 'module' => 'Domain', | |
+ 'arguments' => array( | |
+ 'node' => array( | |
+ 'type' => 'node', | |
+ 'label' => t('Content'), | |
+ ), | |
+ ), | |
+ 'eval input' => array('subdomain'), | |
+ ), | |
@@ -144,0 +156,20 @@ | |
+} | |
+ | |
+function rules_action_remove_node_domain($node, $settings) { | |
+ | |
+ $domain = domain_lookup(NULL, $settings['subdomain'], TRUE); | |
+ | |
+ if ($domain['domain_id']) { | |
+ | |
+ $domain_id = $domain['domain_id']; | |
+ $nid =$node->nid ; | |
+ | |
+ // db_query("DELETE FROM {domain_access} WHERE gid ='%d' AND nid='%d'", $domain_id,$nid ); | |
+ db_query("DELETE FROM {domain_access} WHERE gid = '" . mysql_real_escape_string($domain_id) . "' AND nid = '" . mysql_real_escape_string($nid) . "'"); | |
+ | |
+ drupal_set_message(t('Done'), 'error'); | |
+ } | |
+ else { | |
+ drupal_set_message(t('Failed cant publish it'), 'error'); | |
+ } | |
+ // return array('node' => $node); | |
diff U domain_rules.rules_forms.inc domain_rules.rules_forms.inc | |
--- domain_rules.rules_forms.inc Mon Jan 19 22:26:36 1970 | |
+++ domain_rules.rules_forms.inc Mon Jan 19 22:26:36 1970 | |
@@ -87,0 +88,10 @@ | |
+function rules_action_remove_node_domain_form($settings = array(), &$form) { | |
+ | |
+ $form['settings']['subdomain'] = array( | |
+ '#type' => 'textfield', | |
+ '#title' => t('Domain address'), | |
+ '#default_value' => $settings['subdomain'], | |
+ '#description' => t("The domain address"), | |
+ ); | |
+} | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment