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.

Comments

tostinni’s picture

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

Anonymous’s picture

OK, thanks tostinni.

tjcook’s picture

Version: 5.x-1.2 » 6.x-1.x-dev
Category: support » bug
Priority: Normal » Critical

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

EvanDonovan’s picture

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.

EvanDonovan’s picture

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

EvanDonovan’s picture

Title: Fatal error after installing CiviCRM Subscribe: undefined function crm_get_groups() » CiviCRM 2.1+ compatibility
Status: Active » Needs work
StatusFileSize
new9.97 KB

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.

EvanDonovan’s picture

Status: Needs work » Needs review
StatusFileSize
new16.19 KB

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.

EvanDonovan’s picture

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

rpalomo’s picture

StatusFileSize
new19.58 KB

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.

pelicani’s picture

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

EvanDonovan’s picture

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.

berenddeboer’s picture

StatusFileSize
new19.06 KB

And here an updated patch. It's #9 + comments from #11. It would be nice to have first name/last name working again, but don't know yet how to do it.

PS: is this module abandoned?

EvanDonovan’s picture

@berenddeboer: Yes, I think this module is abandoned, I think. At least, I was the last person to make a patch for 2.1+ compatibility.

In CiviCRM 3.x, you should be able to meet all your CiviCRM subscription needs by using CiviCRM profiles in user registration or user edit. I don't know if the blocks functionality has any equivalent in CiviCRM 3.x though.

EvanDonovan’s picture

Status: Needs review » Reviewed & tested by the community

I am going to mark this RTBC since it can't hurt to get a working version of the module. douggreen is the only one with commit access. I'll see if I can ping him on IRC to just commit it real quick, for the few of us who still use the module :)

By the way, dlobo (CiviCRM development lead) said on IRC:

is it possible to get people into groups that are not publicly visible now?

via the api probably yes via the UI / civi generated forms, probably no

So if you are running CiviCRM 3.x, you should actually be able to use CiviSubscribe to subscribe people to groups that won't show in the CiviCRM-generated forms (which actually means that this module has found a new reason for life).

I'll soon have occasion to test whether dlobo's correct about this. I'll try to update you on my results.

EvanDonovan’s picture

I've offered to take over maintainership: #765056: Offering to take over maintainership of the CiviCRM Subscribe module.

I have tested what dlobo said and, yes, you can use CiviSubscribe to subscribe to groups that you don't make visible in the CiviCRM interface. So, yay, this module still have a reason for being!

EvanDonovan’s picture

I just took over maintainership. I'll try to commit this patch and make a new release shortly, as soon as I figure out how to use Drupal's CVS system.

EvanDonovan’s picture

Status: Reviewed & tested by the community » Needs work

I actually am planning to re-roll this patch soon, since it has some glaring code style issues visible via Dreditor. I'll have to run the whole module through Coder.module. It should still work functionally though.

Since I'm going away for my wedding next week :), I'm afraid I probably won't have a chance to commit a re-rolled patch until mid-June.

EvanDonovan’s picture

Status: Needs work » Needs review
StatusFileSize
new19.98 KB

Here is a patch against a CVS checkout of the 6.x-1.x with code style fixes. It should behave the same as the previous patch.

Once it's marked RTBC, or within the next few days, whichever is sooner, I will commit it to HEAD and the 6.x-1.x branch, and release a beta of 6.x-1.x.

Then we can discuss what things might be good to change or clean up prior to a full release.

Sorry that this took so long for me to get around to do.

EvanDonovan’s picture

Status: Needs review » Fixed

Many apologies for taking so long to commit this - it was my first time doing CVS (especially on drupal.org) and I was scared :)

I tested it myself today on a local install and it successfully added me to a public group. It failed with a very generic error message ("Subscription error"), however, when I tried adding to a hidden group. I think that is due to the DAO group add function which is called by the CiviCRM API wrapper.

There are obviously many improvements that could be made to this code, such as the ability to add to private groups, the ability to collect more data, subscription blocks, CAPTCHA, etc., but I'll add those later. Hopefully, I'll have the time - this has been on the back burner for quite a while.

Please upgrade to the 6.x-1.0-beta1, deleting the code you currently have first, and report back if there are issues. I plan on fixing any bugs prior to a full 6.x-1.0 release, then adding features in either 6.x-1.1, or 6.x-2.0, depending on how much of a change it is.

Status: Fixed » Closed (fixed)

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