* 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.

Comments

berdir’s picture

Clear the menu cache, that should solve that.

berdir’s picture

Status: Active » Fixed
csc4’s picture

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.

berdir’s picture

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

csc4’s picture

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...

csc4’s picture

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.

berdir’s picture

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.

csc4’s picture

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?

csc4’s picture

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.

berdir’s picture

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.

csc4’s picture

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?

berdir’s picture

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...

naheemsays’s picture

@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.

naheemsays’s picture

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.

csc4’s picture

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!

berdir’s picture

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

berdir’s picture

Status: Active » Needs review
StatusFileSize
new2.03 KB

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.

naheemsays’s picture

Status: Needs review » Reviewed & tested by the community

Tested and it works.

naheemsays’s picture

@ 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.

litwol’s picture

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 :)

naheemsays’s picture

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.

litwol’s picture

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

naheemsays’s picture

Status: Needs work » Needs review
StatusFileSize
new2.57 KB

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:

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.

ilo’s picture

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.

naheemsays’s picture

StatusFileSize
new2.61 KB

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

berdir’s picture

+  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.

naheemsays’s picture

StatusFileSize
new2.6 KB

rerolled with that fixed.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

naheemsays’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

shivaveepuri’s picture

Change line

if (!empty($ORDER_BY)) { at around 2144 line to
if (!empty($ORDER_BY) && implode(", ", $ORDER_BY)!="") {