![]() |
Converting username text to url
I created a function I was wondering if I could have someone look it over. It pretty much takes the text in a post and looks for a username, and if there is one, it will mark it up as url and usergroup color. Anyway heres the code.
PHP Code:
|
That will potentially fail miserably on a forum with a lot of users. There is really no practical way to do this on a large scale.
|
Is there anyway to do this by using a bbcode?
|
You could create bbcode for your users to use:
HTML Code:
<a href="/forums/member.php?username={param}">{param}</a> |
Also any chance that would be able to mark it up to the usergroup color? :)
|
What I wrote is just a simple bbcode to do the username. If you want the usergroup color, you'd have to write some actual code to get it.
|
just one more question.... to do the color, the code I would create, would I put the code in the replacement box or would I have to create a function or hook? I know you can only use html in the replacement box so I guess I couldn't use any variables correct?
Sorry im a noob. I just don't know how the whole bbcode replacement box works for vbulletin. |
You would have to write a plugin, I believe. I've never done anything with the bbcode, so I'm not exactly sure how you would go about it. I've seen threads here about it though, so just do a search and you should find some info.
|
Please tell me I'm close:
PHP Code:
Keep getting this in my shoutbox: Code:
Parse error: parse error, unexpected $end in W:\Forums\includes\class_bbcode.php(360) : eval()'d code on line 33 PHP Code:
|
I don't know if it's correct or not, but I do see that you have three beginning and two end parenthesis in the first code box you posted and that will cause an error (they don't add up correctly).
|
There are a couple of other threads talking about implementing BB codes via PHP - I have previously posted in them with examples.
|
Dismounted I saw some of your post like you said including this
Anyway this is what I have so far. Dropped into "bbcode_create" PHP Code:
PHP Code:
EDIT***** PHP Code:
Quote:
EDIT********** Quote:
|
Remember that you are in function scope, and therefore, variables such as $vbulletin and $db will not exist - unless allowed to exist through the global keyword. Also, you may want to use query_first(), which will automatically fetch the first result and place it is an associative array.
|
|
All times are GMT. The time now is 07:23 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|