1
dbbis
Shorter usernames in 'new members' bloc?
  • 2003/11/22 22:50

  • dbbis

  • Just popping in

  • Posts: 12

  • Since: 2003/1/20


Hi!

On the site I manage, EDCA, I'd like to make the bloc 'new members' to look the same as the others : the size is different, because the usernames are too long.

Is there a way to make that the usernames appear of a maximum of 8 or 9 letters, for example, in this specific bloc? How to modify the code with the good parameter?

Thanks in advance and best regards,

BD.

2
skalpa
Re: Shorter usernames in 'new members' bloc?
  • 2003/11/22 23:21

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Checked that, and it's not possible to do this modifying the template file.

You'll hade to edit /modules/system/blocks/system_blocks.html
And change this line:
$members .= ' <a href="'.XOOPS_URL.'/userinfo.php?uid='.$onlines[$i]['online_uid'].'">'.$onlines[$i]['online_uname'].'</a>,';


with something like this:
$name $onlines[$i]['online_uname'];
if (
strlen($name) > 8) {
 
$name substr$name08) . '...';
}
$members .= ' <a href="'.XOOPS_URL.'/userinfo.php?uid='.$onlines[$i]['online_uid'].'">'.$name.'</a>,';


( change le 8 if you want )

Skalpa.>

3
Mithrandir
Re: Shorter usernames in 'new members' bloc?

Check this out:
http://smarty.php.net/manual/en/language.modifier.truncate.php

So basically, as I understand it, you can change
<a href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><{$user.name}></a>

to
<a href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><{$user.name|truncate:8:"":true}></a>

in the block template

4
skalpa
Re: Shorter usernames in 'new members' bloc?
  • 2003/11/22 23:51

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Yep, that's what I wanted to advise first, but here the problem is that the "online users" block generates everything from the php side.
The tpl just contains
<{$block.online_names}>

But for other things the Smarty truncate works...

[edited]Damn I've been checking the "online users" block since the beginning. My bad. Sorry guys.|/edited]

Skalpa.>

5
dbbis
Re: Shorter usernames in 'new members' bloc?
  • 2003/11/23 20:35

  • dbbis

  • Just popping in

  • Posts: 12

  • Since: 2003/1/20


Thanks a lot for your help.

I have tried to do the tip suggested by MithyT2, which works when I am in the Admin part (bloc edition), and I click on "View". The problem is that it does not work in the main page.

Then I have edited directly the template file. But it does not work.

Maybe I have forgotten to do something?

You can check: EDCA.

Thanks again and best regards,

Don.

6
Mithrandir
Re: Shorter usernames in 'new members' bloc?

When messing with the templates, you should first clone the default template set in System -> Templates and then edit that block template for new members.

Login

Who's Online

154 user(s) are online (86 user(s) are browsing Support Forums)


Members: 0


Guests: 154


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits