Plans with amount of 0 redirect to PayPal Payment

2 replies [Last post]
alohamoney
Offline
Joined: 05/26/2010
Status: 
Answered

1.

my Publishing Plans
0.00 francs to publish for 1 days.
5.00 francs to publish for 5 days.
7.50 francs to publish for 10 days.

If i choose the plan with amount of 0, i will be redirected to the paypal payment page.

alohamoney
Offline
Joined: 05/26/2010
my own solution

not the best, but it works

ms_paypublish.module (line 496)

replace :
ms_paypal_api_start_payment('paypal node', $plan, $variables);
return;
with :
if ($plan->amount != '0.00') {
ms_paypal_api_start_payment('paypal node', $plan, $variables);
return;
} else {
$payment->data_id = ms_paypal_api_save_data('paypal node', $variables);
ms_paypublish_update_node($variables['nid'], $variables['days'], '1');
$content = "

". t('Your request has been received, and your content has been published. To view your content, click here: !link', array('!link' => l('Your Content', 'user/'. $user->uid .'/my-content'))) ."

";
print theme('page', $content);
return;
}

ms_paypublish.module (line 670)

replace :
ms_paypal_api_start_payment('paypal node', $plan, $variables);
return;
with :
if ($plan->amount != '0.00') {
ms_paypal_api_start_payment('paypal node', $plan, $variables);
return;
} else {
ms_paypublish_update_node($variables['nid'], $variables['days'], '1');

$content = "

". t('Your request has been received, and your content has been updated. To view your content, click here: !link', array('!link' => l('Your Content', 'user/'. $user->uid .'/my-content'))) ."

";
print theme('page', $content);
return;
}

Leighton Whiting
Offline
Joined: 06/02/2009
alohamoney, Thanks for

alohamoney,
Thanks for sharing your solution, it looks well thought out. I've been busy with Pay to Publish 4 which uses a different method that allows for free content publishing, so this won't be an issue anymore when it is released. Again, thanks to everyone for being so patient with Pay to Publish 4. It really was a complete rewrite but the wait will be worth it :)

Sincerely,
Leighton Whiting

Twitter Feed