Practical question on user / comment -system. | | |
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. | | | | 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 | | | | 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! | | | | 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. | | | | 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 | | | | 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. | | | | 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 |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,439 network members.
|