aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/User.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-03-30 12:44:59 +0100
committerStruan Donald <struan@exo.org.uk>2012-03-30 12:44:59 +0100
commit32a74ddaf0f203ef9c9a28dc08c650c643e09de1 (patch)
tree570694dd21f36b562d38e8d5e1ffd8ddc848c70b /perllib/FixMyStreet/DB/Result/User.pm
parentff3926d0599b90f05e12b949205d8cc6e35df3be (diff)
add first name and last name boxes for bromley
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/User.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index 56d726a8d..7b0ffca73 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -172,4 +172,22 @@ sub belongs_to_council {
return 0;
}
+=head2 split_name
+
+ $name = $user->split_name;
+ printf( 'Welcome %s %s', $name->{first}, $name->{last} );
+
+Returns a hashref with first and last keys with first name(s) and last name.
+NB: the spliting algorithm is extremely basic.
+
+=cut
+
+sub split_name {
+ my $self = shift;
+
+ my ($first, $last) = $self->name =~ /^(\S*)(?: (.*))?$/;
+
+ return { first => $first, last => $last };
+}
+
1;