Firefox PHP

An option for registered users to post anonymously?

Posted by hkbb 
An option for registered users to post anonymously?
July 14, 2004 03:32AM
Is there a way for logged in registered users to post anonymously?

i.e. On the post form, they can either choose to use their real login names (which links to their profiles) or an alias (whatever they like to enter, no links).

Of course, the moderators always know which message is posted by who. :-)

Re: An option for registered users to post anonymously?
July 14, 2004 11:19AM
How about just logging off and posting a message?

Greetz,

Godai
Re: An option for registered users to post anonymously?
July 14, 2004 12:00PM
No. That's not what I want.

I don't really want unregistered users to post on my forum.


That's why I asked:
"Is there a way for logged in registered users to post anonymously?"
Re: An option for registered users to post anonymously?
July 14, 2004 01:28PM
Whats the difference between an unregistered post and an anonymous registered post? You're not going to know who wrote it, otherwise its not really anonymous.

If you store their user_id of the poster, Phorum will link to the profile. If you don't, you can't tell who wrote the post.

There is no module currently to do what you want. The closest thing is my "Named Posting" module, located here: [phorum.org]

You can probably modify the module to do this.
Re: An option for registered users to post anonymously?
July 14, 2004 03:09PM
Thanks Tridus.

But,

1) posting message is a privilege for registered users
2) spam control is a lot more easier for registered posters
3) some users feel more comfortable to post certain messages without other readers knowing who they are
4) log on/off to switch between showing/hiding username for postings involves too much troubles

Yes, it's not truely anonymous - moderators always knows who they are.

I took a look at your "Named Posting" module, it's close, but need modifications. That's the problem.

I wonder if you could offer any help in that.

Thanks.


Re: An option for registered users to post anonymously?
July 14, 2004 11:05PM
1 and 2 are true if you have some kind of verification of registered users. If anybody can register and immediately post, they're not true anymore.

I don't think logging off is that big of a deal, but anyway... if you want to do this, you'll have to hack the module to be able to recognize when somebody is actually changing their name. It doesn't do that right now, it just lets you put whatever you want.

When somebody does change the name, it'll probably have to set the user_id in the post to 0 before it gets put into the database, thus making it look like an anonymous post. There may be something else that needs doing, I haven't looked at it much.

Should be pretty straightforward if you understand PHP. If not, I don't have much time right now.
Re: An option for registered users to post anonymously?
July 15, 2004 02:46AM
Thanks. I'll try to modify it today and see if I can come with a solution.
Re: An option for registered users to post anonymously?
July 15, 2004 03:03AM
My method is to add a new field 'usereal' in table 'phorum_messages' with value 0 or 1.

If the user check the box "use real username", the value is 1. 'author' will be set to 'username'. It's just like normal posting message.

If the user uncheck the box and enter an alias, the value is set to 0. 'author' will be saved as 'alias'.

On read.php, linked_author will link the nickname to the profile whenever the 'usereal' = 1. Otherwise, no link shown.

I'm still trying to figure out how to do it. The code is quite complicated.
Re: An option for registered users to post anonymously?
July 15, 2004 03:31AM
I think I have a better way, now that I'm looking at it.

Create a check box labelled "hide me" or something to that effect.

Create a hidden text filed "anonymous_email" that is set to a fake email address that Phorum will see as valid, such as nobody@hiredgoons.ca . If you have your own domain, use that instead.

In a module using the pre_post hook (such as namedposting does, so you can just modify it), you will want to do the following:

- If the checkbox is unchecked, do nothing

- IF the checkbox is checked:

- Named Posting lets them change their posting name already, we don't need to do that

- Change the user_id in the post to 0. This will make the template see it as an "anonymous" non-logged in poster, and will not link to a profile.

- Change the messages email address to the value of $_POST["anonymous_email"]. If you are posting anonymously, Phorum wants an email address, but since they are logged in we didn't ask for one. This gets around that.

- Lastly, modify the posts "meta" value, adding something like "real_user_id", and set it to the users user id. This won't be visible to any users, but will let you as an admin figure out who wrote the post later should you need to punish them for abuse.


I believe this will be a simpler way then what you are doing, since you can do it entirely within the module/template, and no hacking of Phorum itself is required.


ps - Even if you are going to go with your method, something to remember is that each message has a "meta" field associated with it to store various metadata. You can use that to store information like if the post is aliased or not, rather then creating new database fields. Doing so requires far less hacking, because a module can edit the metadata (see docs/creating_mods.txt for a bit more information).

Basically you just have to unserialize it (unserialize()), change it like a normal array, and serialize() it. Another module that works when reading the post can unserialize() it, look for the information you added in, and make the necessary changes then.



Edited 1 time(s). Last edit at 07/15/2004 03:40AM by Tridus.
Re: An option for registered users to post anonymously?
July 15, 2004 03:41AM
Thank you very much for your advice. I'm still trying to digest it.

One downside for this method is seemingly it makes the post really anonymous, even to the moderators, so it's more difficult to spot the 'bad guys'.
Sorry, only registered users may post in this forum.

Click here to login