I think you could use the 'member type' feature. Create a new member type and add a property to it e.g. 'UserImage' of type 'Media picker'. Then assign this member type to the members and set the value of this property for each member to the corresponding image. Then you can access its value for instance in Xslt:
Well thank you for your very quick response. I have added a new member type but can't see how to add a property. Iseem to have fallen at the first hurdle.
I'm somewhat of a novice at Umbraco. Given that each page seems to have the author details, I I windered if there was a simple way to call the relevant media folder,
If you could point me in the direction of the 'add a property' function then I'll give your method another try.
When you select your member type in the tree on the left there'll be three tabs in the main area of administrator's window - two of them named 'Generic Properties' and 'Tabs' are absolutely the same as the corresponding tabs of the document type editor. They allow to add properties to the member type and organise them to tabs absolutely the same way as in the case of a document type.
I want the top banner to change depending on the media folder that belongs to the editor who create the page.
Each editor has thier own separate media folder, they don't share the same folder. So each editor can upload a different banner (test.jpg) to their media folder. Then when their pages are displayed, it will be their chosen banner that is displayed.
I don't want users to be able to have access to the folders of other users. This was my reason for letting each user have their own media folder.
Hi. There's some problem with this. There's no support of access control for Media like the one for Documents in Umbraco. So, any user that has access to the Media section of the backoffice has full control to the whole media library. However, you can workaround this in two ways.
One option is to dissalow access to the Media section of the backoffice for the users in question. (backoffice -> Users -> user -> Sections). Then you will need to create some custom upload page that lets these users upload their banners without logging in the backoffice and will save the uploaded image to a media folder depending on the current user.
Simpler way can be to create special document type to hold a banner image in a property of type 'Upload'. Then you can create a separate document of this document type for each user and set access right to it so that each user has access to his separate document with his own banner.
Oh. Sorry, I have just recalled a feature that I missed completely. You can also assign 'Start Node in Media Library' to any user. So that a user can access only a subtree of the whole media library. Probably it's exactly what you need in your case.
As for a fee - thank you for your offering, but I'm not going to ask for this for any kind of forum advisory :-) However, currently from time to time I work as a freelance consultant/developer on web development with ASP.NET, Umbraco, DotNetNuke, and SharePoint. If you know someone who can be ineterested in my teleworking then you can let me know :-)
How to identify the media folder...
Hello,
Here's the scenario...
I've got two users, each with their own unique media folder.
They each have an image in their folder called test.jpg. The two images are not the same.
The pages they create each share the same template.
Here's what I want to do.........
I want the published webpages to display the relevent test.jpg image dependant on the author's media folder.
I hope that someone might be able to help.
Thanks
Steve
I think you could use the 'member type' feature. Create a new member type and add a property to it e.g. 'UserImage' of type 'Media picker'. Then assign this member type to the members and set the value of this property for each member to the corresponding image. Then you can access its value for instance in Xslt:
and so on.
Well thank you for your very quick response. I have added a new member type but can't see how to add a property. Iseem to have fallen at the first hurdle.
I'm somewhat of a novice at Umbraco. Given that each page seems to have the author details, I I windered if there was a simple way to call the relevant media folder,
If you could point me in the direction of the 'add a property' function then I'll give your method another try.
Thanks
Steve
When you select your member type in the tree on the left there'll be three tabs in the main area of administrator's window - two of them named 'Generic Properties' and 'Tabs' are absolutely the same as the corresponding tabs of the document type editor. They allow to add properties to the member type and organise them to tabs absolutely the same way as in the case of a document type.
I hadn't read your first post properly. I was looking at 'Users' instead of 'Members'.
But I'm not sue that the 'Members' method would work as I want the image to be dependant on the media folder of the author.
I'm not sure as I'm very new to this.
Steve
So, you want just to show different images depending on the current page's author, do you?
Yes. That's it.
Maybe I didn't really explain my needs properly.
I want the top banner to change depending on the media folder that belongs to the editor who create the page.
Each editor has thier own separate media folder, they don't share the same folder. So each editor can upload a different banner (test.jpg) to their media folder. Then when their pages are displayed, it will be their chosen banner that is displayed.
Do you think this is possible to acheive?
Steve
I forgot to say that the image file would always be called test.jpg.
So the only thing I'm trying to work out is how to identify the folder itself.
Then I could follow the solution with /test.jpg
This would present the image.
Well. I would do the next:
1) Create some common parent folder, say 'Banners', for all user's subfolder (in the media library);
2) For each user create a subfolder named, for instance with the the same name as a user is;
3) Under each user's folder create an image item named 'test.jpg' and upload an image file to it;
After these steps you will have a structure like this in your media library:
Media
Banners
admin
test.jpg
some_user
test.jpg
another_user
test.jpg
... and so on
4) Now create an Xslt file e.g. banner.xslt:
5) Create a macro for this xslt, name it 'Banner'. Add a parameter to the macro with the alias 'bannersFolder' and the type 'mediaCurrent'
6) Place the macro to the page you need and set the value of the 'bannersFolder' parameter to the folder created in the step #1
I hope it will help.
Hello Rodion,
Thank you for your continued help on this.
Will your method let 'User's upload their own banner image such as test.jpg?
How will I give additional access to other folders for the users?
I don't want users to be able to have access to the folders of other users. This was my reason for letting each user have their own media folder.
Then if a User want to change the banner (test.jpg) image they would simply overwrite the existing one in their folder.
Any ideas?
Steve
I don't want users to be able to have access to the folders of other users.
This was my reason for letting each user have their own media folder.
Hi. There's some problem with this. There's no support of access control for Media like the one for Documents in Umbraco. So, any user that has access to the Media section of the backoffice has full control to the whole media library. However, you can workaround this in two ways.
One option is to dissalow access to the Media section of the backoffice for the users in question. (backoffice -> Users -> user -> Sections). Then you will need to create some custom upload page that lets these users upload their banners without logging in the backoffice and will save the uploaded image to a media folder depending on the current user.
Simpler way can be to create special document type to hold a banner image in a property of type 'Upload'. Then you can create a separate document of this document type for each user and set access right to it so that each user has access to his separate document with his own banner.
Oh. Sorry, I have just recalled a feature that I missed completely. You can also assign 'Start Node in Media Library' to any user. So that a user can access only a subtree of the whole media library. Probably it's exactly what you need in your case.
Hello Rodion,
Thanks again with your persistance on this....
Yes. That was what I was thinking. I am assigning each user with a start folder in the media library.
My problem is that I don't know how to call this property using xslt or some other method.
I have discovered that the property I want to get is startMediaID. I just don't know the code that would let me use it in a template.
I want to do something like ...
< img " src="startMediaID/test.jpg" />
wherestartMediaID is a variable and test.jpg is the contstant, always test.jpg
Does that make any more sense?
Steve
Hi Rodion,
Did you have any more ideas on this? Or do you think it's not possible?
Steve
Hi. You can get the ID of a user's start media node with a custom script inside your xslt.
Insert such a snippet into your xslt:
And then you can use user:GetStartMediaId() later in this xslt exactly like any extension function.
You can read more on this on MSDN: http://msdn.microsoft.com/en-us/library/ms256042.aspx
Hello Rodion,
I am sure that this must be the answer. But I am too much of a beginner to know how to implement it.
Is it possible for me to email you directly with a question?
Steve
Hello Rodion,
Do you do freelance?
Steve
Hi. Below is a complete xslt script to perform the rendering that you need:
As for a fee - thank you for your offering, but I'm not going to ask for this for any kind of forum advisory :-) However, currently from time to time I work as a freelance consultant/developer on web development with ASP.NET, Umbraco, DotNetNuke, and SharePoint. If you know someone who can be ineterested in my teleworking then you can let me know :-)
And, yeah, feel free to contact me by e-mail (r.novoselov at gmail.com) if you need.
Hello Rodion,
Your answer was very helpful to me. I have been looking at using Umbraco 5 which does not use xslt.
Is it possible to perform the same function using Razor?
Steve
is working on a reply...