Connecting Tech Pros Worldwide Forums | Help | Site Map

Practical question on user / comment -system.

frizzle
Guest
 
Posts: n/a
#1: Feb 7 '06
Hi there

I've built this user management system, using PHP & mySQL, to manage
users that can comment on a certain site. Users have to be logged in to
comment. Below each comment is (how original) the date of
commenting, and the author.

If the user changes his name in his profile, it changes everywhere. So
what i mean is that the user_id is saved together with the comment.
When the comment is pulled out, the query also gets the user's name.

My question:
What is usually done with users deleted from the member system: this
would lead to a blank name on every appearance of a deleted user's
comment.
Or how do i prevent the blank space, and still show the user's name?

Greetigs Frizzle.


Steve
Guest
 
Posts: n/a
#2: Feb 7 '06

re: Practical question on user / comment -system.


On Tue, 07 Feb 2006 01:38:34 -0800, frizzle wrote:
[color=blue]
> Hi there
>
> I've built this user management system, using PHP & mySQL, to manage
> users that can comment on a certain site. Users have to be logged in to
> comment. Below each comment is (how original) the date of
> commenting, and the author.
>
> If the user changes his name in his profile, it changes everywhere. So
> what i mean is that the user_id is saved together with the comment.
> When the comment is pulled out, the query also gets the user's name.
>
> My question:
> What is usually done with users deleted from the member system: this
> would lead to a blank name on every appearance of a deleted user's
> comment.
> Or how do i prevent the blank space, and still show the user's name?
>
> Greetigs Frizzle.[/color]

I never change user details, rather I create a new one with a new ID. That
way, you never have that problem, and the quotes stay attributed to the
person who made them at the time. All you need to do is to add a validity
flag to the user details.

$0.02,

Steve

Stanch
Guest
 
Posts: n/a
#3: Feb 7 '06

re: Practical question on user / comment -system.


Do you still want to show the deleted user's comment?

Instead of removing the user from the database, you can use a flag
value. You can have a 'status' column that says active or inactive
(1/0), with a default value of active. When the user is deleted from
member system, set the status to inactive.

This way the comment will still show the username. Or you can choose to
just select/display comments from active users.

However, in other places where you need to know whether a certain user
is active (such as user list), you have to do a "select * from
usertable where status=1" so that you're selecting active users only.

I'm not expert. Hope this helps!

frizzle
Guest
 
Posts: n/a
#4: Feb 7 '06

re: Practical question on user / comment -system.


Stanch wrote:[color=blue]
> Do you still want to show the deleted user's comment?
>
> Instead of removing the user from the database, you can use a flag
> value. You can have a 'status' column that says active or inactive
> (1/0), with a default value of active. When the user is deleted from
> member system, set the status to inactive.
>
> This way the comment will still show the username. Or you can choose to
> just select/display comments from active users.
>
> However, in other places where you need to know whether a certain user
> is active (such as user list), you have to do a "select * from
> usertable where status=1" so that you're selecting active users only.
>
> I'm not expert. Hope this helps![/color]


@Steve
I don't completely understand what you're saying, but i guess it's the
same as Stanches option ... (?)
What i don't get is "$0.02"

@Stanch, that's what i thought of too, but i wasn't too sure of this
method (i use 'deleted = 0/1') was ok, because a deleted user would
still burden the DB.

Thanks.

Frizzle.

Stanch
Guest
 
Posts: n/a
#5: Feb 7 '06

re: Practical question on user / comment -system.


Yeap, but I guess that's a minor tradeoff for things to work properly.

Comments showing properly > Huge db. :P

I myself would like to know if there's another way of doing this
without major change to the db structure.

PS: I think $0.02 means "just my two cents". :D

frizzle
Guest
 
Posts: n/a
#6: Feb 7 '06

re: Practical question on user / comment -system.


Stanch wrote:[color=blue]
> Yeap, but I guess that's a minor tradeoff for things to work properly.
>
> Comments showing properly > Huge db. :P
>
> I myself would like to know if there's another way of doing this
> without major change to the db structure.
>
> PS: I think $0.02 means "just my two cents". :D[/color]

I'd like to know as well ... :D

$0.0001

Frizzle.

Jasen Betts
Guest
 
Posts: n/a
#7: Feb 8 '06

re: Practical question on user / comment -system.


On 2006-02-07, frizzle <phpfrizzle@gmail.com> wrote:[color=blue]
> Hi there
>
> I've built this user management system, using PHP & mySQL, to manage
> users that can comment on a certain site. Users have to be logged in to
> comment. Below each comment is (how original) the date of
> commenting, and the author.
>
> If the user changes his name in his profile, it changes everywhere. So
> what i mean is that the user_id is saved together with the comment.
> When the comment is pulled out, the query also gets the user's name.
>
> My question:
> What is usually done with users deleted from the member system: this
> would lead to a blank name on every appearance of a deleted user's
> comment.
> Or how do i prevent the blank space, and still show the user's name?[/color]

Don't delete the user, mark them as inactive (or historical) instead.

you could do this by addin a boolean field for this info, to the users
table or by putting a certain value in the password field (etc...)

Bye.
Jasen
Closed Thread