Hard Light Productions Forums

Site Management => Site Support / Feedback => Topic started by: Iss Mneur on June 04, 2010, 12:05:17 pm

Title: Quotes with arbitrary links in them
Post by: Iss Mneur on June 04, 2010, 12:05:17 pm
Why doesn't the forum support bb code like this:

Quote from: SMF Documentation link=http://docs.simplemachines.org/index.php?topic=57.0
Code: [Select]
[quote=SMF Documentation link=http://docs.simplemachines.org/index.php?topic=57.0][/quote]

That is, why doesn't the url actually auto-link like when you "quote" someone in the forum?  According to the docs it is supposed to work that way.

EDIT:Fixed typo in title.
Title: Re: Quotes with arbitray links in them
Post by: jr2 on June 04, 2010, 12:40:58 pm
This works as a stopgap in the meantime: (but yeah I'd like to be able to do that too)

Quote from: http://docs.simplemachines.org/index.php?topic=57.0

Code: [Select]
[quote author=http://docs.simplemachines.org/index.php?topic=57.0][/quote]
Title: Re: Quotes with arbitrary links in them
Post by: Fury on June 05, 2010, 02:08:02 am
Just do it the way jr2 did.
Quote from: http://docs.simplemachines.org/index.php?topic=57.0
blahblah

If it doesn't work like the SMF docs says, there are few possibilities:
1) The docs have been updated for SMF 2.0
2) The docs have incorrect syntax
3) The feature is broken
4) The feature doesn't exist

In any case, nothing I can do about it unless I add it by hand. Which I do not consider worth it, since you can use above example.
Title: Re: Quotes with arbitrary links in them
Post by: Goober5000 on June 08, 2010, 01:50:43 pm
Here's the code from our forum.  It appears to be implemented, but that PHP is too dense for me to parse:

Code: [Select]
array(
'tag' => 'quote',
'parameters' => array(
'author' => array('match' => '([^<>]{1,192}?)'),
'link' => array('match' => '(?:board=\d+;)?((?:topic|threadid)=[\dmsg#\./]{1,40}(?:;start=[\dmsg#\./]{1,40})?|action=profile;u=\d+)'),
'date' => array('match' => '(\d+)', 'validate' => 'timeformat'),
),
'before' => '<div class="quoteheader"><a href="' . $scripturl . '?{link}">' . $txt['smf239'] . ': {author} ' . $txt[176] . ' {date}</a></div><div class="quote">',
'after' => '</div>',
'block_level' => true,
),

This is the only occurrence of "link" in the quote tag.  It's possible that it's only implemented if you quote another person's post.
Title: Re: Quotes with arbitrary links in them
Post by: Iss Mneur on June 08, 2010, 04:06:20 pm
[snip]

This is the only occurrence of "link" in the quote tag.  It's possible that it's only implemented if you quote another person's post.

Thats exactly what that code says it does (which is also what I have found during experimentation). The only interesting thing about that snippet is that apparently you can use threadid in place of topic in the link parameter.

Oh well, I thought maybe I was doing it wrong, as jr2's workaround will work. But, nevertheless it would nice to be able to name the author in the standard quote header as well as link it to some site as,
Quote from: Some Place
Code: [Select]
[quote author=Some Place][/quote] works, but when you combine them it does not.

Anyway, I guess that solves that.
Title: Re: Quotes with arbitrary links in them
Post by: Goober5000 on June 08, 2010, 11:49:06 pm
Well, not necessarily.  There are no fewer than four separate implementations of the quote tag.  If someone could figure out the PHP to add a user-specified link, we might be able to add it.

In fact I could probably figure it out myself, but I don't have time at the moment.  Somebody bug me later, if code isn't provided before then.
Title: Re: Quotes with arbitrary links in them
Post by: Fury on June 08, 2010, 11:59:12 pm
I honestly wouldn't want to bother with yet another customization to be re-added after forum upgrade. If anything, it should be brought up in the actual SMF forums and fixed there.
Title: Re: Quotes with arbitrary links in them
Post by: Iss Mneur on June 09, 2010, 10:34:31 am
I honestly wouldn't want to bother with yet another customization to be re-added after forum upgrade. If anything, it should be brought up in the actual SMF forums and fixed there.

Ya, I can understand that, but it seems that there is no need as the forum already supports a version that actually does what we need if not quite as intuitivly as I expected.


But based on Goober5000's comment, I figure we couldn't be the first to try and do this. I  checked the source code of the version 2.0 RC that SMF has on their site and it seems that
Code: [Select]
[quote author=Name link=http://example.com]Test[/quote] is still not supported by SMF even though the bbcode reference on thier site says so.

Because the new 2.0 forum software doesn't support, I started looking at the modifications that SMF has available on their site and I found Quote Source Mode (http://custom.simplemachines.org/mods/index.php?mod=1631) which adds the exact code needed to do what I was looking for with the quote using author and link.  The other interesting thing that I found on the page though is this lovely snippet:
Quote from: [url=http://custom.simplemachines.org/mods/index.php?mod=1631]Quote Source Mod[/url]
Code: [Select]
[quote="[url=http://somesite.com]Name[/url]"]Quoted Text[/quote]
which does exactly what I want, even though it is not the expected answer, it obviously works, even on our current build.

So, I guess we now have a solution and nothing needs to be changed except for the documentation.
Title: Re: Quotes with arbitrary links in them
Post by: jr2 on June 09, 2010, 02:35:38 pm
Is there any way to have the PHP or w/e it is do a word/code replacement?  Sort of how the word alot (alot) gets replaced?
Title: Re: Quotes with arbitrary links in them
Post by: Iss Mneur on June 09, 2010, 03:25:55 pm
Is there any way to have the PHP or w/e it is do a word/code replacement?  Sort of how the word alot (alot) gets replaced?
What is it you want replaced?

But either way it would require more modification to the forum software.
Title: Re: Quotes with arbitrary links in them
Post by: jr2 on June 11, 2010, 08:34:31 am

Code: [Select]
[quote author=Name link=http://somesite.com.com]Name[/quote]
Whenever you have the above, replace it with:

Code: [Select]
[quote="[url=http://somesite.com]Name[/url]"]Quoted Text[/quote]
Title: Re: Quotes with arbitrary links in them
Post by: Iss Mneur on June 11, 2010, 11:02:41 am

Code: [Select]
[quote author=Name link=http://somesite.com.com]Name[/quote]
Whenever you have the above, replace it with:

Code: [Select]
[quote="[url=http://somesite.com]Name[/url]"]Quoted Text[/quote]
Oh, I see.

If we are going to do that, we may as well just add the "Source Quote Mod" directly, rather than have the forum software do a convoluted post source text transformation, that has the same result.  As either would require modification to the forum software, on which topic Fury has already stated:
I honestly wouldn't want to bother with yet another customization to be re-added after forum upgrade. If anything, it should be brought up in the actual SMF forums and fixed there.

So I doubt that either would happen.  Having said that, I too would like the that to be able to the the quote tag like the "Source Quote Mod" advertises (as it is far more intuitive).