forum.coppermine-gallery.net
No Support => Feature requests => Topic started by: dakky on February 02, 2005, 11:56:38 pm
-
I mean how to make that no one can post a coment if the access right to post comment is set to public level even to ones who aren't registered. I would like to make that noone can enter their name if the name they entered is same with one of the registered users. I.E. I am admin and my nick is "dakky". Now someone comes and post comment on any picture and type name dakky .. so the only difference between me and that user is a color (in fact a link, blue is a link, black is a non-auth. user without link)
Hope u understand, I dont like every day loggin in and changing nicknames of those ppl who use my name to post "rude" comments (i.e. I'm saying something to some girl or ... you know)
-
So basicly what you are looking for is a way to make the posting of comments on pictures a publicly avaible thing but with the restriction that the comments do not get posted if a registered username is used by a anonymous user.
Sounds like a good idea. Would be nice to add a little popup screen when that happens asking you if you would like to login first.
Not sure if this could become a feature or would be better of becoming a mod.
-
is a valid feature request imo, so I'm moving it from "coppermine.sourceforge.net | Support | CPG 1.3 Standalone Support | Permissions & Access Rights" to the "feature requests" board (although I think this has been requested before).
Anyway, allowing anonymous comments is not recommended...
Joachim
-
either anonymous comments or no comments at all. no one would bother to register if he/she came just to see few pictures. and he/she will probably never come again.. so.. (in 30 days, 3200 pictures viewed) ... and only ~20 comments...
-
Same here, only a few make the effort of registering so they are able to post comments. A welcome feature indeed if this is implemented.
-
Wouldn't an "approve comments" feature be more appropriate? If users are posing rude comments, the can pick any nickname. If you can approve comments before they go live, you can prevent any rude comments from being seen.
-
Or you combine the two options. Making commenting not possible using a already registered nickname and when using a random nickname the comment has to be approved first.
-
for the easy part ( no "Anonymous" comment using a registered nickname ), that should do the trick ( case insensitive check )
in db_input.php:
find
if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie
and add right after:
if (mysql_result(mysql_query("select count(user_id) from {$CONFIG['TABLE_USERS']} where UPPER(user_name) = UPPER('$msg_author')"),0,0))
cpg_die(ERROR, 'A registered user is using this nickname, login or use another one' ,__FILE__,__LINE__);
-matt-
-
Thanks Matt. Works perfectly ;D
-
I applied similar mod for an update action.
Because user can first name himself with a not used name, and then change it to some registred users name ;)
-
Hmmm... And if there are 1000 registered users in a gallery. Guest writing comment. Under the nick, for example, George. Error. Ok, go back, change nick to.. fore example.. George_Too.. Error. And going away.
Another way to solve this problem: many boards using prefixes to guest usernames: unregistered user typing "George", and his comment displaying under the name "Guest_george". It is simple to realisation:
adding record in config table:
INSERT INTO `cpg_config` ( `name` , `value` ) VALUES ('guest_prefix', 'Guest');
Adding in language file in $lang_config_data array after
'User settings',
this string:
array('Guest username prefix', 'guest_prefix', 0),
in db_input.php
find
if ($msg_body == '') cpg_die(ERROR, $lang_db_input_php['err_comment_empty'], __FILE__, __LINE__);
add after
if (!USER_ID and !strstr($msg_author, $CONFIG['guest_prefix'])) $msg_author = $CONFIG['guest_prefix'].$msg_author;
find
if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie
and add after
$msg_author = $CONFIG['guest_prefix'].$msg_author;
That's all... ;)
Warning: it's NOT TESTED for now, written directly in forum :)
-
2Vadim: to prevent this in db_input.php find:
if ($msg_body == '') cpg_die(ERROR, $lang_db_input_php['err_comment_empty'], __FILE__, __LINE__);
and add after
if (!USER_ID and mysql_result(mysql_query("select count(user_id) from {$CONFIG['TABLE_USERS']} where UPPER(user_name) = UPPER('$msg_author')"),0,0))
cpg_die(ERROR, 'A registered user is using this nickname, login or use another one' ,__FILE__,__LINE__);
}
*offtopic*
Are you russian? (seeng your nick)
-
@George: you are right, adding a prefix like "*Guest* to unregistered users is the easiest and best solution to implement.
Joachim
-
@GauGau & George_CC: I do agree too, but with a small remark:
if you have a registered user "lambda" that goes on your website, see a picture and is too lazy to login (personal expericence, users are lazzzzy), comments he will leave will end with the username "Guest_lambda"...
Which also means that anybody will be able to leave a message under the "Guest_lambda" nickname too
That's why i still like the idea of additionally checking for a registered user, with a message suggesting to login...ok maybe i'm just brainstorming too much on this one... ::) ;)
-matt-
-
well, in this case you shouldn't allow anonymous comments in the first place imo. However, the actual code that is meant to make it into the coppermine core code could have some fallback functions - it's all a matter of coding, or rather: who's willing to code it. Personally, I see little point in commenting at all, and I never allow anonymous comments nor uploads, simply because there are a lot of trolls, spammers and other stupid people around.
Joachim
-
it's all a matter of coding, or rather: who's willing to code it.
You kinda asked for it...;)
And moreover I did it cause i think comments can be pretty cool sometimes ( even anonymous, i repeat myself and dakky and Hein in this thread, users are lazy, it's often wether anonymous comments or no comments at all.. )
So attached are the following features ( i used the last 1.4 files ):
- anonymous users can't post comments under a registered nickname
- anonymous comments are prefixed ( prefix settable in config under the comments settings ). @Vadim & George_CC: in 1.4 ( don't know about 1.3x ) when an anonymous user edit a comment, only the msg body is changed, not the author name, so the author prefix add and the registered user check can be done only when inserting new comments
- doc updated too
-matt-
-
Strange, but really anonymous cannot change his nick, but I had such problems in 1.3.1 if i'm not mistaken.
*offtop*
@George_CC: Yeah, I'm Russian, but I was born and now living in Estonia (http://www.visitestonia.com) :)
-
Strange, but really anonymous cannot change his nick, but I had such problems in 1.3.1 if i'm not mistaken.
Just checked at the CVS tree: it indeed used to be like that, and was fixed with v1.3 of db_input.php ( June 04 )
-
@Matt: thanks for the contrib, added an item to the dev todo list to implement your hack into the core code, not sure if this will happen for cpg1.4.x though, as we're nearing the feature-freeze stage.
Joachim
-
@nol33t: this is an excellent contribution, you even thought of modifying the documentation and adding the help icon links. I just committed it to the devel branch - great work. There were some minor glitches I had to correct though:
cpg_die(ERROR, $lang_db_input_php['com_author_error'],__FILE__,__LINE__);
must becpg_die($lang_error, $lang_db_input_php['com_author_error'],__FILE__,__LINE__);
- Although the code works as you provided it, you should always use the (redundant) extra curly braces to show the structures of your code (and to make it more readible for others), so
if (mysql_result(cpg_db_query("select count(user_id) from {$CONFIG['TABLE_USERS']} where UPPER(user_name) = UPPER('$msg_author')"),0,0))[/li][/list]
cpg_die(ERROR, $lang_db_input_php['com_author_error'],__FILE__,__LINE__);
should be if (mysql_result(cpg_db_query("select count(user_id) from {$CONFIG['TABLE_USERS']} where UPPER(user_name) = UPPER('$msg_author')"),0,0))
{
cpg_die($lang_error, $lang_db_input_php['com_author_error'],__FILE__,__LINE__);
}
- The database update has to be both in update.sql and basic.sql (basic.sql is being used for fresh installs)
Anyway, great job! Looking forward to more of your contributions ;D
Joachim
-
@GauGau: glad you liked it, i'll remember your advices if i got the opportunity for another contrib ;)
-matt-