Skip to content

Commit

Permalink
Item11996: fixed expansion of variables in meta data
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/NewUserPlugin@15137 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Jul 11, 2012
1 parent afde58d commit b467078
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions data/System/NewUserPlugin.txt
Expand Up @@ -63,6 +63,7 @@ This work is partly funded by
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 11 Jul 2012 | fixed expansion of variables in meta data |
| 20 Jan 2012 | fixed creating user profiles by not using deprecate Func apis; \
added better view template for ldap users; \
added way to configure new user templates via =configure= |
Expand Down
11 changes: 7 additions & 4 deletions lib/Foswiki/Plugins/NewUserPlugin.pm
Expand Up @@ -26,7 +26,7 @@ use Error qw(:try);
use constant DEBUG => 0; # toggle me

$VERSION = '$Rev: 3642 (2009-04-23) $';
$RELEASE = '2.30';
$RELEASE = '2.31';
$SHORTDESCRIPTION = 'Create a user topic if it does not exist yet';
$NO_PREFS_IN_TOPIC = 1;

Expand Down Expand Up @@ -150,15 +150,18 @@ sub createUserTopic {
my $wikiName = Foswiki::Func::getWikiName();
my $loginName = Foswiki::Func::wikiToUserName($wikiName);
$text =~ s/\$nop//go;
$text =~ s/\%25USERNAME\%25/$loginName/go;
$text =~ s/\%25WIKINAME\%25/$wikiName/go;
$text =~ s/\%25WIKIUSERNAME\%25/$wikiUserName/go;
$text =~ s/\%USERNAME\%/$loginName/go;
$text =~ s/\%WIKINAME\%/$wikiName/go;
$text =~ s/\%WIKIUSERNAME\%/$wikiUserName/go;
$text =~ s/\%EXPAND\{(.*?)\}\%/expandVariables($1, $wikiName, $usersWeb)/ge;
$text =~ s/\%STARTEXPAND\%(.*?)\%STOPEXPAND\%/Foswiki::Func::expandCommonVariables($1, $wikiName, $usersWeb)/ges;

foreach my $field ($meta->find('FIELD'), $meta->find('PREFERENCE')) {
$field->{value} =~ s/\%USERNAME\%/$loginName/go;
$field->{value} =~ s/\%WIKINAME\%/$wikiName/go;
$field->{value} =~ s/\%WIKIUSERNAME\%/$wikiUserName/go;
}

writeDebug("patching in RegistrationAgent");

my $session = $Foswiki::Plugins::SESSION;
Expand Down

0 comments on commit b467078

Please sign in to comment.