hi,
I have tested the new development version of this module
I have created several node subscription and Trying to show them in a page with php input filter.

if (function_exists('lm_paypal_can_subscribe')) {
  $subid = 1;
  if (lm_paypal_can_subscribe ($subid)) {
    print 'Why not subscribe now? ' . lm_paypal_subscribe($subid,8);
  }
}

Using the code given above doesn't give anything.

Comments

kerauno’s picture

Assigned: Unassigned » kerauno
Status: Active » Needs review

Fixed - please review. now displays terms to agree to if only the 8 is used and then the proceed to paypal.

new snippet code is as follows:

if (function_exists('lm_paypal_subscriptions_can_subscribe')) {
  $subid = 1;
  if (lm_paypal_subscriptions_can_subscribe ($subid)) {
    print 'Why not subscribe now? ' . lm_paypal_subscriptions_subscribe($subid,8);
  }
}
lyricnz’s picture

The whitespace in the snippet code needs a little work (see coder module, and coding standards), but your code looks okay.

nicktech’s picture

I've tried the snippet from comment #1 in a block and no subscribe button appears. The "Why not subscribe now?" shows up. And I do have a subscription setup as subid 1.
Another oddity, when I have that code in a block every single page on my site displays the subscription's name as the page title. So lets say my subscription's name is "yearly subscription". On every page (node, view, etc) "yearly subscription" will show in the content area with a div class of "node-title".
Is there a proper way to use an inline button with version 2.x?

sagar ramgade’s picture

Hi,

I tried with the code given in #1, it doesn't work either....please help...

kerauno’s picture

Did you enable the "PHP filter" module?

Did you select the php input format when you installed the code?

I just tested by adding a block and pasting the snippet example into the block.

sagar ramgade’s picture

Obviously yes...

kerauno’s picture

lol.

buzzman’s picture

any updates on this plz ... bump!

kerauno’s picture

This works. I do not have the steps the others have tried in this thread. I have added the code to a block and enabled the module "PHP filter. Everything worked. If it is not working, then please describe the steps you are doing to implement.

thanks.

sunchaser’s picture

I just don't get the PayPal tab when I try to create a new node that has been "flagged" as a "to pay for node" in the lm_paypal module settings.

created a subscription , linked my (cck) content type to it in "Associate node subscriptions with node types." , but nothing PayPal-ish is displayed when a new node is being created.

I used the above code in a block , still nothing ... documentation doesn't help too much either ... there is no mention about adding a PHP block by the way.

**EDIT 1** all of a sudden, this works.
I tried pasting in the above code into page.tpl.php and suddenly had everything working.
Then I moved everything back into a block and it semi-works now.

Only thing is now that the "I Agree" button (+ the entire disclaimer I entered) keeps popping up , even if I pressed the button.... working that out.

**EDIT 2** also , I was trying to add PayPal subscription for ANONYMOUS users (Paid ad type of application) ... Altho I set all the right permissions for that, it didn't seem to work. So I'm obligating my users to register first no (extra added value to that is that they can go in and review their subscription and edit their Ad of course...). And everything works like a charm after having put the code from the second comment into a PHP enabled block.

kerauno’s picture

Thanks for the updates. We still need to fix a few bugs in this area (like the title bar issue). I agree the snippet should include the following comment to reduce confusion on how to use.

PHP Filter module must be enabled
Paste snippet into block and define input format as php code.

lyricnz’s picture

I know how to fix the title bar, and will do this, once subscriptions are working again :)

kerauno’s picture

Paypal changed the way they verify transactions around March 29, 2010. They no longer allow null fields to be passed back during verification. This has been fixed in latest dev and the titlebar problem.

JohnDoranNY’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev

I am unable to use either of the provided snippets...

Using the code:

     if (function_exists('lm_paypal_subscriptions_can_subscribe'))
     {
          $subid = 1;
          if (lm_paypal_subscriptions_can_subscribe ($subid))
          {
               print 'Why not subscribe now? ' . lm_paypal_subscriptions_subscribe($subid,8);
          }
     }

