William Warby Posted July 23, 2009 Posted July 23, 2009 My implementation of IPB is on a corporate Intranet where it's only purpose is for users to post draft documents so that other users can comment on them. They typical scenario is that they post a new topic with no text and just an attachment and then the replies start flowing, but the "post" is a mandatory field with no option to change it. This is a bad fit for my usage scenario. In 2.x you could trick the system with a space character but that doesn't work in 3.x. I'd like an option to allow blank posts when there are attachments present. For the time being, I'll try to implement this myself by hacking the source code because I need it to work right now.
bfarber Posted July 23, 2009 Posted July 23, 2009 In any case, you can insert the attachments into the post area. The only thing that would show are the attachments, and IPB would allow that.
William Warby Posted July 24, 2009 Author Posted July 24, 2009 [quote name='bfarber' date='23 July 2009 - 06:27 PM' timestamp='1248370037' post='1831781'] In any case, you can insert the attachments into the post area. The only thing that would show are the attachments, and IPB would allow that. Yes, I realise that, but I'm in the unfortunate position of having to deal with a set of very IT-illiterate users that are barely able to grasp the concept of an Internet forum. Making them press a button to insert the attachment tag into the post is not user friendly because they won't understand the point of doing it, and I'd have to train every new user to press the button except where they have written a description of the attachment. I can see I'm onto a loser with this request and it's because I'm using IPB in a way that it wasn't really intended to be used - as a poor man's document collaboration tool rather than a discussion forum. But it doesn't seem like there would be any harm in having a setting to not require a post text when there are attachments, and it sounds like a very simple addition. Would it help if I begged?!
Wolfie Posted July 24, 2009 Posted July 24, 2009 [quote name='William Warby' date='24 July 2009 - 03:30 AM' timestamp='1248420655' post='1832287'] Yes, I realise that, but I'm in the unfortunate position of having to deal with a set of very IT-illiterate users that are barely able to grasp the concept of an Internet forum. Making them press a button to insert the attachment tag into the post is not user friendly because they won't understand the point of doing it, and I'd have to train every new user to press the button except where they have written a description of the attachment. I can see I'm onto a loser with this request and it's because I'm using IPB in a way that it wasn't really intended to be used - as a poor man's document collaboration tool rather than a discussion forum. But it doesn't seem like there would be any harm in having a setting to not require a post text when there are attachments, and it sounds like a very simple addition. Would it help if I begged?! I know you'd like this to be an included feature, but unless it gets done you might have to tinker directly with the source. I fooled around with the code for a few minutes and here's what might work for you. I make no promises on it so please keep in mind that this is done at your own risk. I tested it real quick on my board and it worked for me, but that doesn't guarantee anything. You'll need to edit the file located in /path/to/forums/admin/applications/forums/sources/classes/post/classPost.php On the following lines, simply add // to the beginning of the line (two forward slashes, nothing else) Line 1288 look for: throw new Exception( 'NO_CONTENT' ); Line 1316 look for: $this->registry->getClass('output')->showError( 'post_too_short', 103143 ); Line 1650 look for: throw new Exception("NO_CONTENT"); Adding the two forward slashes, the lines should then become: Line 1288: //throw new Exception( 'NO_CONTENT' ); Line 1316: //$this->registry->getClass('output')->showError( 'post_too_short', 103143 ); Line 1650: //throw new Exception("NO_CONTENT"); That all simply prevents it from generating an error when the post is empty. It might also disable other important checks, but as near as I can tell, that will allow you to make empty posts. The drawback to doing this edit is that when a new release comes out, you'll have to do the edits again. But unless/until it becomes optional, this may be the only way to allow you to have empty posts.
William Warby Posted July 24, 2009 Author Posted July 24, 2009 Thanks Wolfie! I'd actually just set about doing the exact same thing, but I'd only noticed one of the three places where you commented out so it's a good job I had you looking at it too :) It's a very easy hack so I've just made a note on what I need to remember to do with each new release - I'll still hope for an actual feature since this hack doesn't take account of whether or not there are any attachments and I don't want to start rewriting a bunch of code to check for that and produce a different error message, but for now this suits my purposes well enough ;)
Wolfie Posted July 24, 2009 Posted July 24, 2009 [quote name='William Warby' date='24 July 2009 - 04:22 AM' timestamp='1248423766' post='1832301'] Thanks Wolfie! I'd actually just set about doing the exact same thing, but I'd only noticed one of the three places where you commented out so it's a good job I had you looking at it too :) It's a very easy hack so I've just made a note on what I need to remember to do with each new release I was actually a bit worried that you might look at it and be like, "Huh?" which is why I put so much detail into what to do. Good to know that you've got some experience with it, so if anything goes wrong, you'll be able to go in and reverse the changes quickly. Truth be told (and I've told it before) I'm not that great with PHP. I dabble extremely little in it and many of the concepts escape me.
William Warby Posted July 24, 2009 Author Posted July 24, 2009 [quote name='.Wolfie' date='24 July 2009 - 09:29 AM' timestamp='1248424148' post='1832305'] I was actually a bit worried that you might look at it and be like, "Huh?" which is why I put so much detail into what to do. Good to know that you've got some experience with it, so if anything goes wrong, you'll be able to go in and reverse the changes quickly. Truth be told (and I've told it before) I'm not that great with PHP. I dabble extremely little in it and many of the concepts escape me. Haha :) No, I'd cautiously label myself as an expert PHP programmer - I've been writing it on and off for about 6 years. I knew I'd be able to hack the source, I'd just prefer not to for reasons of maintainability - I got myself locked into an old version of IPB before because I hacked it so much that it was too much effort to port all those hacks from version to version. We learn by our mistakes!
Wolfie Posted July 24, 2009 Posted July 24, 2009 [quote name='William Warby' date='24 July 2009 - 04:33 AM' timestamp='1248424394' post='1832309'] I got myself locked into an old version of IPB before because I hacked it so much that it was too much effort to port all those hacks from version to version. That's why I'm trying to avoid ANY modifications that require editing the PHP files. My lazy tail doesn't want to deal with the headache of making the same edits time and again.
William Warby Posted July 24, 2009 Author Posted July 24, 2009 [quote name='.Wolfie' date='24 July 2009 - 09:35 AM' timestamp='1248424545' post='1832310'] That's why I'm trying to avoid ANY modifications that require editing the PHP files. My lazy tail doesn't want to deal with the headache of making the same edits time and again. Yep. In this particular case though, it was something my users pretty much demanded of me. My users are all senior managers and elected government officials who generally don't stray from MS Office and email on their PCs and they're not the most patient group of individuals. Explaining to them that they had to press a button to insert a tag into the post content to avoid an error page when posting their documents on IPB was not really an option. IPB isn't the ideal solution for my particular usage case but it was cheap and easy, and I don't think there's anything on the market that's closer to what we needed. Thanks for your help ;)
Wolfie Posted July 24, 2009 Posted July 24, 2009 No problem. :) Considering how unique the request is, it's understandable why such a feature wouldn't be included. The IPS crew generally do what they can to try to please everyone, but when they can't for some reason (they do have to prioritize things), then usually someone is willing to try to help out. It's a great community.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.