[MODDB] Groups on Registration and Custom Profile Fields

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Anti-Spam Guide
nasadows
Registered User
Posts: 119
Joined: Wed Mar 25, 2009 3:49 am

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by nasadows »

This is from http://www.phpbb.com/community/viewtopi ... &t=1795135
Auto Assign Group according to Registration field input with password or smt?

I have 1 forum for all of my classmates from Junior High to High School and lastly University friends, and I created 3 User Groups accordingly so that each can access different boards with different permissions in the forum based on who they are.

The thing is, I have to assign all by myself. Sometimes I am not online frequently enough to approve/move a new user to the corresponding group in time. Even in normal conditions they still have to wait some time.

I look at Auto Groups and GORACPF and have hopes, is there a way to do this automatically?

My idea is:

New users can be immediately assigned to a group based on a value/info they enter in a Custom Profile Field, or may be we have a "Group Password" field in registration form that if they enter the correct password of a group
(provided by me in advance when I advertise the forum to that group of ppl :mrgreen: ) they have the instant membership of that group, and inherit all the permissions.

Is there a way to do this? Can anyone help me please. Thanks!
I would love to see this added.
nasadows
Registered User
Posts: 119
Joined: Wed Mar 25, 2009 3:49 am

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by nasadows »

P/S Ive been reading the details of your mod and I think I've found most of my needs in it. :D

However is there a way to "secure" this by using a password or something like suggested in my above post? I don't want my teacher or just any eavesdropper to register an account and gain the reading permissions of sensitive posts so easily :lol: yet I don't want to manually approve it because that takes time, the user still cannot read instantly then what is the use of the mod since I have to add manually without it anyway

Something like: "if you want to join this group, you have to answer a secret question" would be nice :mrgreen:
thanks!
mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by mtrs »

-The password thing is difficult for custom profile based groups, meaning a lot of new work for this mod, as much has rewriting %25 of this mod.
- On the other hand, adding password for the groups listed on registration can be easier. But, I will not add any new feature for the time being.
I abandoned all of my mods.
nasadows
Registered User
Posts: 119
Joined: Wed Mar 25, 2009 3:49 am

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by nasadows »

right now encrypted password may be quite complex, I dont need that much of security, just something like this

There are 2 Custom Profile Fields I'll make:
A: Group selection (this mod itself) that contains Group 1, Group 2 and so on
and
B: a textfield/numberfield (string) to type in at registration. Doesnt have to be "asterisked", encrypted or anything. We can always hide that field after regist, so whatever the user entered will not be revealed to other users or strangers, I think it is safe enough. PhpBB by default supports such a custom profile field, so no need for additional coding. The field will be left blank, the user can enter just about everything.

Only if it matches a certain "password" will it be "valuable". 8-)

So:

On regist the user fills in both fields: Choose the group and enter a string.

If user choose Group 1, then the script checks if the string entered in B matches a certain value the admin setup before hand For ex: Password4Group1
If user choose Group 2, then the script checks if the string entered in B matches the value "Password4Group2" or not, and so on

