privatemsg does not work with non phptemplate based themes (Marvin/Chameleon)
| Project: | Privatemsg |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
* warning: Missing argument 1 for privatemsg_list() in .../sites/all/modules/privatemsg/privatemsg.module on line 375.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 25' at line 1 query: pager_query /* pager_query */ SELECT pmi.thread_id, MIN(pm.subject) as subject, MAX(pm.timestamp) as last_updated, MAX(pmi.is_new) as is_new, GROUP_CONCAT(DISTINCT author SEPARATOR ",") as author FROM pm_message pm INNER JOIN pm_index pmi ON pm.mid = pmi.mid WHERE (pmi.uid = 1) AND (pmi.deleted = 0) GROUP BY pmi.thread_id ORDER BY LIMIT 0, 25 in .../sites/all/modules/privatemsg/privatemsg.module on line 400.

#1
Clear the menu cache, that should solve that.
#2
#3
Sorry to reopen this - but I've got this error too - I've tried resetting the cache via the performance menu but it doesn't seem to have solved the problem?
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 25' at line 3 query: SELECT pmi.thread_id, MIN(pm.subject) as subject, MAX(pm.timestamp) as last_updated, MAX(pmi.is_new) as is_new, (SELECT GROUP_CONCAT(DISTINCT pmia.uid SEPARATOR ",") FROM pm_index pmia WHERE pmia.thread_id = pmi.thread_id) AS participants FROM pm_message pm INNER JOIN pm_index pmi ON pm.mid = pmi.mid WHERE (pmi.uid = 1) AND (pmi.deleted = 0) GROUP BY pmi.thread_id ORDER BY LIMIT 0, 25 in D:\xnetaaa\aaaa\sites\all\modules\privatemsg\privatemsg.module on line 472.The Order by clause does seem to be empty.
#4
You need to reset the menu cache, which is done by visiting admin/build/modules or update.php
#5
If it helps - I got the function to print the status of the $ORDER_BY when on the messages
ZZZZ ORDER_BY[Array
(
)
]
$query_id:unread_count
ZZZZ ORDER_BY[Array
(
[0] =>
)
]
$query_id:list
Which is presumably the problem - but I'm not sure where it's getting set - the call is just
$query = _privatemsg_assemble_query('list', $account, $argument);from
'privatemsg_list' => array('file' => 'privatemsg.theme.inc',
'path' => drupal_get_path('module', 'privatemsg'),
'arguments' => array('form'),
),
Can't seem to figure out the last part...
#6
Thanks for the quick reply.
I always run update after upgrading a module, but to be sure I've gone to admin/build/modules and re-run update just to extra sure and I've still got the problem.
#7
This is a cache issue, I'm 100% sure ;)
This is most probably a theme cache issue, try to re-save the module list at admin/build/modules, afaik only resaving rebuilds the theme cache. Or clear the cache with the Devel module.. or truncate all cache_* tables in your database.
#8
I'm glad you're so confident ;)
I've tried truncating re-saving the module list - haven't got the Devel module installed but could try that - and I truncated the cache tables, and it didn't appear to make any difference.
Then I thought some more and remembered there was an issue some time back with theme caches when using an admin theme different from the site theme.. which I have.
So I tried changing the site theme from Marvin to Garland and the link works in Garland, but changing the site to use Marvin for both it still seems not to work? So is it possible it could be an issue specific to Marvin? or just that the Marvin cache somehow still has something in it I can't clear?
#9
One more data point - I tried enabling a theme I haven't used at all before for the site - chameleon and it is showing the error.
#10
Oh, now I see the problem ;)
theme patterns are only supported by phptempate. And marvin (and marvin is a sub theme of chameleon) doesn't use that, it seems.
#11
Ah. Is that good news or bad?!?!?!?
I think I'm a bit confused as to how themeing affects the content of the form array? Can I work around it or will it need a code change to fix?
The problem seems to be that the term isn't empty but it doesn't have actual content so will a change to the order by fix it?
#12
This is bad news. ;)
The table header and fields are built using theme pattern functions, a feature that is not supported by Marvin/Chameleon. And these table headers are used to build the ORDER BY query part. But because they aren't found with your theme, a empty order by part is added which breaks the query.
We need to discuss if and how to support these themes..
Anyway, I can only suggest you to use a more modern theme for now, almost any you can find on d.o are based on phptemplate and Marvin/Chameleon was removed in Drupal7 already...
#13
@csc4 - Just curious, but are you using an unmodified version of marvin, or did you use it as a base theme to build on?
EDIT
If its only the basic theme used, you may want to try converting the linked version in #119929: Chameleon/Marvin converted to PHPtemplate to Drupal 6 and using that.
#14
I think there needs to be a note on the project page informing users of this issue - it is pretty important.
#15
It's unmodified, I'll have a look at either converting or switching it out thanks.
@Berdir thanks for the news - albeit bad ;)
As a workaround is it possible the code could check for the false line and remove it?, as it would be better if it gave the list without headers rather than dying!
#16
Hm, we could probably fallback to the default, hardcoded header and content list if nothing has been returned.
#17
Try the attached patch.
It does simply fallback to the default table if the dynamic stuff doesn't work if for example the theme doesn't support it.
#18
Tested and it works.
#19
@ litwol - this patch has been more than just tested and it worked - I had to ask Berdir some questions on irc to get a full explanation too, so it has been thoroughly vetted.
I think this is ready to be committed asap.
#20
Changing settings on admin/settings/messages for 'Configure listings' does almost nothing on the message listing page.
Disabling 'participants' actually removes the participants from the message listing pages, but does not remove the participants header.
Disabling/Enabling other fields does nothing visible.
However the basic message listing works :)
#21
That is the whole point behind this patch - a fallback for people not using phptemplate based themes. They get what they pay for, but atleast it works.
EDIT - yeah, seen the bug. I knew I would invite wrath from *somewhere* for trying to get this pushed through.
#22
Maybe documentation on the settings page saying this wont work for non phptemplate themes with a link to 'wtf is phptemplate theme'
#23
OK, I made the above stuff work - I guess discriminating against people with lesser themes is not a good thing :p
This is a more complete patch that allows the selection of other column data to work too.
I have also removed:
<?phpif (empty($thread['participants'])) {
return;
}
?>
from phptemplate_privatemsg_list_field__participants() as that seems to be not needed and also, we do not have similar fallbacks for any of the other functions.
#24
Applied #23 and tested:
- enable module in chameleon theme.
- switch from garland to chameleon with the module installed.
No notice, no error, no any of the issues at #20
Works fine.
#25
A few small fixes for e_strict and one other small change as mentioned by litwol on irc.
#26
+ if (count($header) == 1) {+ // No header definition returned, fallback to the default.
+ return $header + _privatemsg_list_headers_fallback($keys);
+ }
+ return $header;
I've learned that litwol likes "return once" style, so this could be changed to $header += ... but is really minor.
Other than that, this looks good.
#27
rerolled with that fixed.
#28
Looks good to me.
#29
Fixed by litwol in http://drupal.org/cvs?commit=235784
#30
Automatically closed -- issue fixed for 2 weeks with no activity.