Closed (duplicate)
Project:
CiviCRM Subscribe
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Support request
Assigned:
Reporter:
Created:
27 Mar 2009 at 04:43 UTC
Updated:
6 Apr 2009 at 21:13 UTC
I'm trying to migrate to CiviCRM 2.2, but I have, what appears to be a simple problem.
the require_once for 'api/v2/Group.php' file is not being found on the civicrm_subscribe_block method.
switch ($op) {
case 'list':
require_once 'api/v2/Group.php';
civicrm_initialize();
$groups = variable_get('civicrm_subscribe_groups', array());
foreach ($groups as $group_id) {
I have the module installed in sites/all/civicrm/drupal/modules/civicrm_subscribe and i get the error below, when i'm not in the //site/civicrm path. Any ideas?
warning: require_once(api/v2/Group.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\drupal6\sites\all\modules\civicrm\drupal\modules\civicrm_subscribe\civicrm_subscribe.module on line 191.
Comments
Comment #1
rpalomo commentedI moved the civicrm_initialize at the top of the module and that fixed it. Now I'm having problems with the subscribe form after submitting.
Comment #2
EvanDonovan commentedMarking as duplicate of #249530: CiviCRM 2.1+ compatibility: try the patch that I have uploaded to that thread. It doesn't actually subscribe yet, because I think there are changes to the Contact API, but it's closer to working.
Comment #3
rpalomo commentedMy changes are for Drupal 6.x and CiviCRM 2.2. It already adds the user to the group right now, but doesn't send an email, probably my configuration problem. I should've seen your changes to make my life easier but I had to discover all the problem on my own, I guess good learning experience.
I'm looking into setting an option to use CIVIMail or drupal mail for the registration, but at this point I'm stuck.
I still need to test a little more all the other stuff about opt-out other conditions in the code.
Comment #4
rpalomo commentedeven better now, if instead of calling civicrm_subscribe you do the following, it does the subscription and contact for you, there is no adding contacts or anything.
Then we just need to retrieve the group name to display it in the drupal_message screen..
Comment #5
EvanDonovan commentedExcellent! Sounds like you've gotten much further with this than I did. Care to post your code as a patch? Then maybe we can get it committed to the 6.x branch and close both our issues :)
Comment #6
rpalomo commentedOk, I gotta read the documentation on creating a patch, I'll get around it this week.
Comment #7
EvanDonovan commentedCheck out #249530: CiviCRM 2.1+ compatibility: after several hours of struggling with the CiviCRM Subscribe module's current implementation of adding to a group, I tried the API function you suggested. While it stumped me at first (due to CRM-1797: Subscribing to a group via CiviMail should be only able for groups with public visibility), I was eventually able to get it to work once I set my groups' visibility to Public in CiviCRM.
Anyway, if you could review the patch and possibly incorporate anything good from your version which I missed, that would be great. Hopefully we can get this committed soon.
The one thing that I'm missing is a civicrm_subscribe_block implementation, because it wasn't in the code that I was working from. You might be able to just drop your code in for that, though.
I'm flagging this as a duplicate so we can continue our work in the other issue, without having to check on both.
Btw, to create a patch the command is:
diff -up old-file new-file.