Adding some other fields in sharepoint 2013 fba pack membership request form

codeplex
sharepoint2013

#1
Hello ,

I Need to add some more fields in Membership request form fields are bellow.

Organisation
Designation
Work phone
Mobile Number
Resistered For : this is roles (Check Boxes)

Please Guide me how to Add these Fields.

#2
I usually add the fields to the User Information List: http://zimmergren.net/technical/sharepoints-hidden-user-list-user-information-list

Then I modify the web part templates to include the new fields.

Then I modify the web part / membershiprequest class to save the new fields.

#3
Hello,
I would like to register users with other properties like date of birth, Phone, City along with the current User Name, First Name, Last Name, Email

We have a lot of trouble doing this

Can you help us?

#4
Sure - as a general guide for doing it yourself, I'll usually search the code for all instances of an existing field, like email, and then copy that code and adapt it for the new fields being added.

If you'd like us to add the custom fields for you, it can usually be done within the time included with the support plan, which can be purchased here:
http://www.visigo.com/purchase.html

#5
Hello,

I made the password fields visible in the form, so that the user cn choose his own password, but even then the system creates the password for the user itself.

Where can I change this setting.

Many thanks.

#6
There's a setting for 'auto generate password' on the web part. Just edit the web part and change the setting. It will then show the field and save the password.

Note that this setting does not work if 'Review membership requests' is on, as that would require the pw to be stored in the membership review list, which would be insecure.

#7
Thank you very much for your fast response always, really appreciate.
I changed the setting and it works.

Is there a way to login the user automatically after creating account successfully.

I just wanted also to use the e-mailadres as username, instead of a username.
Do you know where I can change the setting in the code avoiding to change it in all occurences?

Many thanks again Chris for providing this excellent tool.

Nour Din

#8
There's also an auto login setting in the web part properties. It also only works with Review Membership Requests turned off.

As for the email address, there's no setting that you can change in the code. You can use email addresses as usernames - but of course the user can't change their username if their email address changes.

#9
Many thanks again Chris.

autologin works.
However the username is not visible in the right upper corner after performing auto login (not the case if I login with the login form).
Strange thing is that I see only the arrow where I can choose to sign out or personalize the page.

I also tried to grab the username and e-mailaddress. .

I tried :

System.Web.Security.Membership.GetUser().Email.ToString()

and got error on fba.

and

SPContext.Current.Web.CurrentUser.Email doesn't returns a value for fba.

Do you now what I am missing here ?

Nour Din

#10
SharePoint uses the SharePoint user's "Name" field to populate the value in the top right. This is what's happening with your custom development right? Because out of the box, the webparts and management pages should set these values and they should be displayed in SharePoint.

SPContext.Current.Web.CurrentUser.Email should work, assuming you're running in the context of a logged in user and the email address has been set. If you're not running in the context of a logged in user, you'll have to use something like this to get the user:
this.Web.AllUsers[Utils.EncodeUsername(userName)];

Same thing goes for the membership functions - they'll never know who the current user is, because SharePoint doesn't use the standard membership authentication cookie. You'll need to do something like this: GetUser(userName,false).

I would suggest you deploy the standard fba pack, and then you debug it with Visual Studio to see how it works.

#11
You are right. I created a new simple web part for testing and now everything works. So the problem was with my own webpart.
SPContext.Current.Web.CurrentUser.Email works.
And also the name field is used in the top right of the sharepoint site.

What I am creating is the following :

I use the fba pack and made some changes to the settings.
When the user creates his account he should be redirected to a form (a web part that I created) where some of the fields of his FBA membership account are already filled in.

The most important is the e-mailaddress, which now is ok.

I am now searching for the following :

After registering successfully the user must be redirected automatically to a page that I define (my form).
Populate in my form the firstname and lastname in seperate fields.
Grab the UserId (=guid) from the membership database.

I also changed the web config for the complexity of the passwords but still the systems asks for Non-alphanumeric characters.

#12
Set MinRequiredNonAlphanumericCharacters to 0 and you shouldn't have to input any non alphanumeric characters. You have to make sure you make the change everywhere though - securetokenservice and all web.configs for all web applications (or the machine config if you define it there).

Why grab the guid from the membership database? I'd just use the api to read and write to membership. Are you storing your profile properties in there? Usually I just store them in the SharePoint user profile (unless they need to be used across multiple site collections).

You may also find it easier to just modify the membershiprequest web part and add the fields that you need, and ask the user for them at the time of registration instead of redirecting them to another page. But either should work.

#13
Thanks Chris,

It was indeed the machine.config that I missed.

I wanted to reuse some of the users profile information to save it in Microsoft Dynamics CRM.
Avoiding that the user has to fill in information that he already provided on time of registration.
But I didn't find the code for the redirect after user has successfully registered.

#14
If you're saving the profile information to the db, you'll probably want to look at the profile providers:

http://msdn.microsoft.com/en-us/library/014bec1k(v=vs.100).aspx

Like the membership provider, it provides an api you can code against to read and update a user's profile information.

#15
Thanks for the information.
What I didn't find however is where I can redirect the user to a page that I define after successfull registration (I enabled the autologin).
Are there also plans for a login web part for the FBA pack (for example on a page which allows anonymous access) instead of using/changing the default sign-in page.

#16
There's a "Finish Destination Page Url" property on the web part that you can use to redirect the user once they've successfully registered.

Although I would like to do a login web part in the future, it won't be in the near future.

#17
Ok redirecting works, thanks.

I have a strange issue.
When a user registers successfull an autologon is performed.
Firstname and Lastname are then shown in the right top corner. The user is redirected to my own web part and the email address is shown in a field using SPContext.Current.Web.CurrentUser.Email.
However when the user after that logs on with default sharepoint login page it is the username that is shown in the right top corner.
The emailaddress in my own webpart is blank.

Do you what could be the problem ?

#18
The name and email address is taken from the SharePoint user's profile. The user will have to update their profile with the information and it will show up.

Also, the profile is stored at the site collection level. So if they login to a separate site collection, that information won't be on their profile.

#19
if i want to add ""Work phone"" field to the Membership Request
How can i add'it ???

thanks

#20
I usually add the fields to the User Information List: http://zimmergren.net/technical/sharepoints-hidden-user-list-user-information-list

Then I modify the web part templates to include the new fields.

Then I modify the web part / membershiprequest class to save the new fields.