vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   minor or equal / greater or equal operators in template (https://vborg.vbsupport.ru/showthread.php?t=214548)

White_Snake 05-25-2009 11:56 PM

minor or equal / greater or equal operators in template
 
hello!

im looking foward to create a mod for my forum

i want people to have custom ranks based on their gender, and the custom ranks to grow from their postcount like the default ranking system works

so im aware i need the post variable and lots of if/else cases but, to be honest im not sure where to begin, so far i have tried to write the code on a hook in postbit_complete and imput the variable in the postbit template but it doesnt seems to work, thanks for your help!

Dismounted 05-26-2009 07:01 AM

You can use them in the same way you do in PHP.
Code:

<if condition="$var1 < 2">
<if condition="$var1 =< 2">
<if condition="$var1 == 2">


White_Snake 05-26-2009 02:24 PM

Quote:

Originally Posted by Dismounted (Post 1817328)
You can use them in the same way you do in PHP.
Code:

<if condition="$var1 < 2">
<if condition="$var1 =< 2">
<if condition="$var1 == 2">


that's a new one for me! thanks a lot for your reply :D

--------------- Added [DATE]1243358250[/DATE] at [TIME]1243358250[/TIME] ---------------

Quote:

Originally Posted by Dismounted (Post 1817328)
You can use them in the same way you do in PHP.
Code:

<if condition="$var1 < 2">
<if condition="$var1 =< 2">
<if condition="$var1 == 2">


nevermind, disregard my last post, i tried to make it work and its not working

PHP Code:

<if condition="$post[posts] < 2">
my rank is 1 </if>

<if 
condition="$post[posts] =< 20">
my rank is 2 </if>

<if 
condition="$post[posts] =< 30">
my rank is 3 </if> 


Dismounted 05-27-2009 07:20 AM

I'm assuming you want to add something to postbit - you can just use the user ranks feature for that.

Also, the "posts" number is formatted (e.g. 1,000 instead of 1000) and will fail in number comparisons.

White_Snake 06-02-2009 08:07 PM

Quote:

Originally Posted by Dismounted (Post 1817934)
I'm assuming you want to add something to postbit - you can just use the user ranks feature for that.

Also, the "posts" number is formatted (e.g. 1,000 instead of 1000) and will fail in number comparisons.

how do i get the number raw instead? without format to use them in the template, and what im trying to do, is to generate the ranks based on the members gender, for example, when the male users reaches 500 posts their rank becomes "prince" and when the female users reaches 500 posts their rank become "princess" and on untill they reach king/queen, emperor/emperess

Dismounted 06-03-2009 06:23 AM

You can't get the number raw without using plugins. What you can do is setup a rank, and use conditionals on that rank's content.

White_Snake 06-03-2009 05:40 PM

Quote:

Originally Posted by Dismounted (Post 1822589)
You can't get the number raw without using plugins. What you can do is setup a rank, and use conditionals on that rank's content.

alright, thanks for your patience so far <: i appreciate it!

now i been trying to add the plugin as requested, i suppose i need to find the variable vbulletin uses to extract the userposts from the table and make a new variable with the stripped commas from the userposts, what i have tried so far is this:

plugin: showthread_postbit_create
$rawpost = str_replace(",", "", $bbuserinfo[posts]);

im not sure if i have to se $bbuserinfo[post] or the variable $post that appears in showthread.php

as well i suppose i need to find a way to fit $rawpost in either the global vbulletin array or in the $post[] array that the template uses

thanks again for your time and patience :D

Dismounted 06-04-2009 05:48 AM

postbit_display_start
PHP Code:

if (!empty($this->post['userid']))
{
    
$rawposts $this->post['posts'];
}
else
{
    
$rawposts 0;



White_Snake 06-04-2009 07:36 PM

Quote:

Originally Posted by Dismounted (Post 1823161)
postbit_display_start
PHP Code:

if (!empty($this->post['userid']))
{
    
$rawposts $this->post['posts'];
}
else
{
    
$rawposts 0;



worked like magic!

thanks a lot! you have helped me a lot and at the same time i have realized i have a LONG LONG LONG road ahead to cross in this little vbulletin modification world; thanks again!


All times are GMT. The time now is 10:54 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.01967 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_php_printable
  • (5)bbcode_quote_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