Copied to clipboard

Flag this post as spam?

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


  • Niels Lynggaard 183 posts 520 karma points
    May 19, 2020 @ 13:07
    Niels Lynggaard
    0

    Deleting member groups.. Trying to remove all members on "Deleting"

    Hi all.

    Our client is extensively using member groups to handle access to limited content. However, once in a while they want to clean up a bit and remove user groups.

    This, however, isn't possible when the group is used by members.

    So, I've been trying to create an eventhandler that hooks into the Membergroupservice.deleting event... But to my surprice, this isn't what's being hit!

    The error message in the backoffice I get when I try to delete a group, says; "The role Test is currently assigned to members" .... at at Umbraco.Core.Services.MemberService.DeleteRole....

    AHA, not groups, but "Roles".

    So My handler hooking into MemberGroupService.Deleting isn't even being hit...

    Now, what I really want to do is hook into this event, get all members from that group and remove each member from the group and continue with the delete.

    But now I'm confused. There's no "MemberRoleService" or similar?

    Any ideas on what I should hook into?

    Alternatively, i'd have to implement either a by-group (role?) bulk-editor to remove users first, or a custom way to delete groups that uses MemberService.DeleteRole without throwing, but that seems a bit far off.. and also, I'm not sure of the consequences..

    Any ideas on how to enable the client to delete member groups (and in the process, hopefully removing members from that group) would be most welcome & appreciated!

    Nb! We're using Umbraco 7..

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies