vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Buy Thread: Pay to Post New Thread (https://vborg.vbsupport.ru/showthread.php?t=116605)

bitwise2000 11-14-2011 03:32 AM

Quote:

Originally Posted by N8 (Post 2267706)
^ this

I wrote a UserCP plug-in that shows all details of ptpnt purchases.

N8 11-14-2011 08:29 AM

Quote:

Originally Posted by bitwise2000 (Post 2267718)
I wrote a UserCP plug-in that shows all details of ptpnt purchases.

Mind posting the code?

bitwise2000 11-14-2011 11:03 PM

Here's you go. Crude, and should be cleaned up, but it works for my purposes.

I sure wish Calorie would update this mod. It's one of very few things holding me back from vB4

Here's what the output looks like:Attachment 134403


Here's the script: (I put a link to this in the misc section of the UserCP sidebar.)
Code:

<?php


// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'ptpnt_stat');
define('CSRF_PROTECTION', true);

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('user');

// pre-cache templates used by all actions
$globaltemplates = array('USERCP_SHELL','usercp_nav_folderbit');

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// ######################## START MAIN SCRIPT ############################
if ($vbulletin->userinfo['userid'] == 0)
{
        print_no_permission();
}

$userid = intval($vbulletin->userinfo['userid']);
$threadstatus = "";

$result=$db->query_read("SELECT f.title AS forum, sum(p.totalthreads) AS 'threads',
sum(p.totalpaid) AS cost, sum(p.livethreads) AS live FROM ptpnt_buythread p left join forum f
on p.forumid=f.forumid where p.userid=" . $userid . " GROUP BY f.forumid");

If (mysql_num_rows($result)){

          while( $buy = $db->fetch_array( $result ) ) {
                $threadstatus .= "<tr><td>$buy[forum]</td><td>$buy[threads]</td><td>$buy[cost]</td><td>$buy[live]</td></tr></tr>";
}
        $result=$db->query_read("SELECT f.title AS forum, p.totalthreads AS 'threads',
        p.totalpaid AS cost, From_Unixtime(p.dateline, '%b %d %Y %r') AS purchased
        FROM ptpnt_buythread p left join forum f ON p.forumid=f.forumid
        WHERE p.userid=" . $userid . " ORDER BY p.dateline desc");

        $history = "";
                while( $buy = $db->fetch_array( $result ) ) {
                $history .= "<tr><td>$buy[forum]</td><td>$buy[threads]</td><td>$buy[cost]</td><td>$buy[purchased]</td></tr></tr>";
}
}

eval('$ptpnt_stat = "' . fetch_template('ptpnt_stat') . '";');

// start the navbar
$navbits = array('usercp.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['user_control_panel']);
$navbits['ptpnt_stat.php' . $vbulletin->session->vars['sessionurl_q']] = 'Purchased Thread Status';
$navbits[''] = 'Purchased Thread Status';

// build the cp nav
require_once(DIR . '/includes/functions_user.php');
construct_usercp_nav();

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
//        eval('$HTML = "' . fetch_template($ptpnt_stat) . '";');
$HTML = $ptpnt_stat;
eval('print_output("' . fetch_template('USERCP_SHELL') . '");');

?>

Here's the template:

Code:

<div align="center">
<if condition="$history">
<h2>Thread Credit Status</h2>
<table class='ptpnt'>
<tr>
<th>Forum</th>
<th>Total Credits</th>
<th>Total Cost</th>
<th>Balance</th>
</tr>
$threadstatus
</table>

<h3>Thread Credit Purchase History</h3>

<table class='ptpnt'>
<tr>
<th>Forum</th>
<th>Credits Purchased</th>
<th>Total Cost</th>
<th>Purchase Date</th>
</tr>
$history
</table>

<else />

<h3>You have not purchased any threads.</h3>

</if>
</div>


Here's the query I execute directly when I need to know monthly totals:
Code:

SELECT DISTINCT FROM_UNIXTIME(dateline,"%M, %Y")
AS month, sum(totalpaid) as TotalPaid
FROM ptpnt_buythread
GROUP BY month
ORDER BY dateline


N8 11-14-2011 11:36 PM

Thanks a lot man, I didn't feel like writing that out myself :)


I'm thinking I may hire someone to port this over to VB4 within the next couple months, I'll post the updated code when I have that done.

dcg 02-06-2012 10:25 PM

If anyone can update this hack for 4.0 please email me at adam@dcg.com, I will gladly pay for it. I will also pay very well as I need this updated.

bitwise2000 02-07-2012 12:52 AM

I'd contribute as well. It's the last thing keeping me from vB4.

digweb11 02-07-2012 07:00 PM

Anyone try this using vb4 ? Does it work?

dcg 02-07-2012 07:15 PM

Quote:

Originally Posted by digweb11 (Post 2297234)
Anyone try this using vb4 ? Does it work?

I had it modified and it is working perfectly for me on vb4.

bchertov 02-08-2012 05:41 PM

Very Nice Site, dcg!

ibwt 02-14-2012 06:05 PM

can someone please post it for 4X


All times are GMT. The time now is 07:33 AM.

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.01343 seconds
  • Memory Usage 1,746KB
  • 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
  • (3)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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