UserID tag

Started by NanoSector, February 20, 2011, 02:23:02 PM

Previous topic - Next topic

NanoSector

Can someone move this to Tips and Tricks? Thank you.

The UserID tag allows you to easily link to an user's ID.
Name support soon!

How to install:
Follow these steps:
Find (Subs.php):
array(
'tag' => 'white',
'before' => '<span style="color: white;" class="bbc_color">',
'after' => '</span>',
),


Replace (Subs.php):
array(
'tag' => 'white',
'before' => '<span style="color: white;" class="bbc_color">',
'after' => '</span>',
),
array(
'tag' => 'userid',
'before' => '<a href="' . $scripturl . '?action=profile;u=$1">';
'after' => '</a>';
),

What about using it?
Use it like this:
[userid=251953]My profile[/userid]
Which will replace the need for such a long line as:
[url=http://www.simplemachines.org/community/index.php?action=profile;u=251953]My profile[/url]
Which is extremely handy if you have a very low post size limit.

So... Is this tested?
How dare you ask this! Of course it is.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

QuoteHow dare you ask this! Of course it is.

Did you know you can nest tags inside this one?

What happens if there's a non numeric user id put in the userid tag? What happens if it's a tag itself? Quoted?

NanoSector

Quote from: Arantor on February 20, 2011, 02:32:55 PM
QuoteHow dare you ask this! Of course it is.

Did you know you can nest tags inside this one?

What happens if there's a non numeric user id put in the userid tag? What happens if it's a tag itself? Quoted?
This was just a sketch and I will be improving it.

I just need a way to check if the userid exists.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Then you'll need to use the validate code and query the database (which is a performance issue waiting to happen)

NanoSector

Quote from: Arantor on February 20, 2011, 02:35:05 PM
Then you'll need to use the validate code and query the database (which is a performance issue waiting to happen)
Which is why this is an optional option.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

In which case you still need to declare the validate function to be able to check if the option is set or not.

Right now though I can't encourage this being moved to tips & tricks because it needs more work. Is it intention that it supports nested tags? If not, if memory serves you should set the type to be unparsed_equals.

NanoSector

Quote from: Arantor on February 20, 2011, 02:42:31 PM
In which case you still need to declare the validate function to be able to check if the option is set or not.

Right now though I can't encourage this being moved to tips & tricks because it needs more work. Is it intention that it supports nested tags? If not, if memory serves you should set the type to be unparsed_equals.
Fixed in svn.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

DoctorMalboro

You should read the comment in the Subs.php about BBCodes.

NanoSector

Quote from: DoctorMalboro on February 20, 2011, 03:30:06 PM
You should read the comment in the Subs.php about BBCodes.
QuoteThis is just a sketch

Which means it is made in 1 minute.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

QuoteWhich means it is made in 1 minute.

But you say you tested it, and we all assumed you'd tested it thoroughly...

NanoSector

Quote from: Arantor on February 20, 2011, 05:20:23 PM
QuoteWhich means it is made in 1 minute.

But you say you tested it, and we all assumed you'd tested it thoroughly...
Made is something else then tested.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

But from your FIRST POST:

QuoteSo... Is this tested?
How dare you ask this! Of course it is.

Make your mind up!

NanoSector

Quote from: Arantor on February 21, 2011, 04:26:13 AM
But from your FIRST POST:

QuoteSo... Is this tested?
How dare you ask this! Of course it is.

Make your mind up!
QuoteMade is something different then tested.

Which is my point. Testing took way longer then making.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Argh. So you've posted something that you claim to have tested, but not tested very thoroughly because 'it's just an outline'... why not wait until it was more polished before posting?

NanoSector

Quote from: Arantor on February 21, 2011, 07:11:05 AM
Argh. So you've posted something that you claim to have tested, but not tested very thoroughly because 'it's just an outline'... why not wait until it was more polished before posting?
Because I could not save my progress: shared computer. It would be very dangerous to save it on THAT computer!
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Ah, I see. Hmm, may have been best for a 'coding discussion' topic then, rather than presenting it as a fully ready to go tip & trick.

If only there were support for drafts in SMF core...

NanoSector

Quote from: Arantor on February 21, 2011, 07:16:23 AM
Ah, I see. Hmm, may have been best for a 'coding discussion' topic then, rather than presenting it as a fully ready to go tip & trick.

If only there were support for drafts in SMF core...
It is not fully, I must admit. But it can be used if you do it right.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

DoctorMalboro

you don't share a draft until it's completely finished... no matter how small can it be. It's like doing your homework half and in a dirty paper.

Suki

also there's already a mod for this:  http://custom.simplemachines.org/mods/index.php?mod=1367   that mod covers this and also has support for names.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

NanoSector

Quote from: DoctorMalboro on February 21, 2011, 11:24:44 AM
you don't share a draft until it's completely finished... no matter how small can it be. It's like doing your homework half and in a dirty paper.
Ever used your eyes doctor?

@ above: when I last looked that mod was not there.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Advertisement: