CiviCRM 2.1+ compatibility

mboudey - April 21, 2008 - 22:49
Project:CiviCRM Subscribe
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

After installation, I get this when clicking on the Admin - Configuration - Subscribe link,

Fatal error: Call to undefined function crm_get_groups() in
/public_html/demo5/modules/civicrm_subscribe/civicrm_subscribe.module on line 43

Did I d something wrong?

I have Drupal 5.7 and Civic CRM 2.0 installed properly.

Thanks for the help.

#1

tostinni - April 22, 2008 - 20:26

Version 1.2 doesn't support the version 2.0 of CiviCRM so you have to apply this patch:
http://drupal.org/node/235904#comment-779724

#2

mboudey - May 22, 2008 - 17:03

OK, thanks tostinni.

#3

tjcook - October 31, 2008 - 04:37
Version:5.x-1.2» 6.x-1.x-dev
Category:support request» bug report
Priority:normal» critical

I got this exact error after fresh install of D6 dev build

#4

EvanDonovan - April 2, 2009 - 22:04
Title:Fatal error after installation Civic Subscribing» Fatal error after installing CiviCRM Subscribe: undefined function crm_get_groups()

The patches in #235904: CiviCRM 2.0 compatibility work against the 5.x version of the module. They are not compatible with 6.x. If I have time, I may create a patch for 6.x, now that I see what needs to be done. It's just tedious more than anything else.

#5

EvanDonovan - April 3, 2009 - 18:14

Note that to make the patch compatible with CiviCRM 2.2, the function has been changed (yet again) to civicrm_group_get (cf. the Group API documentation).

#6

EvanDonovan - April 3, 2009 - 21:16
Title:Fatal error after installing CiviCRM Subscribe: undefined function crm_get_groups()» CiviCRM 2.1+ compatibility
Status:active» needs work

Actually, there are many changes between the APIs for CiviCRM 1.x and CiviCRM 2.1+. I haven't yet been able to get a working version of this module, but at least this one doesn't give function not found errors.

AttachmentSize
civicrm_subscribe_v2-2.patch 9.97 KB

#7

EvanDonovan - April 6, 2009 - 21:07
Status:needs work» needs review

Ok, here's a patch of CiviCRM Subscribe that worked for me. It uses the CiviCRM API as mentioned in #415232: Migrating to CiviCRM 2.2, although the civicrm_subscribe() function and related functions mostly work as well.

All you would need to do to test out the civicrm_subscribe() function (and the drupal_mail functionality) would be to switch which part of civicrm_subscribe_form_submit() is commented out. Note that the token substitution is not currently working in the drupal_mail functionality, which is why I switched to the CiviCRM API (not to mention that it's just simpler).

Note that you will have to make sure your groups are publicly visible in CiviCRM if you want the subscribe to work successfully.

Please test this patch so we can get it or something similar committed to the 6.x branch of CiviCRM Subscribe. The 6.x branch is completely broken as it is.

AttachmentSize
civicrm_subscribe_v2-2.patch 16.19 KB

#8

EvanDonovan - April 7, 2009 - 20:28

Also, I just saw that menu strings shouldn't be wrapped in t(). So that would need fixing too, but it's trivial.

#9

rpalomo - April 8, 2009 - 04:32

I created a patch based on the original released dev version, that means includes your changes.

I also commented out in the form to get first and last names, and commented the other mail settings in the configuration. I Guess if you want to support drupal mail that has to come back, but in the mean time this works good.

AttachmentSize
civicrm_subscribe_v2-2b.patch 19.58 KB

#10

pelicani - May 5, 2009 - 18:06

This works, after a couple tweaks.
1. civicrm_subscribe_block needed to initialize civicrm and require the v2/Group.php
2. civicrm_subscribe_admin_settings needed to require the v2/GroupContact.php

#11

EvanDonovan - May 7, 2009 - 18:38

After applying pelicani's tweaks, the patch in #9 works for me. I'll try to re-roll the patch soon, when I have time.

Also note, however, what I said in #415232-7: Migrating to CiviCRM 2.2: you have to set your groups' visibility to Public if you want them to be subscribable, as per CRM-1797.

 
 

Drupal is a registered trademark of Dries Buytaert.