Frequently Asked Questions

Apr 16, 2024 - 05:00am

 [F] Frequently Asked Questions  / Operational Questions  / Macros and Templates  / WCTL  /

How do I set user fields from a macro?

Rate This FAQ
 (Not yet rated)

Created On: 12 Mar 1998 8:32 pm
Last Edited: 22 Oct 1999 12:28 pm

Question Printer Friendly

How can I write a macro that will let me set a user variable when I only know the username? The problem is that I want to set a user variable for a user that isn't the current user.

Answer

You can't change the current user (e.g. the client requesting the page),
but you can set the current "author" to achieve the same result:

%% set UserID userLookup(form.username) %%
%% setAuthor( UserID ) %%
%% set author.myVar 0 %%
%% setPath %%

Because setAuthor sets the current location to "none", the final setPath
restores the original location/author.

Example