1 (edited by StevenBullen 2010-04-13 23:40)

Topic: [Extension Release] Fixed Last post subject on index

What does this mod do?
This will add the subject of the last post under the last post column on the index page.
Also now adds link to the last poster. Also time/date from last post.

Note: Link to profile is disabled when you install this mod. You need to turn it on at admin-features. This is because it adds another join to a query, so some people might not want that.

* Added linkify to viewforum.php as well. So now posters on viewforum linked to profile (ONLY ON LAST POST, NOT ON TOPIC POSTER).

Screenshots
1 2 3

Download
Last post subject on index v1.6


Give any feedback for improvements.
Thanks guys!

Now available on PunBB 1.2.* as well

2 (edited by Daneczech 2010-04-12 15:56)

Re: [Extension Release] Fixed Last post subject on index

Hello Steven, this extension is really great, I think, that this functionality has to be a part of basic install scripts.

But, there is a bug.

PunBB 1.3.4 UTF-8 - if the last character is for example í or š or ž or another from national characters, the extension will fail and nothing is written on the homepage (except the header and the footer).

Here is my solution:

$kolik = $forum_config['o_si_topic_length'];
             $text = $ext_si['subject'];
             $text_zacatek = substr($text, 0, $kolik);
             $mezera = explode (" ", substr($text, $kolik, ceil($kolik*0.5)));
             $text_cely = trim($text_zacatek.$mezera[0]);
             if($text_cely==$ext_si['subject']):
              $ext_si['subject'] = $text_cely;
             else:
              $ext_si['subject'] = $text_cely."&#8230";
             endif;
             //$ext_si['subject'] = substr($ext_si['subject'], 0, $forum_config['o_si_topic_length']).'&#8230';

In case, that the title is larger than defined length, find blank space and all before is the new title. Sorry for not writing the variable names in english.

Thank you, this extension is really great.

Re: [Extension Release] Fixed Last post subject on index

it's update?

Re: [Extension Release] Fixed Last post subject on index

@Daneczech
Thanks, will take a look.

@fantasma
Yeah 1.6 is coming. Juggling a lot at the moment. wink

Re: [Extension Release] Fixed Last post subject on index

StevenBullen wrote:

@Daneczech
Thanks, will take a look.

@fantasma
Yeah 1.6 is coming. Juggling a lot at the moment. wink

thanks

Re: [Extension Release] Fixed Last post subject on index

Download
Last post subject on index v1.6

Changelog

  • Added index to topics so works much faster!

  • Changed substr to mb_substr to handle utf-8 characters when subject is cut short

  • Cleaned up code a little

@Daneczech
Could you check the latest update as I went for mb_substr (PHP 4 >= 4.0.6, PHP 5) and done a little testing and it worked fine for me.

Re: [Extension Release] Fixed Last post subject on index

StevenBullen wrote:

Changed substr to mb_substr to handle utf-8 characters when subject is cut short

There are UTF-8 functions in PunBB. You can use utf8_substr(). It will automatically call mb_substr if available or a custom implementation otherwise.

Re: [Extension Release] Fixed Last post subject on index

Parpalak wrote:
StevenBullen wrote:

Changed substr to mb_substr to handle utf-8 characters when subject is cut short

There are UTF-8 functions in PunBB. You can use utf8_substr(). It will automatically call mb_substr if available or a custom implementation otherwise.

Ok I have updated for next release.

Any major problems with using mb_substr? (i.e. to release again so quickly)

Re: [Extension Release] Fixed Last post subject on index

@StevenBullen Looks good, the problem seems to be gone. Thanks.

10

Re: [Extension Release] Fixed Last post subject on index

Hi, great extension. Still I have some "ideas" of what could be better.

- Firstly, you should check, whether the language file exists in admin's language, before trying to include it. They get error otherwise.

hook id="aop_start"

if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
    include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
else
    include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';

- With this is little bit connected the URL which you are using for including files. I believe it would be better using pre-set variables rather than absolute url.

require FORUM_ROOT.'extensions/subject_index/admin/subject_index.php';

->

require $ext_info['path'].'/admin/'.$ext_info['id'].'.php';

- Other thing, for "cosmetic purposes" is that shortened name of topic would look better, if it would be followed by "..." (In HTML it is as entity …)

- And finally, last thing - at Administration you are increasing $forum_page['fld_count'] each time, instead of just once per input/label, which leads to <label> and <input> not being connected together  smile

Oh, and btw - don't forget to add your extension in Wiki wink

Eraversum - scifi browser-based online webgame

Re: [Extension Release] Fixed Last post subject on index

Hello,

It's possible to reduce height of each line of last post ?

smile

Re: [Extension Release] Fixed Last post subject on index

Hello.. I have found this one and I can't install... I get this error:

Database reported: ERROR: could not create unique index "topics_topics_last_post_id_idx" DETAIL: Table contains duplicated values.

I have try to rebuild the index but the problem persists...

Thanks in advance.

PS: I have PgSQL

Re: [Extension Release] Fixed Last post subject on index

Rodolfo, you can try this analog extensions — http://punbb.informer.com/forums/topic/ … ndex-page/

14

Re: [Extension Release] Fixed Last post subject on index

Thanks dimkalinux

This topic closed.