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:
function servicenumber($userstring)
{
if ( $vbulletin->userinfo['userid'] < 10) {
$userstring = "000" . $vbulletin->userinfo['userid'];
}
elseif ( $vbulletin->userinfo['userid'] < 100) {
$userstring = "00" . $vbulletin->userinfo['userid'];
}
elseif ( $vbulletin->userinfo['userid']< 1000) {
$userstring = "0" . $vbulletin->userinfo['userid'];
}
else{
$userstring=strval($vbulletin->userinfo['userid']);
}
return $userstring;
}
The last else is needed if you already have a 4 digit id...
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.