Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Add Multiple images and videos to CMS.User View modes: 
User avatar
Member
Member
matt-awg - 12/10/2013 1:17:04 PM
   
Add Multiple images and videos to CMS.User
I am looking to use the built in features of the system USER so I don't have to build out a custom module but I need to add multiple images and embedded youtube videos and links to the system table... which upon researching, I realized was impossible. I created a custom document type and added some custom code in the object events so that whenever a user is added to a special role I created, they automatically get a document of this new custom type created for them. I also handle the reverse, when someone is removed from this special role, I delete their custom document type. On this custom document type, I added a document attachments field and then created a page with the edit user contribution web part to allow users to add/edit their images. This is not the most elegant approach but it is basically working. I am working on the styling but I think this will work except I can't come up with a way to also allow users to add multiple embedded youtube videos and also multiple website links (e.g. their facebook page, their personal website, twitter, etc... ). It needs to support an unlimited number of links and videos. I was hoping for something similar to the "document attachments" field type but I don't think anything like that exists. This process is already getting extremely complex so I am hoping for something simple where users won't have to go to three different places to manage all this stuff. I had the idea of creating custom document types for links and videos and then I think it would be possible to user the user contribution web part to allow them to add links and videos under the custom document type I already created for their profile images but again, this seems like it is getting overly complex. Is there an easier way to do this that I am just not thinking of here? Let me know if I need to explain this in more detail... I was trying to be as brief as possible.
Thanks!

User avatar
Member
Member
matt-awg - 12/10/2013 1:43:17 PM
   
RE:Add Multiple images and videos to CMS.User
Just to clarify what I did... my ideas were based off this documentation:

http://devnet.kentico.com/docs/devguide/index.html?example_editing_partner_profile.htm

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 12/12/2013 1:20:13 AM
   
RE:Add Multiple images and videos to CMS.User
Hi Matt,

Thank you for your message.

I dont think the approach you would like to go si the best one, its not really that friendly and it would be hard to maintain in the future. I was thinkink of a different, more clean approach.
It seems that you have quite a knowledge of programming so it should not be that hard.

I was thinking of having a document type of UserVideo, UserLink etc.. which would for example hold a single instance of UserVideo. In this document type you would have UserGUID which would serve as a foreign key so that you know which user uploaded this instance of document type. You can also do this in Custom tables, its fairly up to you which way you want to go.

Now on the front site you will need to create some your form which in code behind will be workign with these document types/custom tables. Creating, editing, removing them.. It should be fairly easy to code through our API. You can see examples of that in http://devnet.kentico.com/docs/devguide/documents_api_examples_overview.htm

Kind regards,
Richard Sustek

User avatar
Member
Member
matt-awg - 12/13/2013 2:53:10 PM
   
RE:Add Multiple images and videos to CMS.User
Thanks Richard,

Basically I finished with the approach that I had already mentioned. I added fields to the CMS User table that were just text data type fields. I created a custom document type for this special type of User and added document attachment type field for their profile images. Then I created two new custom document types, one for Links and one for Videos. I used custom versions of the user contribution list and edit web parts to allow users to manage the Link and Video custom documents under their custom User document, as well as manage their profile images. I already had the triggers in place using object events that handling creating the custom User document when a user is added to the special role and the reverse, deleting that custom User document when a user is removed from the role (or deleted). I tested it and it seems that this automatically deletes the user's Links and Videos documents since they are all under their custom User document in the content tree.

Not sure if this was the most elegant way to do it but it seems to be working so far!

Thanks,
Matt

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 12/17/2013 4:25:31 AM
   
RE:Add Multiple images and videos to CMS.User
Hi Matt,

Glad to hear its working for you:) Its kind of a workaround but as long as it works for you and you dont encounter any issues you can stick with it. Thank you for sharing.

Kind regards,
Richard Sustek