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.

Delete Categories ?

edited April 2006 in Vanilla 1.0 Help
Hello , I d like to know how categories can be deleted, as well as the users ?

Comments

  • to delete categories: go into settings, click category management (in the panel on the left) and click the x next to the category you want to delete.

    i think deleting users must be done directly from the database at this point. if you don't want to do that, create a new role called "Deleted" (or something). Take away all the new role's privileges, and change the user to the new role.
  • edited April 2006
    really.., because i did what you are telling me, that is click the cross right to the category i want to delete, but then it asks me for a replacement category ?!? All i want is to erase the category and the discussions within it. Don t know if it is possilbe ? okay for the users, thank you
  • The only way to delete a discussion is to hide it, and use the System Cleanup extension to delete all hidden discussions. This is a bit of a hassle when you want to delete all discussions in a particular category.
  • ithcyithcy New
    edited April 2006
    bergamot is right... that is a different matter. there is no way to do it right now. it is not a matter of a single sql query. it will have to be an extension.

    right now i'd suggest this: go into category managment, edit the category, and uncheck all the roles so that no one can see that category. this will accomplish the same thing.
  • edited April 2006
    Actually, I think I could do it in three SQL queries; I just meant there's no way to do it inside vanilla.
  • ithcyithcy New
    edited April 2006
    that's what i meant, too.

    i don't know if it could be done without stored procedures.
    first you'd have to find all the discussions in the category, then delete all the comments in each of those discussions from LUM_Comments. this would be an extremely tricky (and/or memory-intensive) join.
    then you'd have to delete the discussions from LUM_Discussions, then delete the category from LUM_Categories, then delete all matching records with that category id from LUM_CategoryBlock and LUM_CategoryRoleBlock.

    if it can be done in mysql i would like to see the query. (this is not sarcasm.)
  • edited April 2006
    DELETE FROM LUM_Comment INNER JOIN LUM_Discussion ON LUM_Comment.DiscussionID = LUM_Discussion.DiscussionID WHERE LUM_Discussion.CategoryID = [id of the category you want to delete] DELETE FROM LUM_Discussion WHERE LUM_Discussion.CategoryID = [id of the category you want to delete] DELETE FROM LUM_Category WHERE LUM_Category.CategoryID = [id of the category you want to delete]

    I haven't tested it (don't have a spare vanilla db laying around) but it should work. If it destroys your tables, don't blame me...
  • i'll stand by my "memory-intensive" comment, but i think you're right on. i was working it out on the ride home and started thinking that maybe it wasn't as complicated as i was making it in my head.

    you still need to add
    DELETE FROM LUM_CategoryBlock WHERE CategoryID = [id of the category you want to delete] DELETE FROM LUM_CategoryRoleBlock WHERE CategoryID = [id of the category you want to delete]
    to get all the scraps.
  • Okay, i will store this SQL code for future investigations, but for now i will try it the php way. Thanks
  • Ithcy: yeah, I missed those. ^_^

    To maintain data integrity, they should go between my second and third queries.

    As far as it being memory intensive, a join can't be much more than O(n2). I know the LUM_Comment table can get pretty big, but the LUM_Discussion table is guaranteed to have fewer records than LUM_Comment, and likely a *lot* fewer.

    At any rate, that's the worst case; in reality I would guess that it would be very close to linear. I haven't spent much time looking at how MySQL executes something like this, but if it has any sort of optimization at all, it'll be fine.
This discussion has been closed.