1
SLEO577
White Space in Username....is there an escape code?
  • 2005/12/5 20:45

  • SLEO577

  • Not too shy to talk

  • Posts: 110

  • Since: 2005/6/27


This is not so much a problem with XOOPS core, as it is with PHP.

I am using XOOPS 2.2.3 and with the "Spaces" in the "Display Name" (i.e. SLEO 577 vs SLEO577) has created a problem with our chatroom.

PHP will only echo "SLEO" and leaves off the "577" because of the space. With the older versions of XOOPS 2.0.13 this was not a problem, because spaces were not allowed (actually 2.2.3 does not allow for this either in Username, just DisplayName).

Possible example using: modules/profile/edituser.php?
[b]Line 81:[/b]$edituser->setVar('uname'$myts->stripSlashesGPC(trim($_POST['uname'])));
[
color=CC0000]<PRE>str_replace(" """"uname);</PRE>[/color]

Is there a way to "Strip" the white space in the users "Displayname", but yet still have it display the users "Displayname" with the space (i.e. SLEO 577)?

If so, would I have to hack all the user.php files?

2
SLEO577
Re: White Space in Username....is there an escape code?
  • 2005/12/6 19:27

  • SLEO577

  • Not too shy to talk

  • Posts: 110

  • Since: 2005/6/27


*bump*

Anyone have any PHP experience with this one?

Sorry for the bump, just need to get the chatroom issue resolved.

3
Peekay
Re: White Space in Username....is there an escape code?
  • 2005/12/6 22:09

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I have no idea how to achieve what you want, but I recall the keyboard command for a space was ALT 255. Used it in DOS to fake filenames. For example, myfileALT255.txt looked like myfile .txt in a directory list at first glance.

Sorry can't be of more help. Keep on bumpin'
A thread is for life. Not just for Christmas.

4
SLEO577
Re: White Space in Username....is there an escape code?
  • 2005/12/8 17:22

  • SLEO577

  • Not too shy to talk

  • Posts: 110

  • Since: 2005/6/27


Thanks PeeKay,

I think I need to insert this somewhere in the user's.php file, but not finding the proper escape code to do this. It is still displaying just the first name.

5
coopersita
Re: White Space in Username....is there an escape code?

Maybe you can add a little function that changes the whitespaces at registration to its escaped version: \x20 ?

6
SLEO577
Re: White Space in Username....is there an escape code?
  • 2005/12/9 18:12

  • SLEO577

  • Not too shy to talk

  • Posts: 110

  • Since: 2005/6/27


coopersita,

Not quite sure where I would put (/x20) in the register.php file (/modules/profile/register.php) but I have tried

around Line 80 - /modules/profile/register.php
if (empty($stop)) {
[
color=CC0000]$uname=str_replace(" """"$uname);[/color] 
echo _PROFILE_MA_USERNAME."
".$newuser->getVar('loginname')."<br />";
echo _PROFILE_MA_EMAIL."
".$newuser->getVar('email')."<br />";
echo _PROFILE_MA_DISPLAYNAME."
".$newuser->getVar('uname')."<br />";
        
$profile_handler =& xoops_gethandler('profile');


with little success, so there must be a better solution.

I've tried this in both user.php and register.php files to no avail!

7
m0nty
Re: White Space in Username....is there an escape code?
  • 2005/12/9 20:45

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


if you don't want to allow usernames in display name..

open profile/include/functions.php

find around line 43:

//    if ($user->getVar('name') == "" || preg_match($restriction, $user->getVar('name'))) {
//        $stop .= _PROFILE_MA_INVALIDDISPLAYNAME."<br />";
//    }


remove the comments // from the beginning of the line..

then around line 72:

//    if (strrpos($user->getVar('name'), ' ') > 0) {
//        $stop .= _PROFILE_MA_DISPLAYNAMENOSPACES."<br />";
//    }


again remove the comments from the beginning //

with regards to existing names, that's a little trickier..

8
SLEO577
Re: White Space in Username....is there an escape code?
  • 2005/12/12 18:33

  • SLEO577

  • Not too shy to talk

  • Posts: 110

  • Since: 2005/6/27


Thanks m0nty,

I don't mind the members using their username in the display name. Although I have warned them all about using both as the same name (kind of defeats the purpose).

The problem I am having is how to get the display name to still separate the name (i.e. SLEO 577), but yet use an escape code for the white space between the name so that the chatroom doesn't just show (i.e. SLEO) and drop the (i.e. 577) because of the white space.

It is a PHP issue I still haven't figured out how to correct in the right spots of the users.php files.

Login

Who's Online

225 user(s) are online (130 user(s) are browsing Support Forums)


Members: 0


Guests: 225


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