Copied to clipboard

Flag this post as spam?

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


  • David Muir 6 posts 26 karma points
    Mar 28, 2012 @ 21:38
    David Muir
    0

    Created User Event

    Hi, 

    I am creating a custom section in Umbraco 4.7.x that has different functionality depending on the UserType of the logged in user. 

    Some of the functionality is cross over with what will be in my custom section and what is accessible to non admin portal users. Therefore, I have created an underlying user database which should contain the users both on the front end and back end of the system.

    I will then look at this table do determine my level of user access. 

    The issue that I am having is that I can hook onto the User.Saving event to get the details I need to store in the table. However, if changing the UserType, the OnSaving event doesn't have the new UserType. Obviously as OnSaving runs before the updated user is save. 

    Is there any way to hook onto an event which is run once the user is actually saved? This way I could get the relevant details to save in my custom table.

    If not, I will have to approach another way.

    Many thanks

    David

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 28, 2012 @ 21:42
    Jan Skovgaard
    0

    Hi David - Welcome to the community :)

    As I understand what you're asking above you should be able to do some stuff on the "AfterSave" event once the user has been saved. A full reference of the available events in Umbraco 4.x can be found here: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/overview-of-all-events

    Hope this helps.

    /Jan

  • David Muir 6 posts 26 karma points
    Mar 28, 2012 @ 21:46
    David Muir
    0

    Hi Jan, 

    Yeah, you are right in what I am trying to achieve. 

    I looked at the list of events before, as this isn't the first time I have ran into this problem :(

    Unfortunately, User doesn't have an AfterSave event. It's not Member, but the actual User you log into Umbraco with.

    Thanks

    DM

     

     

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 28, 2012 @ 21:47
    Jan Skovgaard
    0

    Hi David

    Ah sorry, thought you meant member. Not sure how to achieve it on a user unfortunately...hopefully another bright mind with more insight know how to deal with this or have a suggestion for a workaround.

    Cheers,

    Jan

  • David Muir 6 posts 26 karma points
    Mar 28, 2012 @ 22:06
    David Muir
    0

    Hi Jan, 

    The only possible solution I have is to check on the base page within my custom section, and update accordingly. The only problem is that I would then have to do it every single time rather than just once on the create user event.

    Very frustrating.

    Thanks

    DM.

  • David Muir 6 posts 26 karma points
    Apr 06, 2012 @ 05:43
    David Muir
    0

    Hi, 

    Just incase anyone else comes up against this...

    To get round the issue of no saved event, I created 2 triggers on the umbracoUser table. One was on INSERT, the other on UPDATE. 

    INSERT allowed me to save the ID of the new user in another table (which is what I was wanting to achieve anyway). Once saving the user in Umbraco, the table is obviously updated, which allows me to update my table with the extra details that I was looking for from the API.

    Slightly annoying way to go about it, but at least we are working!

    Cheers,

    DM.

Please Sign in or register to post replies

Write your reply to:

Draft