HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

AddOn-Request: "Insert on Topic-ID"

phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP
edited August 2014 in General Banter

Hi all,

I'm looking for a developer who would like to create an AddOn for Vanilla 2.0 and 2.1.
The Plugin allows adding an "Insert" above the first reply of a discussion.
This could be a linked picture or, any HMTL-formatted code or a simple text.

I will sponsor the AddOn and it should be released to the community and the repository as OS.

-
Why a plugin like that?
Some discussions in a forum rank high in search engines. I'd like to adress visitors who come to the forum with an image, a banner or just text that informs them about... anything.
Imagine you have a forum about cars and one of the threads deals with "Finding a cheap car in Kuala Lumpur?". Let's say this thread ranks very high in search engines and a lot of visitors are coming to your forum through this thread.

With an "Insert" you could specifically adress those visitors with an interesting invitation to register ("Register and ask your question about better options for cars in Kuala Lumpur. Our community is very helpful...") or link to 3 other threads ("Check out these discussions as well: ...").

A plugin like that would allow (in combination with your Analytics or Vanilla Top Thread statistics) to gain more individual access to your visitors of those threads. Adress them with a better message to convert to registration or make a deal with an online-shop with a good conversion rate, etc.

-
How it could work in the backend?
The Admin of a forum should see an navigational point in the left panel saying "Insert on Topic-ID". This will lead you to a list of all your inserts. There it should be allowed to add infinite (or at least 99) "inserts" by a + (plus) icon, that will take you to another page to create the "Insert".

An "Insert" consists of two textareas and a Topic-ID field. The Topic-ID field allows to insert the topic ID of the discussions that should feature the "Insert", the two textareas represent the insert for the desktop and the mobile version of the forum. Another input field for a "Insert-Title" would be good to manage them in the list. Last but not least a SAVE-Button.

After hitting save the "Insert" is shown on the list site and allows options like "Edit", "Delete" and and option for "Visible/Invisible".

-
What could be featured in the future?
For some Vanilla users it might be interesting to add the "Insert" not only after the first post. So maybe an additional "Offset" and a "Page" field might be interesting to them. It would allow adding the "Insert" after a defined number of posts and/or on all or only one page ("0" could be added on all pages, while "2" just says on page 2).

For now i haven't thought any further, but it would be great if you take up here and bring your ideas or you like to step in for development. Payment i'd like to discuss this with the specific developer in a private thread. Surely other donators can jump in. I'd be happy to choose one of the DEVs that are in the forum regulary (you peeps know) and are famous and loved for their contributions.

Greetz,
phreak

  • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
  • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
