I've installed this but get an error as foolows:

warning: Missing argument 1 for petition_menu() in /sites/all/modules/petition/petition.module on line 44.

Also when I try to edit petition settings I get an error:

Fatal error: Call to undefined function crm_uf_get_profile_fields() in /sites/all/modules/petition/petition.module on line 665

Any advice much appreciated

CommentFileSizeAuthor
#5 petition_civicrmv2_upgrade.patch3.54 KBmeecect

Comments

axbacon’s picture

Same problem plus

Fatal error: Call to undefined function crm_uf_get_profile_fields() in /modules/petition/petition.module on line 204

when I try to post

peterhessels’s picture

Title: Can't get this to work » Missing argument

Same problem: warning: Missing argument 1 for petition_menu() in /home/familiehessels.nl/public_html/drupal-6.15/sites/all/modules/petition/petition.module on line 44.

cybertoast’s picture

Priority: Normal » Critical

+1:
Fatal error: Call to undefined function crm_uf_get_profile_fields() in .../sites/all/modules/petition/petition.module on line 665

edmooney’s picture

Version: 6.x-1.0 » 6.x-1.1

I get the same error when trying to create a new petition:
Fatal error: Call to undefined function crm_uf_get_profile_fields() in /sites/all/modules/petition/petition.module on line 218

meecect’s picture

StatusFileSize
new3.54 KB

I have apparently fixed this. The issue is that the petition module is using the v1 api and needs to use the v2 api. Just switching that function name didn't work because in V2, you also have to include specific api files that define specific sets of functions.

After trying to manually convert the module for a bit, I smartened up and realized that there is a very helpful module out there to assist. It's called civicrm20compat, and it does a lot of the v1->v2 translation for you, meaning you only have to modify a few lines of the petition module to make it work. Get it here:

http://drupal.org/project/civicrm20compat

Then, you need to update the petition module to use it. I have included a patch for the mods, but basically, you (from the civicrm20compat page):

The only change you need to make in your code is to replace calls to civicrm_initialize() to civicrm20_initialize().

But it is recommended that you do something like:

function yourmodule_civicrm_initialize() {
if (function_exists('civicrm20_initialize')) {
civicrm20_initialize(true);
}
else {
civicrm_initialize(true);
}
}
And then replace all calls to civicrm_initialize() with calls to yourmodule_civicrm_initialize().

Patch is attached.

that0n3guy’s picture

after applying that patch I get blank white screen on node/add/petition and admin/settings/petition

that0n3guy’s picture

Oh i'm retarded... didnt enable the module above (civicrm20compat)

seanr’s picture

Status: Active » Needs work

The reason for the white screen is this here:

+function petition_civicrm_initialize() {
+  if (function_exists('civicrm20_initialize')) {
+    civicrm20_initialize(true);
+  }
+  else {
+    petition_civicrm_initialize(true);
+  }
+}
+

That'll obviously throw you into an infinite loop if civicrm20compat isn't installed. That should be doing something other than calling itself. ;-) At any rate, I'd much prefer to actually update the module to use the 2.0 API natively rather than relying on civicrm20compat. Unfortunately, I don't use CiviCRM at all, so I'll need some help with this.