Forum OpenACS Q&A: Re: "Logged In?"-Datasource and Template

Collapse
Posted by Tim Adler on
Hey thanks, that already did it. @user_id@ and @user_name@ seem to be set throughout the whole system.

@dirk 😉

Ok, and now for the Basics. I found the setting of user_id and user_name in /acs-subsite/www/master.tcl.
So now I'm eager to also set user_email throughout the system.

[cc_user_name $user_id] sets the user_name. I assume that everything between [] is a functin-call.
So is there a function to get the user's mail@?

master.tcl(/adp) is probably a template. If you use it as site-wide master template, you can set things like @user_id@ and @user_name@ there.

Yes, everything inside [] brackets is a procedure call with the first word being the name of the proc and subsequent ones being the attributes.

I don't know what you mean by user name (the screen name or the real name), but ad_get_user_info gets the basic info (first names, last name, email) for the current user and might thus do the job (see https://openacs.org/api-doc/proc-view?proc=ad_get_user_info&source_p=1).

It sets the $email variable automatically, so if you call it in your site-wide master template's tcl file, you can refer to @email@, @first_names@ and @last_name@ in any adp page which is using that template. I don't know if that's the best practice, though, maybe some wiser people could answer that.

Thanks again for the instant answer. I found that procedure (wow, haven't used that word for a while ;) exactly where u said it would be.

But me being an absolute newbie to TCL, I have no idea how I'm supposed to call it.

I tried just writing [ad_get_user_info] into master.tcl, but that supplies me with Request Error:

invalid command name ""
    while executing
"[ad_get_user_info]"
    ("uplevel" body line 107)
    invoked from within
"uplevel {
How do I do that right? Do I have to give any params or have to do an import of some kind?