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)
-   -   Major Additions - vBCredits - Ultimate Points System (https://vborg.vbsupport.ru/showthread.php?t=172399)

50calray 06-15-2009 05:25 PM

Quote:

Originally Posted by Darkwaltz4 (Post 1816416)
Couple ways to do it:

You can use the mass credit updater again (select all groups DONT select any awards, base 0, let it process)

I just did this and my website freaked out on me?

I get some type of warning and the forum skin turned white minus the banner.

Quote:

Warning: Division by zero in [path]/includes/functions_credits.php on line 28
http://www.semiautorifles.com/forums...911-a-967.html

50calray 06-15-2009 06:02 PM

edited: my IT guy rebooted it.

Darkwaltz4 06-17-2009 01:21 PM

Quote:

Originally Posted by kawe (Post 1829982)
why my credits not align left ?
how to fix it
im already revert all template
and setup follow the instruction :(

look at the other lines in the navbar area - do they have classes on them that need to also be applied to the new line you added for vbcredits? your style's css might not be expecting to style that line, so the default is making it center.

Quote:

Originally Posted by imported_silkroad (Post 1830084)
FWIW, Added new field winnumber to MySQL table credits_lottery to record winning number after each lottery. Code mod below:

Code:

# diff credits_daily.php credits_daily.php.back2
183c183
<                      $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "credits_lottery SET active = 0, winner = '" . $vbulletin->db->escape_string(serialize($winners)) . "', winnumber = $winnumber WHERE lotteryid = " . $lottery['lotteryid']);
---
>                      $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "credits_lottery SET active = 0, winner = '" . $vbulletin->db->escape_string(serialize($winners)) . "' WHERE lotteryid = " . $lottery['lotteryid']);

If it works (hope so!), will mod template to show winning number in last lottery, which is missing now.

that looks like it should work, and easy to pull out when listing finished drawings :)

Quote:

Originally Posted by 50calray (Post 1830217)
Warning: Division by zero in [path]/includes/functions_credits.php on line 28

You put 0 for the number of referrals per referral point. it needs to be 1 or higher - it is NOT the same as the referral award (it has to do with the additive referral bonus). once you fix that the error will go away and your style will fix itself.

imported_silkroad 06-17-2009 03:29 PM

Quote:

Originally Posted by Darkwaltz4 (Post 1831275)
that looks like it should work, and easy to pull out when listing finished drawings :)

Thanks!

I'll check the database when the current drawing happens the end of this week. If it works, I'll finish add to the lottery output.

Cheers.

ArnyVee 06-20-2009 06:19 PM

Quote:

Originally Posted by imported_silkroad (Post 1830084)
FWIW, Added new field winnumber to MySQL table credits_lottery to record winning number after each lottery. Code mod below:

Code:

# diff credits_daily.php credits_daily.php.back2
183c183
<                      $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "credits_lottery SET active = 0, winner = '" . $vbulletin->db->escape_string(serialize($winners)) . "', winnumber = $winnumber WHERE lotteryid = " . $lottery['lotteryid']);
---
>                      $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "credits_lottery SET active = 0, winner = '" . $vbulletin->db->escape_string(serialize($winners)) . "' WHERE lotteryid = " . $lottery['lotteryid']);

If it works (hope so!), will mod template to show winning number in last lottery, which is missing now.

Quote:

Originally Posted by Darkwaltz4 (Post 1831275)
that looks like it should work, and easy to pull out when listing finished drawings :)

Wow, if this works, please share! :D

imported_silkroad 06-21-2009 07:03 PM

Hi Dark!

We need to stop giving credits to users without activity for the past two years. Where would we add some PHP code like this:

Code:

//    60 * 60 * 24 * 365 * 2 = 63072000
$twoyearsago = time() - 63072000;

if ($userinfo[lastactivity] < $twoyearsago )
{
    exit;
}

Or the same code in the template somewhere?

Code:

<if condition="$userinfo[lastactivity] < (TIMENOW - 63072000)">
    User has not logged in for 30 days exit or something
</if>

Where should we do it?

Thanks!!

imported_silkroad 06-21-2009 07:05 PM

Quote:

Originally Posted by ArnyVee (Post 1833493)
Wow, if this works, please share! :D

OK, if we get it working, will let you know. Right now, we have a bug in the lottery code, but it was from another change we made, so we should know if this is working next weekend.

If it works, just follow the instructions in post 890 above.

Cheers.

Darkwaltz4 06-22-2009 08:55 PM

Quote:

Originally Posted by imported_silkroad (Post 1834265)
Hi Dark!

We need to stop giving credits to users without activity for the past two years. Where would we add some PHP code like this:

Code:

//    60 * 60 * 24 * 365 * 2 = 63072000
$twoyearsago = time() - 63072000;
 
if ($userinfo[lastactivity] < $twoyearsago )
{
    exit;
}

Or the same code in the template somewhere?

Code:

<if condition="$userinfo[lastactivity] < (TIMENOW - 63072000)">
    User has not logged in for 30 days exit or something
</if>

Where should we do it?

Thanks!!

the easy way is to move those users into a usergroup that doesnt earn credits for anything

or you can add that check to the includes/functions_credits.php award_credits function, and then the includes/cron/credits_daily.php file to change this query

PHP Code:

$vbulletin->db->query_write("UPDATE " TABLE_PREFIX "user SET credits = credits + CASE$pcsql ELSE 0 END WHERE credits_canearn = 1"); 

to include the date range

imported_silkroad 06-23-2009 08:25 AM

Quote:

Originally Posted by Darkwaltz4 (Post 1835113)
the easy way is to move those users into a usergroup that doesnt earn credits for anything

or you can add that check to the includes/functions_credits.php award_credits function, and then the includes/cron/credits_daily.php file to change this query

PHP Code:

$vbulletin->db->query_write("UPDATE " TABLE_PREFIX "user SET credits = credits + CASE$pcsql ELSE 0 END WHERE credits_canearn = 1"); 

to include the date range

Thanks Dark!

I don't think we will move the users to another usergroup, because if they become active again, which they often do, then we have to move them back. That that would not work for us.

So, I think I'll add the check to credits_daily.php as you suggested. I might add a new vB Option in the AdminCP for this instead of hardcoding our two year rule.

Thanks again.

imported_silkroad 06-23-2009 09:00 AM

Hi Dark,

I looked at that line in credits_daily.php. Perhaps my post was not clear, or I am missing something, or simply am making a mistake.

I want users who have been inactive for two years to receive no credit for anything (especially credit for having their old posts viewed, since we get a lot of traffic).

Does this one line in credits_daily.php "do it all", in other words, it is the one line that adds user credits for post views, posts, etc.?

Code:

$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits + CASE$pcsql ELSE 0 END WHERE credits_canearn = 1")
How about the query_write above that one?

Code:

  $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits + CASE$cdtsql ELSE 0 END, credits_numrefs = credits_numrefs + CASE$refsql ELSE 0 END WHERE credits_canearn = 1 AND usergroupid IN (" . implode(', ', $goodug) . ")")
;

Thanks!


All times are GMT. The time now is 06:29 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.04283 seconds
  • Memory Usage 1,766KB
  • 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
  • (8)bbcode_code_printable
  • (2)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)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