Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mila Pandurska 43 posts 190 karma points
    Dec 17, 2017 @ 20:44
    Mila Pandurska
    0

    Create Users which can edit Umbraco Nodes

    Hi, I have a web site with the following structure: Home - City 1 - Bar 1 - Bar 2 .... - City 2 - Bar 21 - Bar 22 - ..... The web site will have a registration form for bar owners and each bar owner can edit his own bar. For example: Bar Owner 1 can edit node Bar 1, Bar Owner 2 can edit Bar 2 and so on.. In addition on the registration form for bar owners I need to create sever additional fields as phone, address and some other information. Is it possible and what is the best approach?

  • Sven Geusens 169 posts 881 karma points c-trib
    Dec 18, 2017 @ 16:55
    Sven Geusens
    0

    Yes you can, In a nutshell:

    Learn how to make a custom form in umbraco https://our.umbraco.org/documentation/reference/templating/mvc/forms

    When you have validated the data, use the content service to create a node. https://our.umbraco.org/documentation/reference/management/services/contentservice

    when you save the node you will get an ID, save this for later.

    Next use the memberservice to create a member. The documentation is a bit lacking here, but with a bit of code inspection you can do something like this.

    var userService = ApplicationContext.Current.Services.UserService;
    var userType = "myUserType";
    var newUser = userService.CreateWithIdentity("username", "email",     "password_will_be_hashed_by_umbraco", userType);
    newUser.StartContentIds = NodeIdFromBefore;
    userService.Save(newUser);
    
  • Mila Pandurska 43 posts 190 karma points
    Dec 19, 2017 @ 15:46
    Mila Pandurska
    0

    Thanks for the reply. My problem actually is how to save the additional data - address, phone for the Umbraco Users. I know that this functionality is not a problem for Members, but in my case I need to work with Umbraco Users as they will edit Umbraco Nodes.

  • Marcio Goularte 374 posts 1346 karma points
    Dec 19, 2017 @ 15:57
    Marcio Goularte
    0

    Unfortunately this does not have it in the Core. Only if you create a custom table for this. This was one of the reasons I created the User Profile Editor package. To even create something like this in the future.

    https://our.umbraco.org/projects/backoffice-extensions/user-profile-editor/

  • Steve Morgan 1346 posts 4453 karma points c-trib
    Dec 19, 2017 @ 16:07
    Steve Morgan
    0

    Hi,

    In my humble opinion, only having seen limited requirements.. I would suggest you make the bar owners Members and provide a front end login which an "edit" bar page (via a surface controller!).

    This will be far easier to maintain and will ensure that users don't have to learn how to use Umbraco. In my experience this will ensure they have fewer excuses in keeping their data up to date! You have more flexibility with one bar owner having multiple sites / bars / cities etc as you can just create a mapping link.

    HTH

    Steve

  • Mila Pandurska 43 posts 190 karma points
    Dec 19, 2017 @ 17:13
    Mila Pandurska
    0

    Hi, Steve, How will I know which bar is for the logged in Member?

  • Steve Morgan 1346 posts 4453 karma points c-trib
    Dec 19, 2017 @ 17:22
    Steve Morgan
    100

    I'd create a "bar picker" using the multi node picker and add it as a custom property to the member.

Please Sign in or register to post replies

Write your reply to:

Draft