vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   simple level hack (https://vborg.vbsupport.ru/showthread.php?t=45243)

Esdee 10-31-2002 08:17 AM

simple level hack
 
Well, as I'm still very new to PHP, I have a little question.
I find many RPG hacks and such, but what I want is something very simple and yet, I can't find it anywhere.

I only want a new stat in the postbit: Level: and it has to give the amounth of posts divided by 50

Can anyone tell me how to make such 'hack' ?

Thanks ^_^

Esdee 11-01-2002 11:51 AM

anybody ?
please ??

Bitsys 11-01-2002 02:05 PM

I am sort of new at this stuff too, but I think the following should work:

In your admin directory in functions.php (back up functions.php before editing it) find:
PHP Code:

// do posts from ignored users
    
if (($ignore[$post[userid]] and $post[userid] != 0)) {
        eval(
"\$retval = \"".gettemplate("postbit_ignore")."\";");
    } else {
        eval(
"\$retval = \"".gettemplate("postbit")."\";");
    }
    return 
$retval

It should be at the end of the getpostbit function.

Insert before it:
PHP Code:

$level $post[posts] / 50;
$level floor ($level 1); 

Go to the postbit template (in the admin cp) and and use the following code to display the level of the person:
PHP Code:

Level$level<br

I tested it on my boards and it worked so let me know if you have any questions or problems. As I said before, I am still kind of new at this stuff too. BTW, You can change the actual wording of the level display in postbit, just use $level wherever you want to insert that person's level.

Dean C 11-01-2002 05:41 PM

Lol what an excellently simple hack :)

- miSt

Esdee 11-01-2002 10:29 PM

Thanks man !
It works perfectly !
(I did have to leave out the +1 though ;) )

But I do have a question: Hwo do you know where you have to add such code in the functions.php file ?

And don't tease us, Mist ^_^
Everybody starts somewhere.
We might just be the future's great hackers :p

And besides, the little hacks can be most fun :D

Bitsys 11-02-2002 04:01 AM

How did I know where to add it? Well, I first looked at showthread.php to find out how posts are displayed. Then, I saw a call to the getpostbit function. This function was called for each post in the thread, so I figured that is where all of the variables and calculations were done. So I went to functions.php and found the getpostbit function. As far as where to put it in the getpostbit function, I just decided to skim to the bottom since all of the other stuff didn't pertain to or affect what I was trying to do. However, it would have been pointless to put it at the very bottom of the getpostbit function, since the postbit template would have been evaluated before the $level variable was set. So I just put it above the place where the postbit template was evaluated. :)

Is that what you were asking? If not, then just PM me and I can give a more detailed answer. :)

BTW, I agree that the little hacks can be the most fun ;)

Dean C 11-02-2002 08:25 AM

I wasn't teasing you - i was just happy at how simple things can be :)

- miSt

Esdee 11-02-2002 02:21 PM

^_^

Thanks Bitsys
That was exactly what I wanted toi know :)

Bitsys 11-02-2002 03:02 PM

^_^

Glad I was able to help :D


All times are GMT. The time now is 05:01 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.01117 seconds
  • Memory Usage 1,731KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete