61
theFrenchGuy
Re: Registration Extra fields?

Ah ok

I've an other idea. I can do a single form for all groups. For that, i've seen fields "group select" and "group multiselect".
Now, I would like to know, how I can delete, in the group select box, the field webmaster. Cause I don't want that my futurs users will be able to be registrate with webmaster level.

And, while in here , it's possible to choose which group will be the first in the select box ? Or it just can stay in chronological order ?

Thx again

62
TheFinni
Re: Registration Extra fields?
  • 2007/1/28 17:35

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi theFrenchGuy,

You might be able to control to which group the new user is added by the following trick.

Look for the following code in the register.php file:

if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS$newid)) {
        return 
_PROFILE_MA_REGISTERNG;
    }


This is what determines to which group the member is added once he/she has been inserted into the users table.

The XOOPS_GROUP_USERS is defined as 2 in mainfile and you could put any number if you wish.

So my idea is that you could tag the group you wish the user to be inserted in in the URL string.

So have a link posted like: "Coaches Register Here" which has a link like http://www.mydomain.com/modules/smartprofile/register.php?gid=7 where 7 is the groupid number for group "Coaches"

then just before the first mentioned code above you could add:

$gid_to_insert = isset($_GET['gid']) && $_GET['gid'] != 1 ? $_GET['gid'] : XOOPS_GROUP_USERS;

If someone changes the gid to 1 (webmasters) the group insert would default to users.

Then change the first mentioned code to:

$gid_to_insert = isset($_GET['gid']) && $_GET['gid'] != $_GET['gid'] : XOOPS_GROUP_USERS;

if (!
$member_handler->addUserToGroup($gid_to_insert$newid)) {
        return 
_PROFILE_MA_REGISTERNG;
    }


Naturally this doesn't mean only coaches could use the registration form...You could use some other field to validate they are.

As for showing particular fields in individual forms it could be achieved by adding another set of permissions. You could duplicate the admin permissions and add a set called "smartprofile_reg" permission and then use it in the form file. But it's a little bit trickier if you're new to Xoops.

I haven't tested this idea but give it a try if you feel like it.

Hope that helps a bit!

63
jegelstaff
Re: Registration Extra fields?

Quote:

vaughan wrote:
Quote:

theFrenchGuy wrote:
I use smartprofile in my XOOPS site. In my website, I've 3 differents groups and I wanna create one registration form for each one. How I can do that ?


there's a hack called registration codes which has the possibility to assign registrations to a particular group based on a code (like a promotion code) that the user enters on registration. but having seperate registration forms has not been done.


Hello,

I'd just like to clarify...separate registration forms has been done. FrenchGuy, you can do exactly what you want with the Registration Codes module, it's not a hack, although it does involve swaping out three core files.

Registration Codes and Formulize work together to let you create a custom registration form. You make one form in Formulize that acts as your registration/user profile form.

Here's the fancy part that gives you separate forms for different groups...Formulize lets you control which groups of users should see which questions in a form. So you could have fifteen questions in your user profile form, and five of them would be for Group A, five for Group B and five for Group C. You could have some that are for all three groups, or some that are for just A and C, etc.

The Registration Codes module lets you create codes that users must use to register on your site. Each code is associated with certain groups in your site. So you could create a code for Group A, and a code for Group B and a code for Group C.

To use a code, users either go to the register.php page, and type in the code, or you can add the code to the URL like this:

http://www.yoursite.com/register.php?code=abcd56

After that, the user gets the registration/user profile form that you have created, and only the questions relevant for their particular group(s) are displayed to them.

From your description, it sounds like this is exactly what you need. You can get Formulize and Registration Codes here:

http://www.freeformsolutions.ca/formulize

(That redirects to our dev.xoops.org area.) If you have any questions about usage, check the detailed readme files, especially the one for Registration Codes, setting up and configuring the form is not trivial unfortunately.

If you have further questions or need help, please post in the forums over there in our area on dev.xoops.org and we will be happy to give pointers.

Good luck,

--Julian
Technical Architect - Freeform Solutions
Formulize - custom registration forms, ad hoc forms and reports

64
theFrenchGuy
Re: Registration Extra fields?

