1 (edited by Koos 2008-08-04 17:29)

Topic: User Diaries 1.1

##
##        Mod title:  User Diaries
##
##      Mod version:  1.1.1
##   Works on PunBB:  1.2.*
##     Release date:  2008-07-16
##           Author:  Koos (pampoen10@yahoo.com)
##
##      Description:  Allows users to post diaries with images.
##
##   Affected files:  none
##                                     
##       Affects DB:  New tables:
##                       'diary'
##                       'diary_perms'
##                       'diary_reports'
## 
##            Notes:  Requires the GD library on your Web server. Script can
##                    upload JPEG, PNG AND GIF images.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
################################################################################
## CHANGELOG:
## 1.1.1 : fixed a bug on the edit page
##         minor style change
## 1.1.0 : can now edit your diary entries
##         added BBCode functionality
## 1.0.1 : some minor fixes and improvements
##         made changes to the English lang file
## 1.0   : initial release 
################################################################################

I have finally completed the User Diaries mod which I have been working on for some time now. Happy to say that it turned out the way I intended. The idea was to keep it simple - and make it easy to navigate. Thanks to those who helped test the pre-release version.

Features:
* All pages valid XHTML strict
* Valid RSS 2.0 feed for all user diaries
* Can upload images with diary entries
* Easy to install and uninstall
* Users can report diary entries
* Permission control
* Diary statistics for admin

Download from punres.org

2

Re: User Diaries 1.1

User Diaries v1.0.1 now available. Made a few fixes and improvements. Thanks to D.S. Denton for the Russian lang file. Also updated the French lang file.

3

Re: User Diaries 1.1

User Diaries v1.1.0 now available. See changelog above for changes.

4

Re: User Diaries 1.1

User Diaries v1.1.1 now available. There was a bug to fix on the diary edit page. Also make a change in how the small envelope shown next to the diary poster's name is displayed. Now it will display correctly in all style sheets.

Re: User Diaries 1.1

Looks like a great mod and I might implement it, however one feature that makes the most sense to me...
- Adding a list of the latest 5 diary entry titles to each users profile page so when you view a users profile you see...

Latest User Diary entries:
- 1/1/2008 I ate a hotdog today
- 1/1/2008 I hate school
- 1/1/2008 Tell me what you think about this
View all >

6

Re: User Diaries 1.1

You might be able to make use of the diary_extern.php page I created for this mod. It can display the latest 5/10/15 etc diary entries on any page. With some simple modifications you would be able to set it to display the latest diary entries of each user in their profile.

Re: User Diaries 1.1

I'm installing this mod but one feature I recommend is directory hashing on the image folders. I have 30,000+ members and even with only a few thousand highly active members writing diaries, the images folder will get bogged down.

P.s.  Directory hashing is also lacking in punbb avatars folder, I made a custom solution to this myself since my avatars folder had 30,000+ images in it.

8

Re: User Diaries 1.1

Hi. Thank for that...

But I 've got a problem with 'Image' BBCode

I entered this BBCode but my image is not inserted (I see in my Diary, this BBCode below in fact!)

[img]http://www.xyz.com/images/photo-0023.jpg[/img]

Other BBCodes seem Ok

PS: FluxBB 1.2.21 (BBCode allowed) - User Diarie 1.1.2 (BBCode allowed too ;-))

9

Re: User Diaries 1.1

And... at the Diaries listing, Line breaks are not displayed in the Diary' Content (like it is at the Diary individual view in fact)

But... please, could you tell me how do that ? thanks again in advance

10

Re: User Diaries 1.1

Koos wrote:

You might be able to make use of the diary_extern.php page I created for this mod. It can display the latest 5/10/15 etc diary entries on any page.

Great but when I tried...

Warning: main(PUN_ROOTinclude/parser.php) [function.main]: failed to open stream: No such file or directory in /home/mylogin/www/forum/diary_extern.php on line 22

Fatal error: main() [function.require]: Failed opening required 'PUN_ROOTinclude/parser.php' (include_path='.:/usr/share/php4:/home/xxx/yyy/zzz') in /home/mylogin/www/forum/diary_extern.php on line 22

an idea ? (php5 is it required ?)

Ps: This "PUN_ROOTinclude/parser.php" is strange ;-) not ? may be with an "/" before include

11

Re: User Diaries 1.1

It is solved my error with diary_extern.php (cf your post @ PunRes)

But I 've got always a problem with this 'Image' BBCode tag !

And... I do not know how to apply "line return" at the diaries listing

Please ;-)) Could you help me ?

12 (edited by Koos 2009-05-10 17:11)

Re: User Diaries 1.1

The 'show all user's entries' page is supposed to be a compact view of that user's diary entries - that's why it does not include line breaks.

I also did not allow it to display img tag BBCode, since the idea was to display only one image per diary entry (the uploaded image).

But if you really want to do that do that, here is how (but I don't recommend it):

#
#---------[ 1. OPEN ]---------------------------------------------------------
#

diary.php


#
#---------[ 2. FIND (line: 737) ]---------------------------------------------
#

//============= START PARSER =============
...
...
...
//============= END PARSER =============


#
#---------[ 3. REPLACE WITH ]---------------------------------------------------
#

    // Perform the main parsing of the message (BBCode, smilies, censor words etc)
    $text = parse_message($text, 0);
    echo $text;


#
#---------[ 4. FIND (line: 312) ]---------------------------------------------
#

//============= START PARSER =============
...
...
...
//============= END PARSER =============


#
#---------[ 5. REPLACE WITH ]---------------------------------------------------
#

    // Perform the main parsing of the message (BBCode, smilies, censor words etc)
    $text = parse_message($text, 0);

13 (edited by Pame 2009-05-10 21:51)

Re: User Diaries 1.1

Perfect... It's work! Thanks a lot for this code modification ;-) I understand your advices but for a "small" project where I know all Users who are allowed to post diaries and they are not talkative ;-) this feature is really interresting... Thank

May be! a better solution will be to cut all that... is not ?
Like there is here (diary_extern.php) in fact...

$UD_snip_entry = "200";  // Shortens string - default = 200

But it is to difficult to do ;-) for me

14

Re: User Diaries 1.1

Actually very easy - you can just make use of the snippet() function found in diary_extern.php

Here it is:

function snippet($text,$length=20,$tail="...") {
    $text = trim($text);
    $txtl = strlen($text);
    if($txtl > $length) {
        for($i=1;$text[$length-$i]!=" ";$i++) {
            if($i == $length) {
                return substr($text,0,$length) . $tail;
            }
        }
        $text = substr($text,0,$length-$i+1) . $tail;
    }
    return $text;
}