vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - uCash 4.x (https://vborg.vbsupport.ru/showthread.php?t=227910)

Link14716 03-15-2010 07:26 AM

Quote:

Originally Posted by sticky (Post 2003900)
Awesome! It is working, the only error seems to be that it is not giving partial points, 0.5 for example.

That has to do with the way reputation is stored in the database (it's an INT which only allows whole numbers). If you want it to accept decimal values like the uCash field can, run this query (adding your table prefix before user if you have one):
[sql] ALTER TABLE user CHANGE reputation reputation DECIMAL(24, 5) NOT NULL DEFAULT '10'[/sql]

I'm not sure what the side effects of doing this are, however. Reputation values might not be "prettied up" everywhere, so you may see people running around with long decimal points at the end of their rep values.

If you want to change it back to vB's default structure for any reason, run this query:
[sql] ALTER TABLE user CHANGE reputation reputation INT(11) NOT NULL DEFAULT '10' [/sql]

sticky 03-15-2010 05:50 PM

Quote:

Originally Posted by Link14716 (Post 2003920)
That has to do with the way reputation is stored in the database (it's an INT which only allows whole numbers). If you want it to accept decimal values like the uCash field can, run this query (adding your table prefix before user if you have one):
[sql] ALTER TABLE user CHANGE reputation reputation DECIMAL(24, 5) NOT NULL DEFAULT '10'[/sql]

I'm not sure what the side effects of doing this are, however. Reputation values might not be "prettied up" everywhere, so you may see people running around with long decimal points at the end of their rep values.

If you want to change it back to vB's default structure for any reason, run this query:
[sql] ALTER TABLE user CHANGE reputation reputation INT(11) NOT NULL DEFAULT '10' [/sql]

Instead of going 5 decimal places could I go two which would probably have a smaller chance of odd side effects?

Link14716 03-16-2010 12:16 AM

Quote:

Originally Posted by sticky (Post 2004206)
Instead of going 5 decimal places could I go two which would probably have a smaller chance of odd side effects?

Yeah, just change the 5 to a 2.

sticky 03-16-2010 12:26 AM

Quote:

Originally Posted by Link14716 (Post 2004459)
Yeah, just change the 5 to a 2.

Thanks, just wanted to make sure :)

sticky 03-16-2010 03:05 AM

Quote:

Originally Posted by Link14716 (Post 2003920)
That has to do with the way reputation is stored in the database (it's an INT which only allows whole numbers). If you want it to accept decimal values like the uCash field can, run this query (adding your table prefix before user if you have one):
[sql] ALTER TABLE user CHANGE reputation reputation DECIMAL(24, 5) NOT NULL DEFAULT '10'[/sql]

I'm not sure what the side effects of doing this are, however. Reputation values might not be "prettied up" everywhere, so you may see people running around with long decimal points at the end of their rep values.

If you want to change it back to vB's default structure for any reason, run this query:
[sql] ALTER TABLE user CHANGE reputation reputation INT(11) NOT NULL DEFAULT '10' [/sql]

Hey, it worked!

You freaking rule!

sticky 03-16-2010 04:48 AM

Quote:

Originally Posted by Link14716 (Post 2004459)
Yeah, just change the 5 to a 2.

One glitch I noticed.

When switching the Rep system to decimal value if a user has, say, 2.6, and I give them +1, it will just make it a whole number, 3.0, and they will lose the decimal value, it won't add it making it 3.6.

Any idea?

Link14716 03-16-2010 05:14 AM

Quote:

Originally Posted by sticky (Post 2004577)
One glitch I noticed.

When switching the Rep system to decimal value if a user has, say, 2.6, and I give them +1, it will just make it a whole number, 3.0, and they will lose the decimal value, it won't add it making it 3.6.

Any idea?

Actually, yes I do. The user data manager runs an intval() on reputation, dropping the decimal point. Easiest way to deal with this is probably a code change, just remember that you'll have to re-apply it whenever you upgrade vBulletin.

In /includes/class_dm_user.php, find:
PHP Code:

$reputation intval($reputation); 

Replace with:
PHP Code:

$reputation strval($reputation) + 0

Save, close, upload, etc.

There's probably a way to make a clever plugin achieve the same goal, but that should get the job done for now.

sticky 03-16-2010 05:50 AM

Quote:

Originally Posted by Link14716 (Post 2004582)
Actually, yes I do. The user data manager runs an intval() on reputation, dropping the decimal point. Easiest way to deal with this is probably a code change, just remember that you'll have to re-apply it whenever you upgrade vBulletin.

In /includes/class_dm_user.php, find:
PHP Code:

$reputation intval($reputation); 

Replace with:
PHP Code:

$reputation strval($reputation) + 0

Save, close, upload, etc.

There's probably a way to make a clever plugin achieve the same goal, but that should get the job done for now.

It worked! You sir, are a genius.

Absolutely amazing! Other mod writers would tell me something along the lines of "I won't support that" or a different discouraging remark if messing outside the mod's initial parameters.

Thank you so much!

paulbhoy 03-18-2010 09:32 PM

you are using this code to display the users points in the postbit, "{vb:raw template_hook.postbit_userinfo_right_after_posts}"

I was wondering if there is any other way to display the amount of points a user has.

because that line of code also controls the blog entries, and I dont want to display the blog entries, so I have that line of code commented out.

anyway to either display the amount of points differently, or somehow take out the blogs from that template with out effecting the points.

Link14716 03-19-2010 08:26 AM

Quote:

Originally Posted by paulbhoy (Post 2006098)
you are using this code to display the users points in the postbit, "{vb:raw template_hook.postbit_userinfo_right_after_posts}"

I was wondering if there is any other way to display the amount of points a user has.

because that line of code also controls the blog entries, and I dont want to display the blog entries, so I have that line of code commented out.

anyway to either display the amount of points differently, or somehow take out the blogs from that template with out effecting the points.

Uncomment that line, go to Plugins & Products -> Plugin Manager and disable the "Postbit: Add links to blog" plugin by unchecking its box and clicking "Save Active Status" at the bottom. If you want to, you can also uncheck the other blog plugins prefixed with "Postbit:", but that's the main one.


All times are GMT. The time now is 10:47 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.02458 seconds
  • Memory Usage 1,760KB
  • 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_php_printable
  • (9)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