When I enable either 'Show "unread messages" status message on user log in?' or 'Show "unread messages" status message on user profile?' setting, I get white screen after login or when going to user's profile, respectively.
Log contains the following error:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '<database>.contact_save' doesn't exist: SELECT COUNT(id) FROM contact_save WHERE `read` = 0; Array ( ) in contact_save_unread_messages() (line 163 of <path-to>/sites/all/modules/contact_save/contact_save.module).
I have a prefix set for database tables but it seems that there are two places in the code where Contact Save always tries to SELECT explicitly from the contact_save table.
Attached patch solves the issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | contact_save-use_db_select-2541436-0.patch | 1.42 KB | leppa |
Comments
Comment #1
leppa commentedComment #2
leppa commentedComment #3
alex_sansom commentedLooks to be an issue due to the combination of table name not being enclosed in '{' and '}' and the use of database table prefix. So, as well as the patch, another approach would be to wrap the table name in curly brackets. Both approaches should work.
See https://www.drupal.org/node/310072
Prefixing
In static queries, all table names must be wrapped in {}. That flags them so that the database system can attach a prefix string to them if appropriate. Prefixing allows for running multiple sites from the same database or, in limited cases, for sharing selected tables between sites.
Comment #5
paravibe commentedCommitted! Thanks!