Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorinfexd
    • CommentTimeJul 15th 2007
     # 1
    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.
  1.  # 2
    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?
    • CommentAuthorGrahack
    • CommentTimeJul 15th 2007
     # 3
    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.
    • CommentAuthorinfexd
    • CommentTimeJul 15th 2007
     # 4
    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.
    •  
      CommentAuthorWanderer
    • CommentTimeJul 15th 2007
     # 5
    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

  2.  # 6
    Theyre talking about other peoples nicknames, wanderer.
    • CommentAuthorinfexd
    • CommentTimeJul 15th 2007 edited
     # 7
    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);
    }
    •  
      CommentAuthor[-Stash-]
    • CommentTimeJul 16th 2007 edited
     # 8
    infexd, the "Html" formatter option, <code></code> tags and the edit button are your friends :)
Add your comments
    Username Password
  • Format comments as