skip to main content

kiesler.at

Latest posts enhancement
updated by rck, 2005-07-10

For me, phpWebSites phpwsbb forum module has a lot of potential which is largely unused. One step in the right direction would be the display of

  • Who replied last and
  • how many replies have there been to a thread

in the phpwsbb last forum posts block. It would also be nice to have the latest post label (instead of the thread label) and the editor of the post (if there is one) instead of that of the owner. Well, I hacked phpwsbb again to do just that.

                     
1 | 2

Going further

If you take a closer look to my sites' latest posts box, you'll see an enhancement of this hack. You'll get the full thread-title as soon as you hover over it with the mouse.

To get this, you can die two different deaths. Either, generate the link to the thread by yourself. Or hack the moduleLink-method, so it would take an additional parameter.

I did the later one, so the Eloi's short-url wouldn't be harmed.

core/Text.php

As always, please make sure to have a recent backup before trying this hack. First, we need an additional parameter:

552 function moduleLink($title, $module=NULL, $getVars=NULL, $target=NULL,
$class=NULL, $anchor=NULL, $html=NULL){^M

...this should do nicely. Next, we'll just paste that parameter into the generated anchor tag:

635 return $link.$linkAnchor.'"'.$linkTarget.$linkClass.
$linkHtml.'>'.strip_tags($title, '').'';

That's it for the core-classes.

phpwsbb/class/Runtime.php

Back to Runtime.php. Here, we only need to call the new moduleLink method:

126     /**
127     * Displays block with next set of games in it
128     *
129     * @author   Don Seiler <don@NOSPAM.seiler.us>
130     */
131     function showLatestThreadsBlock() {
132 
133         // Get settings
134 
135         $settings               = $GLOBALS['core']->sqlSelect('mod_phpwsbb_settings');
136         $showblock              = $settings[0]['showlatestthreadsblock'];
137         $blocktitle             = $settings[0]['latestthreadsblocktitle'];
138         $limit                  = $settings[0]['maxlatestthreads'];
139         $allow_anon_view        = $settings[0]['allow_anon_view'];
140         $bboffline              = $settings[0]['bboffline'];
141 
142 
143         if ($bboffline && !$_SESSION['OBJ_user']->isDeity())
144                 return;
145 
146         if(!$showblock)
147                 return;
148         
149 
150         if(!$allow_anon_view && !$_SESSION['OBJ_user']->username)
151                 return;
152 
153         $block = NULL;
154 
155         // $sql = PHPWS_ genLatestThreadsSQL($limit);
156         $sql=PHPWSBB_Runtime::genLatestThreadsSQL($limit);
157 
158         $result = $GLOBALS['core']->getAllAssoc($sql);
159         $length=30;
160 
161         if($result)
162                 foreach($result as $nr => $row) {
163 
164                         $editor=$row['editor'];
165                         $owner=$row['owner'];
166                         $title=$row['label'];
167                         $posts=$row['pcount'];
168                         $id=$row['id'];
169 
170                         if(strlen($title)>$length)
171                                 $lbl=substr($title, 0, $length).'...';
172                         else
173                                 $lbl=$title;
174 
175                         $title="TITLE='$title'";
176 
177                         if(isset($editor))
178                                 $poster=$editor;
179                         else
180                         if(isset($owner))
181                                 $poster=$owner;
182                         else
183                                 $poster=$_SESSION['translate']->it('Guest');
184 
185 
186                         $link=PHPWS_Text::moduleLink($lbl, 'phpwsbb',
187                                 array(  'PHPWSBB_MAN_OP'=>'view',
188                                         'PHPWS_MAN_ITEMS'=>$id),
189                                 null, null, null, $title);
190 
191                         $block .=       "<p><strong>$poster</strong><br />".
192                                         "$link($posts)</p>";
193 
194                 }
195 
196         $GLOBALS['CNT_phpwsbb_latestthreadsblock']['title'] =
197                 $blocktitle;
198 
199         $GLOBALS['CNT_phpwsbb_latestthreadsblock']['content'] = $block;
200         
201     }// END FUNC showLatestThreadsBlock

...enjoy!

                     
1 | 2



RSSComments - Make a comment
The comments are owned by the poster. We are not responsible for its content.
RSSAll Articles
2008, 2007, 2006, 2005, 2004

What's Related

Article Manager

Hacks

Latest Updates

AdministrativeTexts
updated by freddiemac1993, 2013-06-14
wiki

Re: adventures
created by brittdavis10, 2012-02-23 (1 rply, 3 views)
thread

Re: how to run phpwebsite...
created by alexander, 2011-08-25 (2 rpls, 3607 views)
thread

Re: Forum tags
created by HaroldFaragher, 2011-08-22 (3 rpls, 8488 views)
thread


Zu den KO2100 Foren