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.
Options

Latest Discussions Prime

PolPol
edited February 2009 in Vanilla 1.0 Help
Latest Discussions Prime extension

Hi. I'm new to Vanilla, and I've been experimenting with customizing my installation. I wanted to install the Latest Discussions extension, but I noticed that it wasn't generating friendly URLs (which I had enabled -- I am an aesthetics/consistency freak :D), so I took a look at the code, and found that it was quite poorly written indeed. It was actually making its own MySQL connection, querying for a list of topics, and manually generating links to comments.php. (Plus the code had no indentation and almost no spaces, so it was very hard to read.) Latest Discussions Prime is my attempt at rewriting it to better use Vanilla's API. (It also extends the original functionality slightly, by displaying the time since the last comment in each discussion.)

In this version, the number of discussions listed is hardcoded (10). It's easy to change if you look at the source, but if I revise this extension, I'll probably add that as a user preference.

If anyone has any comments about the functionality or especially about my code (since this is my first extension), I'd appreciate it!
«13

Comments

  • Options
    I think you'll find the no indentation and spaces thing is possibly to do with your text editor - if i open any extensions i download in notepad it's impossible to read and i have to switch to wordpad which is fine. It's not nice to bash other peoples code but bravo for doing something about it :)
  • Options
    I didn't mean to bash, I'm just a bit obsessed with certain aesthetic standards. And consistency and abstraction. So I was really just doing this for myself. :)

    As for the indentation thing, I don't think it's my text editor. Other source files look fine.

    (By the way, to any of the three people who have downloaded version 1.0 of this extension -- please redownload it, now version 1.0.1, as I made a couple of slight bugfixes.)
  • Options
    edited November 2006
    @Minisweeper: I also have the same problem with indents and line breaks on my Windows pc when I download stuff. Just downloaded the latest version. I changed the number of topics to 5 so that I could compare it to the Latest Topic extension I also have installed. They show different items. Your prime version shows the 1st 5 discussions as they appear on the Discussion page. The Latest Topic extension shows the last 5 items I made. Also, the code doesn't validate because it has an extra <a >.
  • Options
    What's the point in an extension that displays the latest discussions anyway?
  • Options
    @jimw: Thanks for the comments. I didn't notice that difference (I just have a private test forum, so there aren't a lot of topics to work with), but this way is how I wanted it anyway. I suppose it would be possible to modify this to show the most recently created discussions, but then again, the original Latest Discussions extension works fine for that (even if it is less elegant internally). I didn't notice the <a > thing, because for some reason, my usual web browser refuses to show the HTML source for pages in my Vanilla installation, but I'll look into it. @Minisweeper: I like seeing an overview of the latest talk going on regardless of what page I'm on. But really this was more as practice writing extensions. Just to start getting familiar with the API.
  • Options
    If you fix the <a> and allow me to change the date back to the normal format, I will gladly use your extension.
  • Options
    edited November 2006
    There is a new line after ?>, what should add a new line a the top of any vanilla page. You should take it off.
  • Options
    Nice add-on and nice name! ;)
  • Options
    Great add-on! just great.
  • Options
    @Frozonecold: What do you mean about the date? Do you mean that it should display it in absolute date/time format instead of how long ago? @Dinoboff: Hmm, it's not doing that for me. @Polo & simczak: Thanks! :) I'm about to upload version 1.0.2 which fixes the <a > thing, and also makes the last post time into a clickable link. (The topic link leads to the last read post, while the time leads to the newest post.)
  • Options
    edited November 2006
    It's pretty cool with the date and the clickable links. Problem is, in my opinion, it's a less useful extension than the older one. It orders discussions following their creation and modification date. What I liked with the first extension is it orders discussions using only their creation date. This way, users know what is actually new, and it's even useful on the discussion page.

    It would be great to add an option for this.

    Edit: Looks like it also creates errors with the panel order extension, but it may come from my semi-randomly hacked installation.
  • Options
    Here are the user options I think I'll add: [Checkbox] Show Latest Discussions panel [Option] Sort by: - Latest created discussions - Latest modified discussions [Checkbox] Only show discussions I've posted in I think that should take care of everything. (That last option is one I just thought of; some users might also find it useful.)
  • Options
    The last option is a good idea: with "latest modified discussions" selected, it would act like a kind of new comment notifier.

    That sounds great, I'm looking forward to the next version :)
  • Options
    Ok, I've uploaded version 1.1, which adds these options. (It seems user options can only be true/false values, i.e. checkboxes, so I had to refactor the "sort by" option as such, but it's the same otherwise.) Enjoy! :)
  • Options
    It works like a charm :)

    Good job, Pol!
  • Options
    Err, in fact, I have a problem. Looks like there are some compatibility issues with Preview Post 2.1.

    I get this error when I try to preview a comment:

    Fatal error: Call to a member function on a non-object in ../extensions/LatestDiscusssionsPrime/default.php on line 19
  • Options
    PolPol
    edited November 2006
    Oh, thanks. I have Preview Post 2.1 installed, but somehow that slipped by when I was testing. (More generally, this might have been a compatibility problem with some AJAXy extensions.) I uploaded Latest Discussions Prime 1.1.1, in which I think I've fixed this. As an added bonus, I added a feature where, next to the last-comment time, it says how many comments are new (if any). :)
  • Options
    Great, now it works perfectly. Thanks for this extension :)
  • Options
    Cool. Glad to help.
  • Options
    What I wanted was the option of absolute dates or relative.
Sign In or Register to comment.