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.

Hack: ReadOnly Categories

edited December 2006 in Vanilla 1.0 Help
I have a need for readonly categories, that is, a category where only those with the "PERMISSION_CHANGE_APPLICATION_SETTINGS" permission can post, but everybody can read. I have managed to hack this in, with a checkbox on the category create/edit form between the "Description" and the "Roles" stuff, and essentially, the Category is hidden from the "Select the category for this discussion" drop-down for unpriveledges users. Its a very minor code-change, but I added a new ReadOnly column to the DB. I still need to localize the strings and use the GetDynamicCheckbox() function (IIRC) to output the checkbox instead of it being hardcoded. I want to know how I should proceed from here to either get it included with the core vanilla distribution (as it seems to be an oft-requested and minor change) or how I can go about best extracting it into an addon with some customization to it (i.e. choosing which Roles can post in readonly categories). Your input is appreciated :) - Davey
«13

Comments

  • edited July 2006
    Please don't use this in production or anything, but here is a diff of my changes:

    Patch

    ~30 lines added is all it took, but like I say, it still needs to be localized.

    - Davey
  • can you make it an extension?
  • I... don't know :)

    Was hoping someone could point me in the right direction

    - Davey
  • gigingergiginger New
    edited July 2006
    Edit: I did misunderstand. Ignore me.
  • would love this as an extension. ideal for posting up news/notices/rules etc.
  • Be nice to just add a [LOCKED] mode to conversations & Cats
  • I would be interested in taking the challenge of turning this into an extension.
  • I guess I should ask whether you'd rather make the extension yourself, or let someone else do it.
  • Please someone make this into an extension! :-)
  • I just want to see this done right, I am quite competent in PHP, I needed this quickly, and so I hacked it in, I just wanted to contribute it back to the community :) If you want to take a stab at it "a_magical_me", have at, I'm busy writing and such, but if you would be good enough to comment it well so I can at least see what I should have done and then I can contribute more stuff in the future - the correct way :) - Davey
  • I'd like to see this as an extension please!
  • /signed for extension :)
  • Purty please. :)
  • Exactly what I would need for my forum!
  • Yikes! You people know I don't work well under pressure, right? ^_^;;
  • Would love to see an extension like this. It's been requested by quite a few people now.
  • MarkMark Vanilla Staff
    For the record: as an admin you can create a discussion and close it. Then no-one else can post in it besides administrators. It's not exactly what you are looking for, but it works until an extension is written.
  • Ok, I took a look at the patch posted above and it works beautifully. There is one bug though. The database.php file should read as: New: $DatabaseColumns['Category']['ReadOnly'] = 'ReadOnly'; Patch: $DatabaseColumns['Category']['ReadOnly'] = 'Description'; You'll need to add a new integer ReadOnly column to your database. I also noticed a few parts were different than shown in the diff patch file, probably because new versions have come out since then.
  • My main issue is I want to use one category for open public discussion and four separate categories for updates by our staff. We didn't want user posts getting mixed up in them so that legitimate staff posts were hard to find. Thanks for some great software, Mark! Quite a unique forum concept in an age where everyone is trying to copy phpBB or vBulletin.
  • So is anyone going to make an extension out of it? I'd be extremely grateful! ^-^
This discussion has been closed.