I get "Fatal error: Call to undefined function lm_paypal_subscriptions_subscribe() in /home/content/23/7424523/html/modules/php/php.module(75) : eval()'d code on line 7"

If i change the function called to lm_paypal_subscribe($subid,8); I get the same "Call to undefined function lm_paypal_subscribe()" error.. though I do see the function in the lm_paypal_suscriptions.pages.inc file (which seems to get loaded via info file?).

When I move the snippet into my page template I get: "Fatal error: Call to undefined function lm_paypal_subscriptions_subscribe() in /home/content/23/7424523/html/themes/LTM/templates/page.tpl.php on line 261"

I am using using version 7.x-1.x-dev...

<> I added:

     require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'lm_paypal_subscriptions') . '/lm_paypal_subscriptions.pages.inc';

to my template.php to make sure it was loading, and I get it to kinda work then.. so it seems that it is not being loaded correctly in the subscription module.

As I said this is only 'mostly' working.. I now get a button but when I click to subscribe I come to a PayPal "donations" page (and I do not have donations enabled)... I see the name of the configured subscription (ie: LTM Monthly Billing: Business License
Reference: 2) but its asking for a donation amount and not using the configured monthly subscription fee as set up through the admin piece.

Also the function name is 'lm_paypal_subscribe_subscription' not 'lm_paypal_subscriptions_subscribe'

Todd Young’s picture

Any movement here?

jacobroufa’s picture

I'm having this issue as well. Also, after following #14, I still cannot see the subscription button. Any help here?

gtothab’s picture

I'm having this same problem. I get this error when I try using the code in comment 1:

Fatal error: Call to undefined function lm_paypal_subscriptions_subscribe() in C:\wamp\www\N-Z\oscl\modules\php\php.module(74) : eval()'d code on line 5

mattbk’s picture

Anyone able to fix this yet?

mattbk’s picture

For one, the function name in lm_paypal_subscriptions.pages.inc is
lm_paypal_subscribe_subscriptions() not
lm_paypal_subscriptions_subscribe().

EDIT: Oops, this was mentioned in #14.

Also, adding

<?php
     require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'lm_paypal_subscriptions') . '/lm_paypal_subscriptions.pages.inc';
?>

does not seem to work for me.

tibezh’s picture

this is work for me:

if (function_exists('lm_paypal_subscriptions_can_subscribe')) {
$subid = 1;
require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'lm_paypal_subscriptions') . '/lm_paypal_subscriptions.pages.inc';
  if (lm_paypal_subscriptions_can_subscribe($subid)) {
    print 'Why not subscribe now? ' . lm_paypal_subscribe_subscription($subid,8);
 }
}
nevosa’s picture

In the latest dev 7 version, I found these code sinplets (ex. #20) not to work - giving this error:
Notice: Trying to get property of non-object in lm_paypal_subscriptions_user_subscribed() (line 670 of /home1/allabpc2/public_html/sites/all/modules/lm_paypal/lm_paypal_subscriptions/lm_paypal_subscriptions.module).

The default block didn't work initially either (clicking it - nothing happened). After I cronned and cleared caches, added the premissions and rebuilt them, logged out and in from my site, it suddenly began to work.

Thank you guys for all your WORK!

fquintero’s picture

Line:

if (lm_paypal_subscriptions_can_subscribe($subid)) {

is never going to work because function lm_paypal_subscriptions_can_subscribe is expecting an object not a subid int.

You should have to replace:

<?php
if (function_exists('lm_paypal_subscriptions_can_subscribe')) {
$subid = 1;
$subsc = new stdClass;
$subsc->subid =  $subid;
require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'lm_paypal_subscriptions') . '/lm_paypal_subscriptions.pages.inc';
  if (lm_paypal_subscriptions_can_subscribe($subsc)) {
    print 'Why not subscribe now? ' . lm_paypal_subscribe_subscription($subid,8);
 }
}
?>