summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremy2009-04-22 15:14:46 (GMT)
committer jeremy2009-04-22 15:14:46 (GMT)
commit8942da92d7f97ddb6e50053e7878775c7e643530 (patch)
tree8dc1f1e9eff74212ecb71c47a886ad1a6df6a363
parent1678d4828be76e59caea2e3f2f9eefc145c9a6f8 (diff)
- ad_channel.module6.x-2.0
o bug #436234: allow nodes to save properly on creation - ad_weight_percentage.module o bug #436234: allow nodes to save properly on creation
-rw-r--r--channel/ad_channel.module7
-rw-r--r--documentation/CHANGELOG.txt6
-rw-r--r--weight/probability/ad_weight_probability.module9
3 files changed, 13 insertions, 9 deletions
diff --git a/channel/ad_channel.module b/channel/ad_channel.module
index cc034f4..6d72408 100644
--- a/channel/ad_channel.module
+++ b/channel/ad_channel.module
@@ -449,12 +449,11 @@ function ad_channel_nodeapi($node, $op, $arg = 0) {
return _ad_channel_load_node($node);
case 'insert':
case 'update':
- // Fully load the node object to confirm that we are working with an
- // advertisement.
- $ad = node_load($node->nid);
- if (isset($ad->adtype)) {
+ if (is_object($node) && isset($node->adtype) &&
+ isset($node->probability) && isset($node->nid)) {
return _ad_channel_save_node($node);
}
+ break;
case 'delete':
return _ad_channel_delete_node($node);
case 'validate':
diff --git a/documentation/CHANGELOG.txt b/documentation/CHANGELOG.txt
index 5810aa6..aec3c7d 100644
--- a/documentation/CHANGELOG.txt
+++ b/documentation/CHANGELOG.txt
@@ -1,5 +1,11 @@
$Id$
+April 22nd, 2009
+ - ad_channel.module
+ o bug #436234: allow nodes to save properly on creation
+ - ad_weight_percentage.module
+ o bug #436234: allow nodes to save properly on creation
+
April 17th, 2009
- ad_cache_file.install
o bug #436926: be sure the file cache is disabled when the ad file cache
diff --git a/weight/probability/ad_weight_probability.module b/weight/probability/ad_weight_probability.module
index 02a8ca9..9a3d763 100644
--- a/weight/probability/ad_weight_probability.module
+++ b/weight/probability/ad_weight_probability.module
@@ -48,13 +48,12 @@ function ad_weight_probability_nodeapi($node, $op, $arg = 0) {
case 'insert':
case 'update':
if (user_access('configure ad probability')) {
- // Fully load the node object to confirm that we are working with an
- // advertisement.
- $ad = node_load($node->nid);
- if (isset($ad->adtype)) {
+ if (is_object($node) && isset($node->adtype) &&
+ isset($node->probability) && isset($node->nid)) {
return _ad_weight_probability_node_save($node, $op);
}
}
+ break;
case 'delete':
return _ad_weight_probability_node_delete($node);
}
@@ -99,7 +98,7 @@ function _ad_weight_probability_node_load($node) {
* Helper function, save the probability to the database.
*/
function _ad_weight_probability_node_save($node) {
- if (is_object($node) && $node->nid) {
+ if (isset($node->nid) && $node->nid) {
db_query('UPDATE {ad_weight_probability} SET probability = %d WHERE aid = %d', $node->probability, $node->nid);
if (!db_affected_rows()) {
db_query('INSERT INTO {ad_weight_probability} (aid, probability) VALUES(%d, %d)', $node->nid, $node->probability);