Custom form using 'groupselection' functionality
Hello, I am currently developing this site: http://beta.fruittv.tv/
Due to restrictions on showing content to various countries, as well as the aim to make it available in as many languages as possible, I wanted people to sort themselves into groups during registration.
I have successfully used xtmembers to modify the default registration form, but I am unable to change the label 'group' to 'country'.
My ideal situation would be to use my own form. When I try and use this select in my custom registration form with the label 'country', although the form works correctly in all other respects, it does not place the person in the appropriate member group.
I would be very grateful for any assistance, I'd also be happy to submit the 'country group' setup for typolight too if anyone thinks it could be useful.
Example:
http://beta.fruittv.tv/typolight.htm
I have placed both forms in the main column on the above page for comparison
The top form is the registration module, the second is my custom form.
Disclaimers:
I have a good knowledge of html & css, but I am incredibly inept with php.
Sorry about the lack of styling, the reg form normally goes in the right hand column.
Re: Custom form using 'groupselection' functionality
I don't think this is the best way to go about a multilanguage/multipermission Typolight Installation.
Even if you solve this there are problems...
Say you have a single simple page on the website that is built using just 5 content elements (a picture, a headline, 2 texts and a video)
Now go to the backend "Content/Articles" to administer the page (change some content):
Normally you'd end up with one Article in the backend containing the 5 elements.
In your case (in extreme of your scenario) that page contains 5 x 250 elements (1250 elements!) each with its own member group permissions set. Not only that but unless you speak all languages you're going to have a multitude of editors logging in to the same page and stumbling through the same mess! :o
My suggestion is that you DON'T have 250 member groups. Others may have a different opinion.
Rather ask questions and read the forums (also the old one http://typolight.org/forum)about how to acheive a multi-language setup in Typolight, and the advantages of Multiple websites under one Root.
I'm not one to advise on this - but others have done it and there are extensions in the Repository too.
Re: Custom form using 'groupselection' functionality
Hi Ramjet, the main function of the country groups is not languages, I need it to apply viewing permissions by country (viewable, not viewable) to 'guest', 'country that is allowed', 'country that is not allowed'.
Guests would be restricted to navigation/pages for promotional videos/audio and anything that was available to a worldwide audience. I would be editing these rulesets using edit multiple or directly editing the database.
I know they're very interested in which countries visitors and sign-ups come from, but I don't know which countries they are going to ask for the rules to be applied to and I wanted the list to be sensibly formatted down the line. With that in mind I made each of the country groups to match the list. The hits on the website do reflect a very wide range of countries also.
I didn't want to use an ip list to block or redirect by country, I thought my idea was quite a good solution to the requirements, since the country information is being collected anyway.
I (and my clients) expect that some people would lie about their location, this is not really a terrible issue, also IP checkers are not infallible and as long as efforts are being made to limit viewing outside of desired locations then the requirements are satisfied.
I have not really looked into the multi language aspects of typolight. I was hopeful that I was going about it the right way to satisfy both, so thats why I mentioned it, although it was probably a mistake to do so.
Re: Custom form using 'groupselection' functionality
Hi Symian, cool...
First Question...
altering this code (change 'Group' to 'Country') and placing it in your System/dcaconfig.php file will make an update safe change to the label Group.
Code:
$GLOBALS['TL_LANG']['tl_member']['groupselection'] = array('Group', 'Please select a member group you want to join.');
Its from the xtmembers/languages/en/tl_member.php file, but its not update safe if you alter it there.
Second one: all I know about groups is they are not stored in the database as an individual string ("this or that group") but rather as a serialized string that combines them all into one field. This means to be read from and entered into the database they have to go through some php transformations using serialize() and unserialize() [...or something like that].
They are either stored in tl_module table 'reg_groups' field or tl_member table 'groups' field or in the tl_member_group table (or in all of them for various purposes)
Not much help I know, but its all I know about that.
Re: Custom form using 'groupselection' functionality
Thanks Ramjet, i'm going to try that and let you know. I had reached the point of finding member groups were stored as blob in mysql and couldn't get past it
Re: Custom form using 'groupselection' functionality
Thanks again Ramjet. I've successfully changed the default registration form's Group to CountryGroup using dcaconfig.php in the way you suggested :D
Original
system/modules/xtmembers/languages/en/tl_member.php
$GLOBALS['TL_LANG']['tl_member']['groupselection'] = array('Group', 'Please select a member group you want to join.');
Mine
system/config/dcaconfig.php
$GLOBALS['TL_LANG']['tl_member']['groupselection'] = array('Country', 'Please select your country.');
Unfortunately, when I try to do the same to change the below field (the default option of the groupselection select), it does not change it.
Original
system/modules/xtmembers/languages/en/tl_module.php
$GLOBALS['TL_LANG']['tl_module']['reg_select_group'] = '-- Select member group --';
Mine
system/config/dcaconfig.php
$GLOBALS['TL_LANG']['tl_module']['reg_select_group'] = '-- Please select country --';
I tried changing their order in dcaconfig.php and it did not seem to make a difference, any changes I make to the groupselection array are immediately updated.
I can make the changes in the original files and they work, but as you said, that is not a good idea for updating typolight.
Can you see what I'm doing wrong?
Re: Custom form using 'groupselection' functionality
At the bottom of Module RegistrationExtended.php is this:
Code:
public function getGroupSelection()
{
$this->loadLanguageFile('tl_module');
$groups = array("" => $GLOBALS['TL_LANG']['tl_module']['reg_select_group']);
which I think is forcing it to load from xtmembers/tl_module/language.
Re: Custom form using 'groupselection' functionality
I'm running into a different problem with the member registration module as it seems much more problematic to style.
The labels have no #id or .classes, only 'for', meaning I cannot specifically target the dobDay, dobMonth, dobYear labels to hide them when merging them into a single row.
I've posted a proper question about the registration module here: viewtopic.php?f=4&t=887
This brings me back to my original question, is there something stopping me using groupselection in my custom registration form or am I just accessing it wrongly?
Thanks again for your help