Feature suggestion - marking posts containing images (General)

by erikp, Wednesday, March 12, 2008, 00:43 (5883 days ago) @ erikp
edited by erikp, Wednesday, March 12, 2008, 00:50

I'll post the patch here.

It prints the number of images (eg img-tags) in the post, and there are 3 settings, which are stored in the settings table in the database, and thus can be changed.

It works like before and adds a mark at the end of the subject. When you reply to a post with such mark, the mark is removed from the subject on the "post reply" page. This is to make it less likely that someone adds something after the mark etc. If you put text with the same format as the mark last in the subject, it is removed, thus there will not be 2 marks of the same "kind". And it, ofcourse, adds marks if there is pictures in the postings.

The settings are stored in the settings table in the database and the settings can be changed from admin->forum settings->advanced settings.

The settings are:
1. picstring_add : set to any non php false value (ex 1) to activate the function, and to a false php value to inactivate it (for example 0)
2. picstring : The string to use if there is only one picture in the posting.
3. picstring_plural : The string to use if there is more than one picture in the posting.

You need to add those settings to the database (using for example the php script referenced below).

For example, I'm from Sweden and use the settings "bild" for picstring and "bilder" for picstring_plural. If there is one picture in the posting, the mark will be "[1 bild]" and if there is more than one picture in the posting the mark will be, for example "[10 bilder]". Thus if I post something with the subject "My little subject" and it contains 10 pictures, the subject will be changed to "My little subject [10 bilder]". When someone replies to this, the subject on the "Post reply" page will be "My little subject", and if they add pictures in their posts, the appropriate mark will be added.

There is not much use in changing the picstring and picstring_plural once you have started using it, since after changing it, it will not remove old marks. For example if you use "pics" in the start and there are postings marked with for example "[10 pics]" and you then change it to "pictures", the old marks will not be removed automatic on the "post reply" page as described above.

To install the patch, either run:
patch < patchfile
in the forum/includes directory
or download the patch here:

http://www.djingis.se/~ep/patch4.tar.gz
(it contains the patchfile, a prepatched version of postings.inc.php, the original postings.inc.php, a "do what you want, no guarantee"-statement, and a small installation description)

and extract the contents of the file. Save the old postings.inc.php and add the one from the extraced archive. Check that you are using the same version as me [2.0 beta 25 (2008-02-27)] (though it may work with other 2-versions if you use the "patch < patchfile" way to install it, but there is no guarantee).

You need to add the name-value pairs to the settings database. You can of course do this anyway you want. However there is a "add-to-db.php" in the tar-file and you can put this in your forum-directory and *RUN IT ONCE* and then *REMOVE IT*. Do NOT run it more than once, and make SURE to delete it afterwards! Check that the settings table is updated afterwards [if not, you can try to run it once more :-) ] The same file is also here:
http://www.djingis.se/~ep/add-to-db.phps
so you can use cut and paste if you want.

As always, there is no guarantee about function and you use it on your own risk.

locked
3786 views

Complete thread:

 RSS Feed of thread