Tagged:

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Not sure if I am famous and loved but I would be happy to work with you on developing this idea.

    I would provide a similar interface as my Category Ads plugin (management of all Inserts in the backend) while also offering quick edit points in the front end (flyout menu with 'Add/Edit/Delete/Hide Insert' options).

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP
    edited August 2014

    Hui yeah, i definitely say you fall into that category.

    "Quick edit points" in the front end are a good idea in that sense. Let's take that with us.

    • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
    • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
  • businessdadbusinessdad Stealth contributor MVP

    Much simpler idea: allow the reply to be posted as any other comment, and simply add a "add on top of replies" flag. No lists, additional interfaces or limitations, simply go to the discussion and post. Done. :)

  • businessdadbusinessdad Stealth contributor MVP
    edited August 2014

    Instructions for the MVP. I already used the logic below, with the exception of sorting, in my Post Scheduler plugin (shameless link to the product), and it works well. Lean and simple, like a good steak.

    1. Add an ordering field to comments table

    /**
     * Alters Comment table, adding fields required by the "InsertComment" plugin.
     */
    protected function alter_comment_table(){
        Gdn::Structure()
            ->Table('Comment')
            ->Column('SortOrder', 'int', 100) // Set default to 100 to allow for more flexible ordering, if needed
            ->Set(false, false);
    }
    

    2. Sort comments by "sort order"

    /**
     * Sort the comments by sort order.
     * @param CommentModel $CommentModel
     */
    public function CommentModel_AfterConstruct_Handler($CommentModel) {
        $CommentModel->OrderBy('c.SortOrder');
    }
    

    3. Add "insert comment on top" checkbox

    /**
     * If User is authorised to insert comments at the top of discussions, adds the HTML controls
     * required to do it to the "post comment" form.
     *
     * @param Gdn_Controller Sender Sending controller instance.
     */
    public function PostController_AfterCommentTabs_Handler($Sender) {
        // Plugins.InsertComment.CanInsertComment is a hypotetical permission to 
        // check that user can insert a comment at the top
        if(Gdn::Session()->CheckPermission('Plugins.InsertComment.CanInsertComment')) {
            // Render the UI with the checkbox, or other controls, to specify that the
            // comment should be posted at the top of the discussion
            $this->RenderInsertCommentUI(); // To be implemented
        }
    }
    

    4. Handle saving of "inserted" comments

    /**
     * Sets the sort order for a comment, pushing the "inserted" ones to the top.
     *
     * @param Controller Sender Sending controller instance.
     */
    public function CommentModel_BeforeSaveComment_Handler($Sender) {
        $FormPostValues = &$Sender->EventArguments['FormPostValues'];
        // Default sort order is 100 so that all "normal" comments have the same value
        // TODO: replace horrible magic number with constant
        $FormPostValues['SortOrder'] = 100;
    
        // If User is trying to insert a comment, check that he has the permission to do so
        // "InsertAtTop" is the hypothetical name of the field that was added by 
        // RenderInsertCommentUI() method
        if(isset($FormPostValues['InsertAtTop']) && (bool)$FormPostValues['InsertAtTop'] && Gdn::Session()->CheckPermission('Plugins.InsertComment.CanInsertComment')) {
            // Setting sort order to 1 will make the comment appear at the top of the list
            // TODO: replace horrible magic number with constant
            $FormPostValues['SortOrder'] = 1;
        }
    }
    
  • businessdadbusinessdad Stealth contributor MVP

    Where do I send the invoice? :D

  • phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP
    edited August 2014

    Hi businessdad,

    Thats truly a really good catch but from what i understood this will not cover that moderator levels who are allowed to edit posts will access those posts... also managing the Inserts in a list in the Vanilla backend would be very important for forgettable Admins like me. ;)

    Both i think speaks for the mechanic i outlined... or not?

    Edit: Also there speak Pro's and Con's for software like Tapatalk hooking into Vanilla.

    • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
    • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
  • businessdadbusinessdad Stealth contributor MVP

    @phreak said:
    Hi businessdad,

    Thats truly a really good catch but from what i understood this will not cover that moderator levels who are allowed to edit posts will access those posts...

    If moderators are "allowed to edit posts", then they are allowed to edit the inserted one as well. If not, then they are "allowed to edit posts except the inserted ones", and it would just be a matter of adding a permission check.

    also managing the Inserts in a list in the Vanilla backend would be very important for forgettable Admins like me. ;)

    I still think it would be a superfluous UI (after all, I don't remember seeing an Admin UI specifically for announcements, which are also special posts), but it can easily be generated by fetching the inserted posts, which can be identified by their special sort order.

    Edit: Also there speak Pro's and Con's for software like Tapatalk hooking into Vanilla.

    Not sure what this means, actually.

  • hgtonighthgtonight ∞ · New Moderator

    @businessdad said:
    I still think it would be a superfluous UI (after all, I don't remember seeing an Admin UI specifically for announcements, which are also special posts), but it can easily be generated by fetching the inserted posts, which can be identified by their special sort order.

    I am thinking this is more like a specialized Message which has a dashboard interface.

    Perhaps modifying the message interface to include specific discussion slots would make more sense.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • businessdadbusinessdad Stealth contributor MVP

    @hgtonight said:
    I am thinking this is more like a specialized Message which has a dashboard interface.
    Perhaps modifying the message interface to include specific discussion slots would make more sense.

    To me, it would still be a "nice to have", to be added at a later stage, but not a vital feature.

  • hgtonighthgtonight ∞ · New Moderator

    @businessdad said:
    To me, it would still be a "nice to have", to be added at a later stage, but not a vital feature.

    Hooking into /dashboard/message would be just as difficult as hooking into the comment model, no?

    I guess it comes down to whether or not this feature should be done on the front-end versus the back-end of the forum?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • businessdadbusinessdad Stealth contributor MVP
    edited August 2014

    @hgtonight said:
    Hooking into /dashboard/message would be just as difficult as hooking into the comment model, no?

    Not really. We are talking about "injecting" a special comment in a discussion, therefore reusing the same UI and classes makes sense.

    Further confirmation of this (from specifications):

    The Plugin allows adding an "Insert" above the first reply of a discussion. This could be a linked picture or, any HMTL-formatted code or a simple text.

    That is, an HTML comment.

    The messages created in /dashboard/message have another purpose, and they are displayed in another location, I don't see the point in trying to use them in a different way.

  • hgtonighthgtonight ∞ · New Moderator

    Fair enough, I just read the spec differently I suppose. :)

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • businessdadbusinessdad Stealth contributor MVP
    edited August 2014

    @hgtonight said:
    Fair enough, I just read the spec differently I suppose. :)

    As they say, there are many ways to skin a cat. My approach, based on my experience, is to avoid coding whenever it's possible, reusing whatever is already in place to its maximum extent, with a bit of creativity.

    Since the "insert" is going to be part of a discussion, it makes sense to me that it's just a special comment, as that allows to get most of the features without much effort:

    • A comment can easily be added at the top of the list (sort field).
    • A comment can be added/deleted. Only "show/hide" has to be added.
    • A comment can contain all the required content types (html, text, images).
    • There is already a full UI in place for comments.
    • It's easy for any Admin to go to the discussion where the "insert" has to be placed and just post a special comment. No separate interface, just keep using what you are familiar with.
    • No limits to the amount of "insert" posts in a discussion.

    All the above is already covered by the code snippets I posted. If a special Admin UI is needed to find these special comments, it can easily be added. The Edit will simply bring to the "edit comment" UI on the discussion (no coding needed), same for the delete.

    I think this would be much simpler than using messages, which were designed for another purpose.

Sign In or Register to comment.