vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Miscellaneous Hacks - vBulletin and iDevAffiliate Integration (https://vborg.vbsupport.ru/showthread.php?t=190848)

vb_mp 09-13-2008 10:00 PM

vBulletin and iDevAffiliate Integration
 
NOTE: I have it installed on 3.7x, I haven't tried earlier versions.

Description: I have been searching around for a plugin to allow vBulletin and iDevIntegration (for affiliate management of vbulletin paid subscriptions) and could not find any.

I contacted iDevAffiliate and their response was that they did not know enough
about vbulletin to create a plugin themselves but they explain what I had to do
on the iDevAffiliate side to make things work.

Thanks to vbulletin.org members Marco van Herwaarden, Dismounted, Delphiprogrammi, Opserty for pointing me in the right direction as this is my first vbulletin plugin.

This mod integrates iDevAffiliate commission tracking.

NOTE: Keep in mind, I assume that you are fairly well versed and comfortable with editing files/templates and following the flow of things.

Installing:

*********************************
STEP 1
*********************************
In payments.php in your forum root find the following code lines:

Code:

    /* insert query */
    $db->query_write("
        INSERT INTO " . TABLE_PREFIX . "paymentinfo
            (hash, completed, subscriptionid, subscriptionsubid, userid)
        VALUES
            ('" . $db->escape_string($hash) . "', 0, $subscriptionid, $subscriptionsubid, " . $vbulletin->userinfo['userid'] . ")
    ");

Replace them with the following:

Code:

    /* insert query */
    $insertQuery = "INSERT INTO " . TABLE_PREFIX . "paymentinfo
            (hash, completed, subscriptionid, subscriptionsubid, userid";
    $insertQuery .= $vbulletin->options['idevaffiliate_active'] ? ", ipaddress)" : ")";
    $insertQuery .= "VALUES
            ('" . $db->escape_string($hash) . "', 0, $subscriptionid, $subscriptionsubid, " . $vbulletin->userinfo['userid'];
    $insertQuery .= $vbulletin->options['idevaffiliate_active'] ? ", '" . IPADDRESS . "')" : ")";
    $db->query_write($insertQuery);

*********************************
STEP 2
*********************************
In payment_gateway.php file in your forum root find the following code lines:

Code:

   
if ($apiobj->type == 1)
{
    $subobj->build_user_subscription($apiobj->paymentinfo['subscriptionid'], $apiobj->paymentinfo['subscriptionsubid'], $apiobj->paymentinfo['userid']);

Add the following code under the above code ( make sure you replace YOURDOMAINNAME with your domain name and YOURIDEVINSTALLATIONFOLDER with your idev installation folder:

Code:

if ($vbulletin->options['idevaffiliate_active'] AND function_exists('curl_init') AND $ch = curl_init())
{
    $idevQuery = "idev_saleamt=" . $apiobj->paymentinfo['amount'] . "&ip_address=" . $apiobj->paymentinfo['ipaddress'] . "&idev_ordernum=" . $apiobj->paymentinfo['paymentinfoid'];
    curl_setopt($ch, CURLOPT_URL, "http://www.YOURDOMAINNAME.com/YOURIDEVINSTALATIONFOLDER/sale.php");
    curl_setopt($ch, CURLOPT_TIMEOUT, 15);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDSIZE, 0);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $idevQuery);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, 'vBulletin via cURL/PHP');

    $result = curl_exec($ch);
    curl_close($ch);
}

*********************************
STEP 3
*********************************
Install the idevaffiliate_integration Product via the Plugin Manager

*********************************
STEP 4
*********************************
Go to AdminCP -> vBulletin Options -> iDevAffiliate Integration Settings and enable use of iDevAffiliate by selecting 'Yes' and saving.

That's it, you are ready to use iDevAffiliate with vBulletin.

Dont Forget To MARK AS INSTALLED
And Also Don't Forget To Visit DNXpert.com

vb_mp 09-13-2008 10:05 PM

Reserving this spot for future updates.

Hornstar 09-13-2008 10:15 PM

Thanks for sharing this, I am going to give this a go next week on my holidays and will see how it goes. I have been meaning to do something like this for a while now, so many thanks for sharing. will let you know how things go. thanks.

vb_mp 09-13-2008 10:19 PM

No worries, it was fun to do - and it's useful :). I look forward to you trying it out.

creativepart 09-13-2008 10:42 PM

Sorry to sound dumb, but what the heck is iDevAffiliate? I went to their website and I still don't know what this program does. Can you explain it please?

vb_mp 09-13-2008 11:14 PM

Quote:

Originally Posted by creativepart (Post 1621541)
Sorry to sound dumb, but what the heck is iDevAffiliate? I went to their website and I still don't know what this program does. Can you explain it please?

It's an affiliate management software. Let's people sign up to your affiliate program and earn commissions for promoting your paid subscriptions (or other products).

bada_bing 09-14-2008 02:17 AM

Wow this is great I have been waiting for this for a couple of years not as I purchased the iDev software but could not effectively use it...

Question is because my one site is on 3.5.x version I would have to get verification that this hack works with that version before I hack up my payment.php file and install the plugin and risk my database getting corrupted.. CAN SOMEONE VERIFY THIS WORKS WITH VB 3.5.x PLEASE.

Thank You

creativepart 09-14-2008 03:14 AM

OK, I see. I'm used to being an affiliate for others not having others be affiliates for me. Thanks for the description.

vb_mp 09-14-2008 10:00 AM

Quote:

Originally Posted by bada_bing (Post 1621648)
Wow this is great I have been waiting for this for a couple of years not as I purchased the iDev software but could not effectively use it...

Question is because my one site is on 3.5.x version I would have to get verification that this hack works with that version before I hack up my payment.php file and install the plugin and risk my database getting corrupted.. CAN SOMEONE VERIFY THIS WORKS WITH VB 3.5.x PLEASE.


Thank You

I haven't got a dev server so I am not able to install 3.5.x anywhere to test it. Perhaps someone else can and let us know.

TeelK 09-14-2008 11:39 AM

tagged.. but i would never edit any original vb files as because when and upgrade comes out you have to do it all again, al wait see if someone can make it so no edit of files is possible.


All times are GMT. The time now is 04:10 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01306 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete