vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Referral Statistics (https://vborg.vbsupport.ru/showthread.php?t=64469)

Boofo 05-18-2004 10:10 PM

gspot, this is basically the same query as in my forumhome stats hack. If you don't use the table AS table on all tables in a query that access more than one table, you will never get it working for this guy right. This:

[SQL]LEFT JOIN user ON (users.referrerid = user.userid)[/SQL]

HAS to be this:

[SQL]LEFT JOIN user AS user ON (users.referrerid = user.userid)[/SQL]

gspot 05-19-2004 04:22 AM

Thank you, should I add this to the main file in general?? :)
Not just for this guy, but for everyone??

Boofo 05-19-2004 04:28 AM

Yes, because there will be others who use table prefixes and that is where you will need it. I found out the hard way about this. ;)

Just remember for future reference, that if it is only 1 table with no joins then you don't need the table AS table. Only if the query has more than one table in it is when you will need it. And all the tables in a query like that have to have the table AS table in it. It is the table prefixes that cause the problem with that. ;)

gspot 05-20-2004 04:18 AM

Quote:

Originally Posted by Boofo
Yes, because there will be others who use table prefixes and that is where you will need it. I found out the hard way about this. ;)

Just remember for future reference, that if it is only 1 table with no joins then you don't need the table AS table. Only if the query has more than one table in it is when you will need it. And all the tables in a query like that have to have the table AS table in it. It is the table prefixes that cause the problem with that. ;)

Thanks, the file referals.php has been revised to this latest addon thanks to - BOOFO

msimplay 05-20-2004 06:28 AM

well i have a slight problem now
because the referals php seems to be using getinfo&username=
but it would be better if it used userid because the way thats currently used won't parse ascii code for example a user name like this

Code:

∙?МųşKąąη?

joeychgo 05-20-2004 12:44 PM

Quote:

Originally Posted by gspot
Option: To limit your referral results by usergroups, such as how many referrals were made to members in the registered usergroup, etc..



OK so my question is this.....

My board is set up so that when you first register, your a registered user. When you make 5 posts, your automatically upgraded to a full member.

Now, what I would like is to run a referral contest - but I only want those referrals that become full members to count in the score. (this way someone cant refer 20 false people or people who just sign up and never come back)

Does this hack do that now?

Aside from tht - what does this hack do that is different then the referral system built into VB3?

Boofo 05-20-2004 12:53 PM

Quote:

Originally Posted by gspot
Thanks, the file referals.php has been revised to this latest addon thanks to - BOOFO

You almost got it. You forgot to add the TABLE_PREFIX to the tables. ;)

The query should actually be:

PHP Code:

$referrers $DB_site->query("SELECT COUNT(*) AS referrals, user.username, user.userid FROM " TABLE_PREFIX "user AS users 
                   LEFT JOIN " 
TABLE_PREFIX "user AS user ON (users.referrerid = user.userid) 
                   WHERE user.userid > 0
                   GROUP BY users.referrerid 
                   ORDER BY referrals DESC 
                   LIMIT 
$max"); 


armani1072 05-20-2004 08:02 PM

Quote:

Originally Posted by gspot
Did you make this test site for vbulletin with a table prefix?? If so, please post the prefix that you used for the installation of vbulletins sql tables.. This will help me eliminate the problem you are having.


yes i added a prefix of "vB3" so all the table in mysql database start with vB3....


if i have to change this everytime then this would explain why i get errors everytime i have to run a query right?

Boofo 05-20-2004 09:39 PM

Quote:

Originally Posted by armani1072
yes i added a prefix of "vB3" so all the table in mysql database start with vB3....


if i have to change this everytime then this would explain why i get errors everytime i have to run a query right?

You should be able to run the query I just posted above just fine the way it is with a table prefix. You don't need to change or add anything to the query.

armani1072 05-20-2004 09:52 PM

Database error in vBulletin 3.0.1:

Invalid SQL: SELECT username FROM precisi_forums.user WHERE referrerid = '1' AND referrerid > 0
mysql error: Table 'precisi_forums.user' doesn't exist

mysql error number: 1146

sorry to keep bugging. changed code in referals.php and this is the new error i got. at least it is different


All times are GMT. The time now is 11:26 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.01399 seconds
  • Memory Usage 1,750KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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