I'm grateful to you for all your help !

I gonna try your solution jegelstaff, it's seems to be what i'm looking for.

thx again

65
jegelstaff
Re: Registration Extra fields?

I should mention that the French translation is not complete in Registration Codes nor Formulize.

The good news is that the text that users see when they register and view their profile information, it has all been translated.

But there is a lot of text that is English only on the admin side, and on some of the more advanced screens on the user side (but those aren't used in the registration/profile system).

So for registering users it's probably okay. For other uses, you might need to do some translation if you or your users need to work in French.

--Julian
Technical Architect - Freeform Solutions
Formulize - custom registration forms, ad hoc forms and reports

66
TheFinni
Re: Registration Extra fields?
  • 2007/1/29 20:13

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Ok, now I have to check-out the Formulize myself. Sounds like a good module!

For those who are using the SmartProfile module I have a couple more fixes.

The form seems to miss the "name" tag in templates/smartprofile_register.html. Without the name the javascript xoopsFormValidate validation won't function.

Simply add 'name="<{$regform.name}>"' to the file.

I also noticed the insertBreak didn't produce Category headings in the template. And I wanted to be able to tell the user if a field was required or not. I'm going to copy/paste my new version of the assign function of the register.php file.

PLEASE NOTE THIS IS FOR THE PHP4 version from xooobs.net (you can modify the if object else easily for php5).

function assign($form$tpl) {
global 
$xoopsTpl;//TN added
    
    
$js $form->renderValidationJS(); //TN moved from bottom of function so I can mark fields as required
    
    //TN get/parse required fields
    
preg_match_all('/myform.[a-zA-Z0-9_]+.value/i'$js$match);
    
$req_fields $match[0];
    
$patterns[0] = '/myform./';
    
$patterns[1] = '/.value/';
    
$replacements[0] = '';
    
$replacements[1] = '';
    
$req_fields preg_replace($patterns$replacements$req_fields);

    
$i 0;
    
$elements = array();
    foreach ( 
$form->getElements() as $ele ) {
        if (
is_a($ele,'XoopsFormElement')) {
            
$n = ($ele->getName() != "") ? $ele->getName() : $i;
            
$elements[$n]['name']      = $ele->getName();
            
$elements[$n]['caption']  = $ele->getCaption();
            
$elements[$n]['body']      = $ele->render();
            
$elements[$n]['hidden']      = $ele->isHidden();
            if (
$ele->getDescription() != '') {
                
$elements[$n]['description']  = $ele->getDescription();
            }
            
//TN added for required field (getRequired() doesn't work here so use array from preg_match_all above:
            
if((isset($req_fields) && is_array($req_fields)) && (in_array($n,$req_fields))){
                
$elements[$n]['required'] = true;
            }
            
//TN EOF
        
} else {//TN not an object and likely insertBreak. let's assign:
            
$elements['ibreak'.$i]['ibreak'] = $ele;
        }
        
$i++;
    }

    
//js validate form:$xoopsTpl->assign($form->getName(), array('title' => $form->getTitle(), 'name' => $form->getName(), 'action' => $form->getAction(),  'method' => $form->getMethod(), 'extra' => 'onsubmit="return xoopsFormValidate_'.$form->getName().'();"'.$form->getExtra(), 'javascript' => $js, 'elements' => $elements));
     
$xoopsTpl->assign($form->getName(), array('title' => $form->getTitle(), 'name' => $form->getName(), 'action' => $form->getAction(),  'method' => $form->getMethod(), 'javascript' => $js'elements' => $elements));
}


Then you can modify the smartprofile_register.html file to use "$element.ibreak" and "$element.required".

Here's my template:

<div>
    <{foreach 
item=step from=$steps key=stepno name=steploop}>
        <{if 
$stepno $current_step}>
            <
a href="<{$xoops_url}>/modules/smartprofile/register.php?step=<{$stepno}>">
        <{elseif 
$stepno == $current_step}>
            <
b>
        <{/if}>
        <{
$step.step_name}>
        <{if 
$stepno $current_step}>
            a>
        <{elseif 
$stepno == $current_step}>
            b>
        <{/if}>
        <{if !
$smarty.foreach.steploop.last}>
            &
nbsp;»
        
<{/if}>
    <{/foreach}>
div>

<{if 
$stop}>
    <
div class='errorMsg'><{$stop_headline}><{$stop}>div>
    <
br clear='both'>
<{/if}>

<{if 
$confirm}>
    <{foreach 
item=msg from=$confirm}>
        <
div class='confirmMsg'><{$msg}>div>
        <
br clear='both'>
    <{/foreach}>
<{/if}>
<{if 
$regform}>
<
span style="font-size: x-small; color: red;"><{$smarty.const._PROFILE_AM_REG_REQ_TXT}>span>
    <
form name="<{$regform.name}>" id="<{$regform.name}>" action="<{$regform.action}>" method="<{$regform.method}>" <{$regform.extra}> >
        <
table width="100%" class="outer" cellspacing="1">
            <
tr><th colspan="2"><{$regform.title}>th>tr>
            <{foreach 
item=element from=$regform.elements}>
                <{if 
$element.ibreak}><{$element.ibreak}><{else}>
                <{if !
$element.hidden}>
                    <
tr valign='top' align='left'>
                        <
td class='head'><{$element.caption}><{if $element.description != ""}><br /><span style="font-weight: normal; font-size: x-small;"><{$element.description}>span><{/if}>td>
                        <
td class="<{cycle values='odd, even'}>"><{$element.body}><{if $element.required}> <span style="font-size: x-small; color: red;">*span><{/if}>td>
                    tr>
                <{/if}><{/if}>
            <{/foreach}>
        table>
        <{foreach 
item=element from=$regform.elements}>
            <{if 
$element.hidden}>
                <{
$element.body}>
            <{/if}>
        <{/foreach}>
    form>
<{
$regform.javascript}>
<{/if}>

67
irishrow
Re: Registration Extra fields?
  • 2008/2/20 22:52

  • irishrow

  • Just popping in

  • Posts: 9

  • Since: 2007/2/2 1


I'm still trying to get my two step registration to work.

The module runs fine, but I cannot see the registration page unless I'm already logged in in that browser (using a second tab).

When I'm just "public", it will not give me permission to go to registration.

I have:

1. Set up a .htaccess redirect that is working; I can go directly to /modules/smartprofile/register.php and it won't allow access.
2. Gone to the SMARTPROFILE module and given every possible authority to Anonymous user (along with every other user). Same for visibility and field permissions.

Is there some other permission I need to set in XOOPS to get this module to begin allowing registration?

68
irishrow
Re: Registration Extra fields?
  • 2008/2/20 22:59

  • irishrow

  • Just popping in

  • Posts: 9

  • Since: 2007/2/2 1


Believe it or not, I've actually read that thread eight times and I still don't get it. One user indicated:

Got it!!, Just need to give permission to access this module to anonymous users as well.

Within /modules/smartprofile I've gone to permissions and permitted everything and set visibility to everyone for every field.

I've spent two days trying to get this to work. I'm sure it's simple, but my question is:

"Where exactly do I go to set these module permissions...it cannot be in smartprofile, because, I've set all of them.

Is there a problem using the htaccess redirect?? It works, but gets no access.

69
jegelstaff
Re: Registration Extra fields?

In XOOPS, each group can be assigned permission to access or administer each module. You do this in the System Admin->Groups area.

Modify the Anonymous Users group, and make sure that group has module access rights for SmartProfile.

If a user is not a member of a group that has access rights to a module, then that user will not be able to access it, regardless of the permissions within that module.

Users who aren't logged in are treated as members of the "Anonymous Users" group.

Make sense?

--Julian
Technical Architect - Freeform Solutions
Formulize - custom registration forms, ad hoc forms and reports

70
irishrow
Re: Registration Extra fields?
  • 2008/2/20 23:13

  • irishrow

  • Just popping in

  • Posts: 9

  • Since: 2007/2/2 1


Thank you isn't enough, really.

I've been looking for this for two days. It now works. I really appreciate your kind assistance!

Login

Who's Online

228 user(s) are online (62 user(s) are browsing Support Forums)


Members: 0


Guests: 228


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits