Copied to clipboard

Flag this post as spam?

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


  • Marc-André 63 posts 276 karma points
    Sep 09, 2019 @ 20:00
    Marc-André
    0

    Adding Member Group in packages

    Hi!

    The title says it all : How can I add a Member Group in my package.

    I'm using some features with a specific group of members any I want to create it when I install my package.

    Thanks! :)

  • Marcio Goularte 356 posts 1248 karma points
    Sep 09, 2019 @ 20:57
    Marcio Goularte
    0

    Quick answer no. The way I know about exporting member types is with Usync

    https://usync.readthedocs.io

  • Huw Reddick 271 posts 833 karma points
    Jan 08, 2021 @ 08:44
    Huw Reddick
    0

    You need to use a package action which gets executed after your package is installed.

    This what I have done.

    public class ForumInstallHandler : IPackageAction {

    public bool Execute(string packageName, XElement xmlData)
    {
    
        try
        {
            Current.Logger.Info(System.Reflection.MethodBase.GetCurrentMethod().GetType(), "Executing ForumInstallHandler:Publish Content");
    
            AddMemberGroups();
            Current.Logger.Info(System.Reflection.MethodBase.GetCurrentMethod().GetType(), "Executing ForumInstallHandler:Create Member Properties");
            return AddMemberProperties();
        }
        catch (Exception ex)
        {
            Current.Logger.Error(System.Reflection.MethodBase.GetCurrentMethod().GetType(), "INSTALL Package Error", ex);
            return false;
        }
    }
    
    
    public string Alias()
    {
        return "ForumInstallHandler";
    }
    
    public bool Undo(string packageName, XElement xmlData)
    {
        return true;
    }
    
    
    
    private bool AddMemberGroups()
    {
            try{
                var _memberService = Current.Services.MemberGroupService;
                IMemberGroup admingroup = new MemberGroup();
                admingroup.Name = "ForumAdministrator";
                IMemberGroup modgroup = new MemberGroup();
                modgroup.Name = "ForumModerator";
                _memberService.Save(admingroup);
                _memberService.Save(modgroup);
                return true;
            }catch(Exception e){
                Current.Logger.Error(System.Reflection.MethodBase.GetCurrentMethod().GetType(), "Error creating Member groups", e);
                return false;
            }
    
    }
    

    }

    This is called by adding the following action in the package actions

    <actions>
      <action runat="install" undo="true" alias="ForumInstallHandler"></action>
    </actions>
    
  • Elyssaa 6 posts 76 karma points
    Jan 08, 2021 @ 09:32
    Elyssaa
    0

    am developing a project using Laravel 5.6 where there is requirement of group, were user can create a group, add member or send invitation to user via email and post to group and can have group chat function also.

    I want to complete this module, so I am looking for Laravel packages. I have tried "teamwork" package and "groups" package.

    myaccountaccess

  • Jacob Leo 1 post 71 karma points
    Jan 25, 2021 @ 23:28
    Jacob Leo
    0

    Can you please tell me how did you done? i read all comments but still i didn't got the perfect solution.

Please Sign in or register to post replies

Write your reply to:

Draft