[jifty-devel] Login Plugin question

bart bunting bart at bunting.net.au
Sun Jul 16 03:49:52 EDT 2006


John,

Another question :).

My user class has several other fields that are mandatory and thus I
want them to be filled in at signup time.  I thought all i needed to
do was override the arguments sub in the Signup.pm action so that
%fields contained my additional fields as well as display them in the
signup template.

This is not working for me and from the error the signup template
generates I understand it thinks that the extra fields are not valid
fields for that action.  

The warnings look like:[Sun Jul 16 17:35:48 2006] [error] [client 10.0.128.1] FastCGI: server "/home/bart/bestbuds/bin/jifty" stderr: WARN - phone!!update isn't a valid field for BestBuds::Action::Signup=HASH(0x9cc1700), referer: http://bestbuds.bunting.net.au/login?J:C=S196067_530905
[Sun Jul 16 17:35:48 2006] [error] [client 10.0.128.1] FastCGI: server "/home/bart/bestbuds/bin/jifty" stderr: Use of uninitialized value in join or string at /home/bart/bestbuds/share/web/templates/signup line 13., referer: http://bestbuds.bunting.net.au/login?J:C=S196067_530905


For my Signup.pm I have the following:

use warnings;
use strict;

=head1 NAME

BestBuds::Action::Signup

=cut

package BestBuds::Action::Signup;
use base qw/Jifty::Plugin::Login::Action::Signup Jifty::Plugin::Login/;

=head2 arguments

=cut

sub arguments {
    my $self = shift;
    my $args = $self->SUPER::arguments;

    my %fields = (
        name             => 1,
        phone            => 1,
        mobile           => 1,
        street           => 1,
        suburb           => 1,
        postcode         => 1,
        email            => 1,
        password         => 1,
        password_confirm => 1,
    );

    for ( keys %$args ) { delete $args->{$_} unless ( $fields{$_} ); }
    $args->{'email'}{'ajax_validates'}   = 1;
    $args->{'password_confirm'}{'label'} = "Type that again?";
    return $args;
}


1;

and in the signup template I simply use:
$action->form_field('fieldname) to try and display the extra fields.

Am I on the wright track here or have I missed the point entirely?

I'd be glad to contribute something to the docs about how to add extra
fields to the signup once I understand how it works.

Thanks

Bart


More information about the jifty-devel mailing list