Comments

shouchen’s picture

Priority: Critical » Normal
shouchen’s picture

Status: Active » Needs review
StatusFileSize
new2.34 KB

Patch to update to new Forms API. I'm new at this... please review and commit to CVS if patch is good.
-Steve

shouchen’s picture

From what I can determine... this patch might be all that is needed to bring this module up-to-date with the upcoming 4.7 release.

q0rban’s picture

patch didn't work for me.. looks like there is a new version of subscription as of Dec 12... did that version include this patch? if not, can someone reroll this patch? if so the status on here is incorrect.... cheers

q0rban’s picture

nevermind.. just patched manually, and it seems to work fine now in 4.7.beta2.... once again, Diff'nPatch isn't cutting it for me...

q0rban’s picture

StatusFileSize
new3.75 KB

Updated the autosubscribe checkbox in the user hook with the new forms API... can someone check this to make sure I did it right?

There is still a form_checkbox in the nodeapi hook, but I'm not understanding the 'form post' op so I left it as is:

case 'form post':
      if (!$user->subscriptions_auto) {
        $allsubs = subscriptions_get_user();
        $val = isset($node->subscriptions_subscribe) ? $node->subscriptions_subscribe : $allsubs['node'][$node->nid] ? 1 : $user->subscriptions_subscribe;
        return form_item(t('Subscribe'), form_checkbox(t('Receive notification of replies to this %name.', array('%name' => node_invoke($node, 'node_name'))), 'subscriptions_subscribe', 1, $val));
      }
      break;
q0rban’s picture

Continuing the discussion with myself... The module seems to work fine in 4.7 beta2, except for one minor flaw... no e-mails actually get sent out! hehe... not sure what the problem is there... email works for all other aspects of the site, ie new users, and private messages...

q0rban’s picture

I finally got it working (as well as fixing a few other bugs)... will submit a patch later...

cheers

q0rban’s picture

StatusFileSize
new5.76 KB

here's the patch:

  • updates the autosubscribe checkbox in the user hook with the new forms API
  • updates the nodeapi hook 'form_post' to hook_form_alter
  • fixes the omitted subscriptions form to allow multiple omits
  • fixes the 'foreach' errors when there is only one omitted subscription (does not return as an array)

i hope it works for you!

q0rban’s picture

It still has some problems.... :(

So far it seems like it is only sending out the email to the poster, and not anyone who is subscribed to the forum...

q0rban’s picture

false alarm.. it works fine so far...

:)

sorry about the confusion, and the spam if you are subscribed to this...

[echoes] 
HELLO... Hello... hello... 
[/echoes] 
DaveNotik’s picture

Help. Trying to patch on Windows using cygwin and the patch command, and it says the .patch contains garbage:

patch unexpectedly ends in middle of line
patch: **** Only garbage was found in the patch input.

I bet it has to do with line breaks or some other Linux/Windows difference. Please advise.

Can someone send me a revised .patch? I'm desperate. :(

Thanks.

q0rban’s picture

It probably has to do with me patching on my Mac and line breaks being different... If you're brave, you can just cut and paste the items that need to be patched... Or you could try opening the .patch file in a Text Editor and pressing enter at the end of each line... If that doesn't work, I will try and re-roll the patch on my PC later today... that's right.. the only person who likes Macs and PCs!!! :)

I've never patched using cvs, so if someone else can re-roll who has experience doing that, it would be much appreciated..

shouchen’s picture

StatusFileSize
new6.04 KB

Try this patch file instead....

shouchen’s picture

For the above patch... don't worry if Hunk #1 fails. It is just a comment.

shouchen’s picture

I've finally set up a test site using this patch, and I don't see any mail sent when the subscribed-to pages are modified.

