current user as default value

Author Message

Marko Žmak

Sunday 26 September 2004 2:54:55 pm

I have a text field attribute called "author" in my class called "page". I would like that when a logged user creates a new "page" object (from the admin interface), the "author" value is set by default to his name.

For example, when the user John Smith creates a new "page" object, in the input line for the "author" attribute should be written "John Smith".

How do I do that?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Wednesday 29 September 2004 7:03:18 am

Please, does anyone know this one? How do I set the username of the current user to be used as default value for a field?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Frederik Holljen

Wednesday 29 September 2004 7:39:54 am

It is in the doc:http://ez.no/ez_publish/documentation/reference/data_fetching/user/current_user

Marko Žmak

Thursday 30 September 2004 6:03:49 pm

Well, that't the way to fetch the current user, but I want something else. To set the curremt user as default in a text box in the admin interface of EZ publish. It seems that I should modify the template in the admin site but I rather wouldn't. Is there any other way?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Thursday 30 September 2004 6:04:49 pm

P.S. somethin similar to the option of setting the default date to current date like it is possible for the date attribut

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Frederik Holljen

Thursday 30 September 2004 11:45:27 pm

I don't quite get you. In a text box you can only put some default "text" value right. So isn't what you want to fetch the current user and put his name in this text box? (When you create a new object?)

Marko Žmak

Sunday 03 October 2004 3:32:40 pm

Well, that's one sollution, but for that I have to change the EZ code of the amdin interface on my site, and I'd rather avoid that. I tought that it can be done in some other way.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Kjell Knudsen

Tuesday 05 October 2004 5:48:23 am

Hi,

I also see the need for this. And am not 100% of where and how to setup such an override. Would it be in edit_attribute.pl?

It's a bit similar to what the tip a friend feature does - defaults to name and e-mail of logged in user but lets you change. Could actually be a nice thing to be able to use specify such defaults directly in the class attributes.

But this is what you say is not possible Fredrik?

-kjell

Kjell Knudsen
http://www.icbl.org

Frederik Holljen

Tuesday 05 October 2004 5:55:41 am

It can be done by changing the templates. Simply fetch the user objects and put the value you need into the input field. Since this is the administration interface I suggest you use an override to make it easier for you to upgrade.

I know you are looking for another way, unfortunately it is not there :/

Marko Žmak

Monday 11 October 2004 5:38:12 am

It would be nice if something like this is made available in future versions of EZ, if it exists for the date attribute, why shouldnt for other.

In my opinion, a great thing would be to enable users to put something like this as a default value:

<$current_user.name>

or:

<$node.owner.name>

so when the attribute is displayed for editing, the value of the corresponding variable is set as default. Does anyone else like this idea? Should we suggest it in the "Suggestion" forum?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Paul Borgermans

Monday 11 October 2004 8:10:33 am

Sorry

I think you should not use a textfield for that. The standard author datatype does this as well as

http://ez.no/community/contributions/datatypes/personlist_datatype (and a lot more if you want)

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Marko Žmak

Tuesday 12 October 2004 8:51:17 am

Thanks for the tip, very usefull. It's just what I needed.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.