If Yes: the user will be added to the group immediately, even if it is a Closed or Hidden Group
If No: (that person is a stranger who doesn't know the password phrase and writes a random text): the user is added for validation
If left blank: same as No

The same thing goes if the user choose Group2,3,4 only that now there are a different correspondingvalue set by the admin to compare with whatever the users input.

I'm only a noobie in this, in my view this is simply compare the 2 values to see if they match or not, is that less difficult enough for you to help me with that?

I'm eagerly waiting for your response :)
mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by mtrs »

As I stated before, I will not add a new feature to the mod package. But, since your idea is good and easy to implement, I added below a few code change edits a hard coded group passwords array() to function file. You'll have to edit that file to hardcode enter your group names and auto add group passwords.

Open
includes/functions_group_on_regs.php

Find

Code: Select all

	$group_default = false;
After add

Code: Select all

	$groups_passwords = array(	'male'	 	=> 'securegroups', 
								'female' 	=> 'femalesecurepass',
								'history' 	=> 'historyesecurepass',
								'math'		=> 'algebra45',
						);
Find

Code: Select all

				$pending = (in_array($row['group_id'], $groups_free)) ? 0 : 1;
After add

Code: Select all

				if (isset($user_fields['pf_' . $row['field_name'] . '_password']))
				{
					$pending = ($user_fields['pf_' . $row['field_name']  . '_password'] == $groups_passwords[$row['group_name']]) ? 0 : $pending;
				}
After this code change you should do something else.
Suppose you have gender custom profile fields with male and female options. Also, you have male and female groups connected to gender:male and gender:female cpf fields.

So, create a single text field type password custom profile field
Field identification: "gender_password".
Enter group names and password in $groups_passwords array.

If user enters a correct password on registration for the relevant group, will be added to group automatically. Otherwise, an administrator might have to approve group memberships for hidden and closed groups.
Last edited by mtrs on Tue Sep 29, 2009 2:26 am, edited 1 time in total.
I abandoned all of my mods.
nasadows
Registered User
Posts: 119
Joined: Wed Mar 25, 2009 3:49 am

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by nasadows »

sounds great I'll try my best to understand the code and apply to my situation :P
nasadows
Registered User
Posts: 119
Joined: Wed Mar 25, 2009 3:49 am

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by nasadows »

This mod seems unfinished. I have trouble trying to get the EXISTING functions to work.
I installed it a week ago in 1 of my boards. I saved the state of the database & files BEFORE and AFTER applying the mod

because the mod is unfinished, so I come back to use the BEFORE version to continue apply some more other mods including Authorized URL 104a, then to day I install your mod again on that newer board, and different things happen

2 times I've installed it:
- "Add users to hidden or closed groups without pending" doesnt seem to work at all. I have to accept everyone by hand.
- "Make selected group on registration default" doesnt work on the 2nd time. The first time, even the user is not accepted to the Group, he still gains the Color of that group immediately upon registration. But this second time it is still the same as a normal user who doesnt join any group.

Normally I use Drop-down box Custom Profile Field to "integrate" with your mod. So in registration, the CPField input and the Group Selection seems to join into 1. There is something I didn't notice at the first time so I don't know what happened then maybe also because I didnt tick "Require group selection on registration", but on the 2nd time I notice that if I choose "Require group selection on registration", The reg form doesnt allow me to proceed as if I've left the Group choice blank, eventhough I've chosen 1 group from the Dropdown box


I'm using 3.0.4 in both 2 times.

Maybe there is something wrong, I will check that again. Now I'm too sleepy :) I'm gonna re-read the 8 comment pages of this topic to see if anyone got the same problem with me. I will try to upgrade the board to 3.0.6 whenever it comes

All this makes me never could try to "further modify" the mod to suit my needs according to your recent suggestion yet, :( .
mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by mtrs »

Can you add a zip file link of your includes/ucp/ucp_register.php files? I suspect you make mistakes in your file edits. I recommend using AutoMOD to install this mod.

I need to add that, this mod is recently denied from the first MODDB submission, not because of being unfinished, but due to some coding guidelines issue of using constant and installer. I'm waiting for 3.0.6 to update and test before submitting again.
I abandoned all of my mods.
User avatar
Jaifaime
Registered User
Posts: 170
Joined: Wed Jun 10, 2009 12:16 am

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by Jaifaime »

I started playing around with this mod a few weeks ago, seems to be working as intended thus far. The only gripe I have so far is that after I link a cpf to a group, if I edit the "Field name/title presented to the user" it deletes the link that was associated to it. Took me a little to figure out why this mod would randomly stop working, and why it kept randomly deleting the links I had set between the cpf's and groups. Figured out it was deleting the links I had setup when I changed the Field name, which in turn would make the cpf's not do anything when changed lol.

Other than redoing the cpf group links a bajillion times while I played with the Field names... this mod works very well for my needs, thank you ^^
This account is inactive. Have a nice day.
mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by mtrs »

Jaifaime wrote:Other than redoing the cpf group links a bajillion times while I played with the Field names... this mod works very well for my needs, thank you ^^
I confirm this happens, it is due to phpBB3 cpf behaviour of saving dropdown custom profile fields settings. It resets the fields and loose previous group settings. I will add a warning to mod settings informing this issue.
I abandoned all of my mods.
nasadows
Registered User
Posts: 119
Joined: Wed Mar 25, 2009 3:49 am

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by nasadows »

how about adding a function for this mod to "remember" the fields and re - search for them (and readded them!) when PHPBB values are resetted? that would solve a lot of problems around :P

This is the file you told me to send to you:

http://www.mediafire.com/file/qzn0c00jh ... dows98.rar

Hope you can solve the puzzle :)
mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by mtrs »

ucp_register__01 After install AdminNotifiedOnRegistration.php
this one is not modified
and this one has corrrect edits.
ucp_register__02 After install GroupOnReg100RC5(-this is the file you need).php
I abandoned all of my mods.
nasadows
Registered User
Posts: 119
Joined: Wed Mar 25, 2009 3:49 am

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by nasadows »

Yeah I just sent you the "Revision History" of the same 1 file. Im using the latest edit which is 02. If it has correct edits, how to explain the error?
mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by mtrs »

Can you test the mod on a vanilla-no mod containing phpBB3 board? After that, test on your live site. That would be better I think.
I abandoned all of my mods.
nasadows
Registered User
Posts: 119
Joined: Wed Mar 25, 2009 3:49 am

Re: [RC5] Groups on Registration and Custom Profile Fields

Post by nasadows »

I was planning the same thing when 3.0.6 comes out. I'm graduating so Im kinda busy right now, so testing on 3.0.4 or even 3.0.5 sounds quite time-consuming and a waste to me. from 3.0.4 to 3.0.5 there is a fix in the visibility of the cpf, i dont know if thats the cause of the problem. maybe upgrading to 3.0.5 will solve everything... just a possibility. anyway, I'll wait for 3.0.6 to be 100% sure, thats when were all working on the same version

I hope in the mean time you could have time to do something to help Jaifaime, i think he has a point, the "inconvenience" of that "bug" is quite significant. I've proposed a solution in the last post, hope you read it and could do something about it, or even have better ideas yet

Wish you well & free enough to complete this awesome quest :mrgreen: I know you are busy, even without your work in real life, your contributions for the PhpBB community alone are huge

Return to “[3.0.x] MODs in Development”