privatemsg does not work with non phptemplate based themes (Marvin/Chameleon)

afeijo - April 11, 2009 - 17:23
Project:Privatemsg
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

* 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

Berdir - April 11, 2009 - 17:25

Clear the menu cache, that should solve that.

#2

Berdir - April 13, 2009 - 14:32
Status:active» fixed

#3

csc4 - April 23, 2009 - 22:54
Status:fixed» active

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

Berdir - April 23, 2009 - 23:08

You need to reset the menu cache, which is done by visiting admin/build/modules or update.php

#5

csc4 - April 23, 2009 - 23:25

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

csc4 - April 23, 2009 - 23:29

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

Berdir - April 24, 2009 - 14:21

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

csc4 - April 24, 2009 - 23:38

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

csc4 - April 24, 2009 - 23:53

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

Berdir - April 25, 2009 - 00:05

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

csc4 - April 25, 2009 - 19:42

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

Berdir - April 25, 2009 - 19:52

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

nbz - April 26, 2009 - 18:02

@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

nbz - May 1, 2009 - 15:04
Title:Last dev update error (2009-04-11)» privatemsg does not work with non phptemplate based themes (Marvin/Chameleon)

I think there needs to be a note on the project page informing users of this issue - it is pretty important.

#15

csc4 - May 18, 2009 - 12:30

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

Berdir - May 28, 2009 - 13:16

Hm, we could probably fallback to the default, hardcoded header and content list if nothing has been returned.

#17

Berdir - May 29, 2009 - 11:04
Status:active» needs review

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.

AttachmentSize
430948.fallback.patch 2.03 KB

#18

nbz - May 30, 2009 - 22:56
Status:needs review» reviewed & tested by the community

Tested and it works.

#19

nbz - June 25, 2009 - 03:32

@ 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

litwol - June 25, 2009 - 16:40
Status:reviewed & tested by the community» needs work

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

nbz - June 25, 2009 - 17:54

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

litwol - June 25, 2009 - 18:13

Maybe documentation on the settings page saying this wont work for non phptemplate themes with a link to 'wtf is phptemplate theme'

#23

nbz - June 25, 2009 - 18:20
Status:needs work» needs review

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:

<?php
if (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.

AttachmentSize
privatemsg_fallback.patch 2.57 KB

#24

ilo - June 27, 2009 - 00:54

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

nbz - July 2, 2009 - 00:08

A few small fixes for e_strict and one other small change as mentioned by litwol on irc.

AttachmentSize
privatemsg_fallback.patch 2.61 KB

#26

Berdir - July 2, 2009 - 18:45

+  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

nbz - July 2, 2009 - 19:57

rerolled with that fixed.

AttachmentSize
privatemsg_fallback.patch 2.6 KB

#28

Berdir - July 2, 2009 - 20:29
Status:needs review» reviewed & tested by the community

Looks good to me.

#29

nbz - July 10, 2009 - 20:12
Status:reviewed & tested by the community» fixed

Fixed by litwol in http://drupal.org/cvs?commit=235784

#30

System Message - July 24, 2009 - 20:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.