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


AFAIK you don't have to use set here. ad_get_user_info sets automatically $first_names, $last_name and $email.

I think the problem is that when you are just calling a proc (without doing anything with the return value), you're not supposed to use [ ] brackets around it. So this should be sufficient:

That's it. Nothing more and you get the variables set.

Yep, works also...just tried that.

BTW, as we're all together here again ;-)!
What does

do (Where can I find a reference in the API). Cause it seems that this one is somehow messing up my desired result. Whenever there is no user_info (e.g not logged in) then the server doesn't respond anymore.

I plan to write to proc at the desired position again and leave out the operations in the catch block.


Just use the search box in and you'll find the explanation for every proc in the system :-) (in this case,

In fact that proc doesn't seem to fit too good in this situation, since it returns a http error if the user_id is not defined. You could get around this by doing something like this:

set user_id [ad_get_user_id]
if { $user_id != 0 } {

This blows away part of the handiness of this function, though. In general I don't understand why ad_get_user_info returns an http error in the first place. At least it narrows the use of it a lot. Maybe that's why e.g. the default index page of an oacs installation uses an ad hoc sql query to get the user info. I think there should definitely be an allround proc for this.