Today I was helping a user to use modification to MyBB (username style formatting modification) and I Noticed he was have warning with the format_name function.
when it formats a guest it gives a message for each missing argument.
should "" be passed instead of not passing any argument?
I told him to pass "" for each missing argument and it fixed the problem.
The first two arguments for format_name() are not optional, so you should always specify them. For a guest, just pass the name and the guest usergroup ID (1).
Yes, it was PHP 5.2.6. Just checked.
ok thanks. I know the first 2 args are needed, I was talking about the 3rd one
I just looked at
your modification, and it seems that you replaced MyBB's format_name() function with your own...
This is the default (MyBB 1.4.1) function prototype:
function format_name($username, $usergroup, $displaygroup="")
And this is yours:
function format_name($username, $usergroup, $displaygroup="", $pformat, $aformat)
You shouldn't have non-optional arguments after an optional one.
http://php.net/functions.arguments
Yes on version 0.2 (I did not posted it yet) I have my new 2 arguments before the $displaygroup argument.
thanks
I am still new to PHP. It's easier to understand it because I know C and lots of things are similar. But there are still lots of things that I don't know of course.