wood burning stoves
The moose likes JForum and the fly likes Adding a New User's Information Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "Adding a New User Watch "Adding a New User New topic

Adding a New User's Information

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi Guys!

I would like to add a new obligatory information when a new user register himself.

In Brazil, for example, almost every citizen has an ID number named CPF. With this number is possible to check if that number is from that user, just visiting a government page!
There you can try the following CPF number: 44444444444, discovering that its number owned to MARIA FERRO PERON, for example! ;)

So, I tried to do some changes, like you can see on the below step-by-step:

1. Add a new column to the database:
ALTER TABLE jforum_users ADD user_cpf VARCHAR(11);

2. Edit the file \WEB-INF\config\languages\pt_BR.properties

3. Edit the file \config\database\generic\generic_queries.sql

4. Edit the file \src\net\jforum\view\forum\UserAction.java

5. Edit the file \src\net\jforum\entities\User.java

6. Edit the file \src\net\jforum\dao\generic\GenericUserDao.java

7. Edit the file \templates\default\user_new.htm

8. Deploy the JForum application with Ant

Finally, the screen created in a new register (/user/insert.page) has the field CPF: * correctly added!

And now, with all these changes, the CPF's value is recorded at user_cpf on jforum_users table!

This post was edited sometimes... but could be instructive for future references!

Enjoy it!!!
[originally posted on jforum.net by leandro_salvador]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Maybe the following explanation can help other JForum's newbies in the future:

1. user_new.htm calls pt_BR.properties via
getMessage("User.fillCpf") and

2. user_new.htm calls UserAction.java via

3. UserAction.java calls User.java via

4. User.java calls GenericUserDao.java via
setCpf(String cpf) { this.cpf = cpf; }

5. GenericUserDao.java calls generic_queries.sql via
p.setString(6, user.getCpf());

6. generic_queries.sql calls the database via
UserModel.addNew = INSERT INTO jforum_users (username, user_password,
user_email, user_regdate, user_actkey, user_cpf) VALUES (?, ?, ?, ?, ?, ?)

If anybody whose knows this flow better, please, will be a pleasure be corrected and really understand what JForum does in fact! :P

[ ]'s
[originally posted on jforum.net by leandro_salvador]
I agree. Here's the link: http://aspose.com/file-tools
subject: Adding a New User's Information
It's not a secret anymore!