More in this section

Forums / Developing with Sitefinity / customize manage profile section

customize manage profile section

4 posts, 0 answered
  1. Dwayne Epps
    Dwayne Epps avatar
    6 posts
    Registered:
    04 May 2010
    18 May 2010
    Link to this post
    Is there a way to change the page redirect on the User >> Edit screen?

    I'd like to update the button save event on the user edit screen to redirect to the home page after saving?

    Or, perhaps update the manage profile standard control to include all the fields available in the User >> Edit screen?

    Thanks.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 May 2010
    Link to this post
    Hello Dwayne Epps,

    Open \Sitefinity\Admin\CmsAdmin\Users.aspx.cs. Inside Page_Load, subscribe for manageUsers.UpdatedUser. Get the user that is being edited and call  UpdateUser method of MembershipUser object. Then call SetProfileProperties method of ManageProfile. After that redirect to the desired page.

    void manageUsers_UpdatedUser(object sender, EventArgs e)
       {
           
           // this will update the membership data.
           MembershipUser user = Membership.GetUser("test");
           MembershipProvider provider = Membership.Providers["Sitefinity"];
           provider.UpdateUser(user);
     
           // this will update profile data
           Telerik.Security.WebControls.ManageUsers.EditContainer eContainer = manageUsers.GetCurrentContainer() as Telerik.Security.WebControls.ManageUsers.EditContainer;
           if (eContainer != null)
           {
               ManageProfile p = eContainer.FindControl("manageProfile") as ManageProfile;
               p.SetProfileProperties("test");
           }
            
           Response.Redirect("http://host/sitefinity/admin/Default.aspx");
          
       }


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Dwayne Epps
    Dwayne Epps avatar
    6 posts
    Registered:
    04 May 2010
    18 May 2010
    Link to this post
    Thanks Ivan,

    I subscribed to the manageUsers_UpdatedUser event handler in the page_load:

     

    protected void Page_Load(object sender, EventArgs e)
        {
            manageUsers.AttachCommandPanel(usersCommands);
            manageUsers.UpdatedUser += new EventHandler(manageUsers_UpdatedUser);
      
            if (!Page.IsPostBack)
            {
                if (Request.QueryString.Get("mode") != null
                    && Request.QueryString.Get("mode").Equals("new"))
                {
                    manageUsers.Mode = ManageUsers.Modes.Insert;
                }
      
                if (Request.QueryString.Get("action") != null &&
                    Request.QueryString.Get("action").Equals("profile") &&
                    Request.QueryString.Get("username") != null )
                {  // access to profile from Newsletter groups (CMS users)
                    string username = Request.QueryString.Get("username");
                    manageUsers.UserName = username;                
                }
            }
            if (Membership.Providers.Count <= 1 || Roles.Providers.Count <= 1)
            {
                HtmlControl div = this.usersCommands.Container.FindControl("providersPanel") as HtmlControl;
                if (div != null)
                    div.Visible = false;
            }
        }

    and added the method manageUsers_UpdatedUser:


     

    void manageUsers_UpdatedUser(object sender, EventArgs e)
        {
      
            //// this will update the membership data.
            //MembershipUser user = Membership.GetUser("dwayne");
            //MembershipProvider provider = Membership.Providers["Sitefinity"];
            //provider.UpdateUser(user);
      
            //// this will update profile data
            //Telerik.Security.WebControls.ManageUsers.EditContainer eContainer = manageUsers.GetCurrentContainer() as Telerik.Security.WebControls.ManageUsers.EditContainer;
            //if (eContainer != null)
            //{
            //    ManageProfile p = eContainer.FindControl("manageProfile") as ManageProfile;
            //    p.SetProfileProperties("dwayne");
            //}
      
            Response.Redirect("http://sitefinity.compasslearning.local/home/");
      
        }

    This is working fine.

    If I may ask, there is the manageUsers standard control.  I have dragged that control onto a page I created, but it only has firstname and lastname inputs.  Is there a way to add all the other fields that are available under User >> Edit screen to the manageUsers standard control?

    Thanks for the help.  I appreciate it.
    Regards.

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 May 2010
    Link to this post
    Hi Dwayne Epps,

    FirstName and LastName are Profile properties, so I assume that you are talking about Manage Profile control. You can gather more information about how to extend its template at this post - User Profile Client Side

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
4 posts, 0 answered