Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Selecting multiple categories?

This discussion is related to the Chosen Category addon.

Would it be possible to select multiple categories? Meaning that the new post would duplicate itself within all the selected categories?

Comments

  • KasperKasper Scholar of the Bits Copenhagen Vanilla Staff

    It would probably be possible yes, but I'm no backend-guru I'm afraid :-)

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • GaryFunkGaryFunk Senior Application Developer ✭✭

    I have the SQL code to do such, but someone else would have to wrap that code in PHP.

  • businessdadbusinessdad Stealth contributor MVP

    @peripatew, @kasperisager It seems that selecting multiple categories could be more complicated that I thought. There are some aspects to cover, for it to work:

    • Vanilla's Gdn_Form class, apparently, doesn't support multi-select elements. It can render and handle a drop down list, but it doesn't interpret the "multiple" attribute. I tried to see what happened when I forced the select to become a multiselect, and, when I saved the data, only one value, of all the ones I selected, was returned.
    • The methods that save a Discussion expect only one Category. To save to multiple Categories, such methods would have to be invoked multiple times, as if User actually saved them separately.
    • Save operation should be atomic. That means that the Discussion should be saved successfully to all Categories, or to none of them. This should be doable by using transactions, although I haven't experimented with them in Vanilla, yet.

    It's surely doable, but it can take quite a bit time to avoid all the pitfalls and do proper testing.

    Kasper
  • Vanilla has a strict hierarchical approach to categories, and one category per discussion, and thus, if you want more than one, then you have save more than one discussion.

    Such an approach is largely outmoded. Tagging is a much better approach being non-heriacial reference. This doesn't have the problem of having separate discussions.

    grep is your friend.

    Kasper
  • businessdadbusinessdad Stealth contributor MVP

    @x00 said:
    Vanilla has a strict hierarchical approach to categories, and one category per discussion, and thus, if you want more than one, then you have save more than one discussion.

    Such an approach is largely outmoded. Tagging is a much better approach being non-heriacial reference. This doesn't have the problem of having separate discussions.

    Tagging is also a good option, to avoid duplicates.

    In reference to @peripatew requirements, having multiple discussions would actually be a good solution. He just needs being able to post the same discussions (in his case, Assignments) to multiple, isolated groups (Categories) and keep comments attached to each separate entity. He was just looking for a solution that would not require creating each discussion/assignment by hand.

  • sure though sometime people don't think of all the consequences. duplication is bad SEO, it also quite messy having two separate threads.

    it would be better to mark a main category, then have a 301 redirect, so it is kept all together.

    grep is your friend.

  • businessdadbusinessdad Stealth contributor MVP

    x00

    @x00 said:

    sure though sometime people don't think of all the consequences. duplication is bad SEO, it also quite messy having two separate threads.

    That's also true. In the specific case of @peripatew, I don't think SEO would be of any importance, though (he is building a portal for his students, which I don't think it needs to be promoted via SEO).

  • ok just checking.

    grep is your friend.

Sign In or Register to comment.