Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
The autocomplete fields at /messages/blocked includes user roles (for those that have permission) in addition to individual users. If you try to block a role from that form, you get a fatal error. We should probably prevent roles from showing up in the autocomplete (since blocking roles is not supported from that form). And if someone actually tries to manually enter a role for blocking, we need some error handling to prevent the fatal error from being displayed.
Just for completeness in this report, here's the fatal error:
Notice: Undefined property: stdClass::$uid in pm_block_user_has_blocked() (line 183 of/Users/benkaplan/git/drupal/sites/all/modules/privatemsg-DRUPAL-7--1/pm_block_user/pm_block_user.module).
Notice: Undefined property: stdClass::$uid in pm_block_user_block_validate() (line 159 of/Users/benkaplan/git/drupal/sites/all/modules/privatemsg-DRUPAL-7--1/pm_block_user/pm_block_user.pages.inc).
Notice: Undefined property: stdClass::$uid in pm_block_user_block_submit() (line 186 of/Users/benkaplan/git/drupal/sites/all/modules/privatemsg-DRUPAL-7--1/pm_block_user/pm_block_user.pages.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'author' cannot be null: INSERT INTO {pm_block_user} (author, recipient) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => 1 )in pm_block_user_block_submit() (line 191 of/Users/benkaplan/git/drupal/sites/all/modules/privatemsg-DRUPAL-7--1/pm_block_user/pm_block_user.pages.inc).
--Ben
Comment | File | Size | Author |
---|---|---|---|
#1 | privatemsg_block_only_user.patch | 7.29 KB | Berdir |
Comments
Comment #1
BerdirIt is actually even more broken right now because the autocomplete path is wrong.
This patch should fix both things suggested above and also adds a new hook to the autocomplete and documents that and another one that was found to be undocumented ;)
Comment #2
BenK CreditAttribution: BenK commentedThe patch works perfectly... roles don't show up in autocomplete, plus even if user types in a role manually, he is prevented from blocking with a user-friendly message. This is RTBC.
--Ben
Comment #3
BerdirThanks, commited.
A part of this needs to be ported back to 6.x-2.x...
Comment #4
BerdirPorted and commited!