I am working on a feature that moderates content, and sends a user a PM once their content is under moderation. It relies on Rules to accomplish this, and specifically uses the rule action "Send a Message". Currently, when the rule action fires, I receive the following error:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'tag_id' at row 1: INSERT INTO {pm_tags_index} (tag_id, uid, thread_id) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => 8 [:db_insert_placeholder_2] => 613 ) in privatemsg_filter_add_tags() (line 238 of {site}/privatemsg/privatemsg_filter/privatemsg_filter.module).

Obviously, the tag_id can not be empty, and, therefore, I am getting the error above. I am aware that I have not explicitly defined a tag, but I see in the database that there is a system tag with the tag_id of 1. I couldn't find the logic to add that default system tag_id in the module (specifically privatemsg_filter_add_tags() function on line 217), so I added the following logic to that function:

if(empty($tag_id)) {
$tag_id = 1;
}

and found that the rule fires as expected now, and the tag is added properly.

Since I am new to Privatemsg Filter and the Rules integration part of Privatemsg, I am assuming that maybe I am setting up the rule incorrectly or not configuring something right? I also couldn't find anything relating to this in the issue queue or community at-large, so I hope this is not a repeat topic.

Any help would be greatly appreciated!

Comments

admurray’s picture

Status: Active » Closed (works as designed)

I found that if I added the action "Tag a privatemsg thread" and specified user, thread, and id, that the rule fired as expected. I'm closing, as I assume this is default behavior, although it would be nice if the thread was tagged by default in the logic if there was no tag specified.