Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Making names in posts link to profiles?

edited July 2007 in Vanilla 1.0 Help
I'm curious about having nicknames mentioned in a post link to their relevant profile. Does anything like this exist? If not, anyone interested in making it or getting me on my way> I'm comfortable with PHP but the Vanilla extension system confuses me.. no idea where to start. Could use a tag i'm presuming, to save every word of every post having to be parsed to see if it's a nick.. maybe putting something on either side of it like BBcode works, or just #nick# or something. Then again ideally it should do it automatically so that even if people don't know or use the tags and type someones nickname, it still links.

Comments

  • But if you were talking about a Mark, but it links to Marks profile and you totally wasn't talking about THAT Mark. You'd confuse people, why would you do that?
  • You could use a kind of escape character (like /grahack or /infexd).
    Your extension would basically be a Formatter. Have a look at this page and especially this one.
  • Good point Chris. Maybe a basic "escape character" then as grahack says.. I just didn't want to do it with full tags as lots of people wouldn't bother using them. Something like /infexd or *infexd would be good though. Checking out those links now grahack.
  • I always thought /me worked?
    Nope, I'm sure I've used it in the past though.

    Posted: Monday, 16 July 2007 at 9:54AM

  • Theyre talking about other peoples nicknames, wanderer.
  • edited July 2007
    I'm sure the ExtendedTextFormatter could be adapted so that it not only replaces "/ me" (space to stop it doing it here) with a self-profile-link but also replaces /[anyword] by just querying the database for that nickname's account ID and linking to the profile that way?

    I tried pulling this out to make it work just as a "/ me" replace to get started but it won't work.. ? My plan is to get this working as a standalone "/ me" replacer, without the link parser etc that was in this extension, and then add in from there some code to work for "/nickname"..


    if (in_array($Context->SelfUrl, array("comments.php", "post.php"))) { // An implementation of the string filter interface for plain text strings class ProfileLinker extends StringFormatter { function Parse ($String, $Object, $FormatPurpose) { $sReturn = $String; // Only format plain text strings if they are being displayed (save in database as is) if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) { $sReturn = preg_replace("/\/\bme\b/", $this->GetAccountLink($Object), $sReturn); } return $sReturn; } function GetAccountLink($Object) { if (isset($Object->AuthUserID) && $Object->AuthUserID != "" && isset($Object->AuthUsername) && $Object->AuthUsername != "") { return '<a href="'.GetUrl($Object->Context->Configuration, 'account.php', '', 'u', $Object->AuthUserID).'">'.$Object->AuthUsername.'</a>'; } else { return '/ me'; //space in source so it doesn't parse on lussomo forums } } } $ProfileLinker = $Context->ObjectFactory->NewObject($Context, "ProfileLinker"); $Context->StringManipulator->Formatters[$Configuration["DEFAULT_FORMAT_TYPE"]]->AddChildFormatter($ProfileLinker); }
  • StashStash
    edited July 2007
    infexd, the "Html" formatter option, <code></code> tags and the edit button are your friends :)
This discussion has been closed.