The short version: activating both "Block user messages" and "Privatemsg Realname Integration" causes an AJAX error in the recipient autocomplete input.
The error was in italian, but I can try to translate it:
An HTTP error occourred in AJAX.
HTTP response code: 500
Path: http://www.example.com/messages/autocomplete
StatusText: Service unavailable (with message)
ResponseText: Recoverable fatal error: Method DatabaseCondition::__toString() must return a string value in privatemsg_realname_query_privatemsg_autocomplete_alter() (row 60 of /path/to/drupal/sites/all/modules/contrib/privatemsg/privatemsg_realname/privatemsg_realname.module).
This are the details:
In a site I activated Real Name and Real Name integration for the Privatemsg module.
The Real Name pattern was something like "[field_first_name] [field_last_name]"
This way everything was working.
Later I had to change the pattern to generate Real Name to something like "[field_company_name]".
I edited all the users to create a new RealName.
Everything was still working.
At the same time I had to filter users by role: users with roles X, Y and Z cannot write messages to other users roles X, Y or Z but only to users with roles A, B or C (I know, it's a lot of roles).
So I activated the "Block user messages" sub-module and created some "Disallow sending message" rules between roles.
Now if I activate the rules, I get the error, otherwise I haven't the feature.
Thanks in advance!
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | privatemsg-fix-pm_block-pm_realname-ajax-2007058-2.patch | 773 bytes | ptmkenny |
Comments
Comment #1
nessunluogo commentedExplaining the problem helped me to find the right way, looking also this issue, and making some debug on privatemsg_realname.module.
It looks like the row 60 won't expect a non string value for $condition['field'], and i think "Block user" adds a DatabaseCondition object which causes the error.
I edited the row from:
if ($condition['field'] == 'u.name') {to:
if (is_string($condition['field']) && $condition['field'] == 'u.name') {And it seems everything is working to me.
I don't know if this solution is safe, but I hope it can help you to fix the issue.
Comment #2
ptmkenny commentedAttaching a patch for review to check it out against testbot. All credit should go to #1.
Comment #4
ptmkenny commented#2: privatemsg-fix-pm_block-pm_realname-ajax-2007058-2.patch queued for re-testing.
Comment #6
ptmkenny commentedComment #7
ptmkenny commented#2: privatemsg-fix-pm_block-pm_realname-ajax-2007058-2.patch queued for re-testing.
Comment #8
ptmkenny commentedDuplicate of https://drupal.org/node/1956038
Comment #9
caw67 commentedI have tried it and I think its an error in the og group modul. If I deactivate that it works! Also with realname!