Mail is sent properly when I request a new password, so I know that mail, itself, is working. (So far, I've done all testing with the first user account.)

Any ideas?

-Steve

shouchen’s picture

Auto-subscribe does not seem to work. If I select the checkbox during node creation, the node is not subscribed to after it is submitted.

Using the latest patch on this thread.

q0rban’s picture

Status: Needs review » Needs work

I am receiving emails when new threads are created in subscribed forums... For example, If user-1 creates a new thread that user-2 is subscribed to, then user-2 is sent an email (user-1 is not sent any e-mails to threads he has created. Not sure if this is normal behavior or not).

I am not receiving emails when replies/comments are made to subscribed threads/nodes. I was assuming this was due to the following code:

function subscriptions_comment($op, $comment) {
  global $user;
  $strsent = '!';
  // TODO: it appears the comment status is not provided by this hook... we'll have to look into that later
  if (/* $comment['status'] == 0 && */ ($op == 'insert' || $op == 'update')) {
    $nid = $comment['nid'];
    $cid = $comment['cid'];
    subscriptions_mailvars($nid, $cid, $user->uid, 'node', $strsent);
    subscriptions_autosubscribe($user->uid, $nid);
  }
}

However, I'm not sure if this is only when you are subscribed to a comment. Someone more familiar with the innerworkings of the subscription module will have to help/inform on this...

cheers..

dan_aka_jack’s picture

Hi there,

Just wondering if there has been any updates with this module over the last week? I'm quite eager to use it! If no updates have been made then I'll role up my sleeves and have a go at the code myself when I have time.

Thanks,
Jack

q0rban’s picture

The last patch i've worked on is above.. Try it out and see what works for you... Would definitely love some help on this one!

shouchen’s picture

I can confirm what q0rban said...

category subscriptions appear to be working. e-mail is sent when new nodes are created in subscribed-to categories
thread subscriptions do not seem to work. e-mail is not sent when a comment is added to a subscribed-to node

-Steve

q0rban’s picture

I think I figured out the problem.. The order of the variables in hook_comment() call were backwards:

<?php
  function subscriptions_comment($op, $comment)
?>

Should be:

<?php
  function subscriptions_comment($comment, $op)
?>
shouchen’s picture

StatusFileSize
new6.16 KB

That fixed the thread subscription problem, q0rban. Here's a new patch!

dziemecki’s picture

I'll see if I can get Tom to test this in 4.7.

wpd’s picture

I applied the patch from post #23 to CVS HEAD.
I get notifications from my category subscriptions and I can subscribe to a thread and get comment notifications.

Still does not work:
When creating content, I can not subscribe to the thread. The checkbox on the edit/create page is not being saved properly.

I get the following error from admin/subscriptions

    * warning: array_merge() [function.array-merge]: Argument #1 is not an array in /var/www/html/drupal/sites/default/modules/subscriptions/subscriptions.module on line 529.
    * warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/www/html/drupal/sites/default/modules/subscriptions/subscriptions.module on line 529.

I am running PHP 5.

wpd’s picture

Status: Needs work » Reviewed & tested by the community

Despite the problems I listed, the module is now usable. I recommend commiting this patch and opening new issues for the other problems.

q0rban’s picture

I get the following error from admin/subscriptions
* warning: array_merge() [function.array-merge]: Argument #1 is
not an array in
/var/www/html/drupal/sites/default/modules/subscriptions/subscriptions.module
on line 529.
* warning: array_merge() [function.array-merge]: Argument #2 is
not an array in
/var/www/html/drupal/sites/default/modules/subscriptions/subscriptions.module
on line 529.
I am running PHP 5.

I think I found the problem (from php.net):

[QOUTE]
The behavior of array_merge() was modified in
PHP 5. Unlike PHP 4, array_merge() now only
accepts parameters of type array. However, you
can use typecasting to merge other types. See the example
below for details.

Example 3. array_merge() PHP 5 example

   <?php
     $beginning = 'foo';
     $end = array(1 => 'bar');
     $result = array_merge((array)$beginning, (array)$end);
     print_r($result);
   ?> 
   

[END QUOTE]

So, on line 533, modify the $subrows = array_merge($subrowsn, etc... to this:

      $subrows = array_merge((array) $subrowsn, (array) $subrowsb, $subrowst);

See if that fixes the problem for you. Thanks for testing it out...

cheers...

wpd’s picture

StatusFileSize
new6.51 KB

As per q0rban suggestion...
Changed one line ~529 in patched file to get rid of array error message in PHP 5. Rerolled patch. (It worked).

-$subrows = array_merge($subrowsn, $subrowsb, $subrowst);
+$subrows = array_merge((array)$subrowsn, (array)$subrowsb, (array)$subrowst);
shouchen’s picture

Tried to apply the latest patch against the version in HEAD... it no longer applies cleanly:

Hunk #5 FAILED at 335.
Hunk #7 FAILED at 526.
Hunk #8 succeeded at 558 (offset 3 lines).

Let's please get this patch in HEAD soon. Thanks!

-Steve

q0rban’s picture

StatusFileSize
new8.19 KB

Okay, I fixed the problem with the subscriptions checkbox when adding a node. This module should now be fully functional with 4.7!

I also changed how the body of the e-mail is formed. Line breaks weren't breaking for me in gmail, so I added them manually in the t() function.

This is a patch against HEAD (v 1.33).. I hope it works...

Looks like people were getting the same issues with PHP5 array_merge() in the 4.6 version, except that the fix in 1.33 is sloppier than ours IMO, so I left it the way we had it. :)

Cheers

shouchen’s picture

Yes - It applies cleanly against HEAD. Thanks.

wpd’s picture

Works for me also. Is there a reason this patch is not getting commited?
(Lack of time, better things to do are reasonable answers.) I was just wondering if there is something wrong with the patch that could be fixed?

TDobes’s picture

Reason for it not getting committed yet: Too busy trying to fix MAJOR bugs in the Drupal core.

Examples:
* 4.7 breaks all links within content of existing sites due to base href tag being removed (bug 13148)
* 4.7 breaks proper operation of the theme system (bug 52508)
* 4.7, for some reason, won't allow me to use the "\" character ANYWHERE... not content, not titles, not user-entered PHP code -- nowhere. I haven't found the cause for this yet to create a patch, but it's a big problem for me.

4.7 is still in beta and still has some major issues.

ahem... anyway: I appreciate greatly the work you all have done on getting this module working with 4.7. I will try to test and commit this patch as soon as I get my 4.7 test site functional again. (probably tomorrow afternoon) In the meantime, I apologize for the delay.

samc’s picture

Just an FYI in case anyone is still following this thread...

The patch applies cleanly, and works, against version 1.33 of the module.

Against 1.35 however, it applies mostly cleanly (with the exception of hunk #1 - the comment), but it kills the module administration page.

Hope this helps...

Now if I can only figure out how to use this thing!

dziemecki’s picture

I'm still following.

I've been hoping Tom would get to this and make it not be my problem, but he appears to be out of pocket. I'll see if I can get a cvs dev env gened up over the next few days and take care of this myself. Can somebody post the entire module? It's a pain to merge the patch with all of the other changes.

q0rban’s picture

StatusFileSize
new27.88 KB

Wow.. A lot of changes in the cvs version.. I hope I got everything...

q0rban’s picture

StatusFileSize
new931 bytes

install file...

dziemecki’s picture

Haven't seen the "*.install" syntax before. Would that work with "case 'pgsql':", as well? What invokes it?

q0rban’s picture

I guess there is a hook_install() function somewhere in core. Here is the associated handbook page. The nice thing is you can create upgrade paths, as well as having the various cases for each database type...

dziemecki’s picture

Priority: Normal » Critical

I'm genning up a 4.7 env this weekend to test this. Also bumpting priority up to critical, since we're in RC mode, for 4.7.

dziemecki’s picture

Assigned: Unassigned » dziemecki
Status: Reviewed & tested by the community » Fixed

I've posted the forms API changes to cvs. Right now, there seems to be a problem with display\download side of the house, so it may be a little while before you see. it. Look for the version that includes the *.install file.

dziemecki’s picture

Status: Fixed » Closed (fixed)

No complaints for 2 whole days. I'm closing the ticket.