PDA

View Full Version : [HTL] & [TXT] One-Time & Free Subscriptions


Andreas
02-14-2004, 10:00 PM
One-Time & Free Subscriptions
Version: 0.1
vB-version: 3.0.0 Release Candidate 2
Developer: Kirby
Install difficulty: Easy
File edits: 4
Template edits: 0

Description of the Hack:
This Hack allows you to create One-Time subscriptions which can be purchased only once.
It also allows you to have free subscriptions - when a user orders such a subscription he will be subscribed instantly.

HACK INSTALLATION DETAILS:
Files modified for this Hack:
admincp/subscriptions (1)
includes/functions_subscriptions.php (1)
subscriptions.php (2)

Details on how to install this manually are in the ZIP.

DB Tables modified for this Hack:
subscription

New DB columns for this Hack:
onetime


This post was generated by the Hack Tracking Log (https://vborg.vbsupport.ru/showthread.php?t=60735)

drumsy
02-15-2004, 02:52 AM
There is no zip...:confused:

Andreas
02-15-2004, 03:03 AM
Now there is. Didn't work at first - keeps saying "in progress"

Dean C
02-15-2004, 08:09 AM
Nice to see people expanding on the system. How about buy one subscription get one free offers and such :)?

gmarik
02-15-2004, 10:48 AM
Nice idea, Dean ...

gc1
02-15-2004, 03:51 PM
Dean, I am kinda green, I don't understand the instructions well and I don't know how to install this hack with xml files.

Give me a nudge and I will send you a small gift via PayPal since this was a hack I have requested.

GC

Andreas
02-15-2004, 07:31 PM
@gc1
You don't need the XML file if you don't use HTL (Hack Tracking Log).
Just follow the instrustions for manual installation (file otfsubs.txt in the ZIP).

gc1
02-16-2004, 12:20 AM
Anybody wanna tackle this and tell me what I am doing wrong?


Invalid SQL:
### INSERT QUERY GENERATED BY fetch_query_sql() ###
INSERT INTO subscription
(subscriptionid, title, description, active, onetime, length, units, cost, nusergroupid, membergroupids, forums)
VALUES
(NULL, 'bbb', '', '1', '1', '1', 'W', 'a:3:{s:3:\"usd\";s:4:\"0.00\";s:3:\"gbp\";s:4:\"0.00\";s:3:\"eur\";s:4:\"0.00\";}', '-1', '', 'N;')
mysql error: Unknown column 'onetime' in 'field list'

mysql error number: 1054

Date: Sunday 15th of February 2004 06:19:50 PM
Script: http://www.xxxxxxxxx.com/trucking/upload/admincp/subscriptions.php
Referer: http://www.xxxxxxxx.com/trucking/upload/admincp/subscriptions.php?do=add

Andreas
02-16-2004, 12:46 AM
Can a person be that dumb like me? I've got an error in the TXT, should be onetime and not foobar in the query :ermm:

Run the following query, this should fix the problem:


ALTER TABLE subscription CHANGE foobar onetime TINYINT( 1 ) DEFAULT '0' NOT NULL

gc1
02-16-2004, 12:55 AM
Can a person be that dumb like me? I've got an error in the TXT, should be onetime and not foobar in the query :ermm:

Run the following query, this should fix the problem:


ALTER TABLE subscription CHANGE foobar onetime TINYINT( 1 ) DEFAULT '0' NOT NULL


Thank you very much, if you have PayPal I will send you a small donation for your effort.

Thanks alot

Jeff

memdy
02-21-2005, 02:28 AM
I can't run the last two steps, becuase I can't FIND the code sections in my subscriptions.php .... vBulletin version 3.03 Any hints on where these might go in subscriptions.php ?


File subscriptions.php
FIND
// first check this is active if not die
if (!$subscriptioncache["$subscriptionid"]['active'])
{
$idname = $vbphrase['subscription'];
eval(print_standard_error('error_invalidid'));
}

BELOW that ADD
if ($subscriptioncache["$subscriptionid"]['onetime']) {
// Check if user has already purchased this subscription
$usersub = $DB_site->query_first("SELECT regdate FROM " . TABLE_PREFIX . "subscriptionlog WHERE subscriptionid=$subscriptionid AND userid=$bbuserinfo[userid]");
if ($usersub[regdate])
eval(print_standard_error('onetime_subscription')) ;
}

**************************************

FIND
$costs = unserialize($sub['cost']);
$subscription_title = $sub['title'];

BELOW that ADD
if (($costs[usd] == '0.00') AND ($costs[gbp] == '0.00') AND ($costs[eur] == '0.00')) {
build_user_subscription($subscriptionid, $bbuserinfo[userid]);
eval(print_standard_error('freesubscription_thanky ou'));
}

rjordan
03-27-2005, 02:56 PM
I know it has been a month since your question, but are you looking at subscription.php or subscriptions.php? You should be looking at the latter.

rjordan
03-27-2005, 05:21 PM
An addition to this would be to display FREE in the cost drop-down instead of being blank. This can be done with the following:

In ./subscriptions.php, find:
$subscription['cost'] = $string;
and above this:
if ($string == '')
{
$string .= "<option value=\"\" >FREE</option>\n";
}
Save and upload.

This works for me on 3.0.7. Thanks for this modification!