r6 - 25 Apr 2004 - 07:29:44 - PeterThoenyYou are here: TWiki >  Codev Web > ExpandVariablesInNewUserTemplate
Tags:
, create new tag

Implemented: Expand Variables in New User Template

The register script expands now the same variables for NewUserTemplate as the edit script does for WebTopicEditTemplate, namely:

Variable Explanation
%DATE% Current date
%USERNAME% Login name of new user,e.g. "jdoe"
%WIKINAME% WikiName of new user, e.g. "JonDoe"
%WIKIUSERNAME% Web.WikiName of new user, e.g. "Main.JonDoe"
%URLPARAM{"name"}% Expand URL parameters
%NOP{...}% Gets removed. Use it to remove access control from the template topic
%NOP% Gets removed. Use it to prevent search from hitting the template topic

This change for CairoRelease was initiated by Support.NewUserTemplateHasNoNEWWIKINAME.

Is in TWikiAlphaRelease and at TWiki.org.

Change:

RCS file: /cvsroot/twiki/twiki/bin/register,v
retrieving revision 1.35
diff -c -r1.35 register
*** register    5 Jan 2003 02:38:11 -0000       1.35
--- register    12 Mar 2003 06:37:23 -0000
***************
*** 189,194 ****
--- 189,203 ----
              }
          }
          $text = "$before$after";
+
+         # expand limited set of variables
+         # NOTE: Keep it in sync with the edit script
+         my $today = &TWiki::getGmDate();
+         my $userName = $remoteUser || $wikiName;
+         $text =~ s/%DATE%/$today/go;
+         $text =~ s/%USERNAME%/$userName/go;               # "jdoe"
+         $text =~ s/%WIKINAME%/$wikiName/go;               # "JonDoe"
+         $text =~ s/%WIKIUSERNAME%/$webName.$wikiName/go;  # "Main.JonDoe"
+         $text =~ s/%URLPARAM{(.*?)}%/TWiki::handleUrlParam($1)/geo;  # expand URL parameters
+         $text =~ s/%NOP{.*?}%//gos;  # Remove filler: Use it to remove access control at time of
+         $text =~ s/%NOP%//go;        # topic instantiation or to prevent search from hitting a template
+
          $meta->put( "TOPICPARENT", ( "name" => $TWiki::wikiUsersTopicname ) );
          &TWiki::Store::saveTopic( $webName, $wikiName, $text, $meta, "", 1 );
      }

-- PeterThoeny - 12 Mar 2003

Added %USERNAME% and %WIKINAME%, see ExpandUsernameAndWikinameInTemplateTopics.

-- PeterThoeny - 18 Oct 2003

Docs updated: In TWikiInstallationGuide, added pointer to template topic docs.

-- PeterThoeny - 25 Apr 2004

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r6 < r5 < r4 < r3 < r2 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo