The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Userid into an interval
Working on a code for a clan website which would assign each member a service number, even though this should be simple, I simply cannot get it to work. The plan was originally to take the user's id number, and simply add that to 0000 (thus getting a 4 digit number, such as 0123). Issue is, that I can't seem to get it convert to an integer so I can add it (and all attempts wind up echoing "4 + 0000" or something of the like). So, want to know how I could convert the user id to an integer so I can pull this off, or a code to get this to work.
Any help would be greatly appreciated. /n00b question |
#2
|
||||
|
||||
There's probably a better way but you could...
Use if statements to check if the UserID is < 10, <100, <1000 and if it is less then 10 day make a new string say $userstring = "000" . $userid if it's less than 100 $userstring = "00" . $userid if less than 1000 $userstring = "0" . $userid else $usserstring = $userid |
#3
|
|||
|
|||
PHP Code:
Brain dead at the moment apparently, doesn't help I haven't done anything dealing with php in years. lol |
#4
|
||||
|
||||
That looks right if the userid is in $userid, which I don't think it is- I think it's: $vbulletin->userinfo['userid'] , I was just using $userid as an example.
No wait that isn't right... hold on... PHP Code:
also, seems like I should point this out.... 9,999 isn't all that many userid's, if the forum ever becomes halfway popular you might easily exceed 4 digit userid's even if due only to spammers who sign up... I would seriously suggest using at least 5 if not 6 characters for this to give you some room to grow. |
#5
|
|||
|
|||
Quote:
--------------- Added [DATE]1283033226[/DATE] at [TIME]1283033226[/TIME] --------------- Weird, it's still not showing up. :/ I added it to the functions.php, and it wouldn't work, along with moving it to the functions user file, but to no avail. I truly have no clue what is going on. -.- |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|