When I hit the delete button on the theme side, regardless of whether any message threads are selected or not, an alert box shows:

An AJAX HTTP error occurred. 
HTTP Result Code: 200
Debugging information follows.
Path: /system/ajax
StatusText: OK
ResponseText: Fatal error: Call to undefined function privatemsg_list_submit() in [...]/includes/form.inc on line 1464

I've added some text to the _privatemsg_list_field__participants() field, otherwise this is a vanilla install on Drupal 7.22. Any ideas?

Comments

ptmkenny’s picture

Status: Active » Postponed (maintainer needs more info)

If you clear your caches, revert to the 2.x-dev branch (without your custom code), and use a default theme (e.g., Bartik), do you still get the error?

emcniece’s picture

Reverted, changed theme from Garland to Bartik, cleared cache and in that process the themed _privatemsg_list_field__participants() field code was removed... still getting the same error. Must be a module conflict...

I've managed to solve this by adding a custom module and some code to the init hook:

function ch_custom_functions_init(){
	if($_GET['q'] == 'system/ajax'){		
		if ( preg_match('/privatemsg_list/', $_POST['form_id'])) {
			include('/var/www/clients/client7/web29/web/sites/all/modules/privatemsg/privatemsg.pages.inc');
		}
	}
} 

The issue is also being discussed over at http://drupal.stackexchange.com/questions/72721/use-privatemsg-admin-for....

ptmkenny’s picture

Status: Postponed (maintainer needs more info) » Active
devin carlson’s picture

Status: Active » Closed (works as designed)

We've run into this with Drupal Commons in which the Commons Trusted Contacts module calls privatemsg_list() to embed the message list into a Quick Tabs tab.

The issue (which is explained nicely at http://drupal.stackexchange.com/a/11965/12457) has to do with the fact that custom menu router items are not directly related to privatemsg.module, nor privatemsg.pages.inc, so the system does not know that the privatemsg.page.inc include file is required to build the form, especially when the form is submitted and rebuilt via AJAX — which happens on 'system/ajax' (which, by default, would only know about files that use the 'privatemsg_list_page' page callback for their router items).

If you're calling privatemsg_list() from your own module, you'll have to hook_form_alter/hook_form_id_alter the privatemsg_list form to do the following:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function mymodule_form_FORM_ID_alter(&$form, &$form_state, $form_id)(&$form, &$form_state, $form_id) {
  // Load privatemsg.pages.inc and ensure it is automatically reloaded if
  // this form is rebuilt via AJAX or other means.
  form_load_include($form_state, 'inc', 'privatemsg', 'privatemsg.pages');
}
emcniece’s picture

Wow. Wow, wow... awesome. Just like that, eh? Another classic case of "misinformed developer" :)

Totally makes sense, thanks for linking out to some reading material. There's some free reputation waiting for somebody over at that first Stackexchange link ;)

Tested on the installation and it totally fixes the problem. Cheers!