Skip to:
Content
Pages
Categories
Search
Top
Bottom

Titles for topic replies?


  • LMD
    Participant

    @louisedade

    Hi,

    Is it possible to have a ‘title’ field for replies to topics? My forum users are used to crafting clever titles in their replies.

    I could probably make it a plugin, but it would mean changing the database – unless there is an easier way?

Viewing 11 replies - 1 through 11 (of 11 total)

  • Trent Adams
    Member

    @trent

    It would be great if you could create a plugin for it and then mdawaffe can look at it and decide if it is something needed for the core. That way, if it isn’t, you will have it and there are many users that would most likely love to see this as well!

    Trent


    LMD
    Participant

    @louisedade

    Well, I got it working, but it uses a hack rather than a plugin. It wasn’t too hard, I guess I could document the hack until such time as I work out how to make it a plugin.

    The thing I don’t quite ‘get’ yet (not having made a plugin for either WordPress or bbPress before) is how to modify the behaviour of an existing function. If I write my own version of a function, will it overwrite the existing function?


    fel64
    Member

    @fel64

    You should use hooks to make it automatically call your function when that hook is called – the syntax is something like add_action('hook name', 'function name') if I recall correctly. Look at existing plugins for details of how to do it.

    There isn’t a reference for hooks that I’m aware of, sorry.


    macwise
    Member

    @macwise

    fel64,

    When you mention the “Hooks”, are you referring to the lines at the bottom that say “add_filter”? I think this is what you mean, but I thought I’d make sure. It’s time to try out my first plugin! :)


    fel64
    Member

    @fel64

    Err … probably! In WordPress you have both hooks and filters, where hooks are there to add actions and filters to change the data going to and leaving the database (like your post – adding stuff to links etc), but they’re almost identical. Never used this in bbPress.


    LMD
    Participant

    @louisedade

    Ahhh, pieces fall into place! I’m using the ‘path-to-url’ fix plugin and see that it uses the following filter to replace the ‘ bb_path_to_url’ function:

    add_filter( ‘bb_path_to_url’, ‘fix_bb_path_to_url’, 1, -1 );

    So that is the syntax I’m looking for (obviously replacing the functions I need).

    Looking at the ‘add_filter’ function, I can work out that ‘1’ sets the priority and ‘-1’ is a boolean flag indicating whether the new function accepts arguments.

    Would I be right in saying that by setting the new function to a priority of ‘1’ means it overwrites the old function?

    If so, then does setting it with a lower priority (e.g. ‘2’) makes it run after the old function and before any other functions, as if extending the function?

    Just had to edit this post, which gives me another idea: a ‘Preview’ button! Maybe ‘preview in place’ using the DOM, like some WP comments sections.


    fel64
    Member

    @fel64

    Judging by the wordpress system (the documentation is quite good), 10 is default priority and plugins are executed in order of descending priority (so a plugin of 1 comes before 2). In WP the last two arguments are optional.

    Preview sounds good – but better yet would be an AJAX thing that means you don’t even have to reload the page when you post. :D


    LMD
    Participant

    @louisedade

    I’ve managed to create a plugin that adds titles to replies – and documented it. The plugin is available for download from my website:

    http://www.classical-webdesigns.co.uk/articles/36_bbpress-plugin-add-titles-to-replies.html

    Comments and suggestions are welcome.

    One other thing, re:

    “Preview sounds good – but better yet would be an AJAX thing that means you don’t even have to reload the page when you post. :D

    That’s what I meant by using the DOM. In fact there would be no need for AJAX even – by using the javascript DOM you can ‘preview in place’ the post you are currently working on. If users do not have javascript enabled, then graceful degradation would mean that a button to view the preview on a separate page would be visible.


    LMD
    Participant

    @louisedade

    Oops, I’m a plonker – I forgot to include the ability to edit the title in ‘Edit Post’ . If anybody spotted it, don’t worry, I’ll fix that today.


    Trent Adams
    Member

    @trent

    Sounds good! When you get this fixed up, create a new entry with a title like “Plugin: Topic Reply Titles” or something like that so that people know where to find it and maybe think about going over to the ‘Extend” tab and adding it to the plugin repository!

    Trent


    LMD
    Participant

    @louisedade

    Add Titles to Replies plugin version 0.2 now available.

    CHANGELOG

    * 2007-03-11 ver. 0.2 enabled the title to be edited in “Edit Post” + template changes.

    * 2007-03-10 ver. 0.1 relased

    Edit: just seen Trent’s post – will see about adding it to repositry.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.
Skip to toolbar