Using existing User table for MVC forum

Jun 12, 2013 at 8:37 PM
I have an existing MVC website with simplemembership enabled (webpages_Membership, webpages_Roles ...) How can i configure the forum to use those tables?

Thanks
Coordinator
Jun 13, 2013 at 9:09 AM
Your web.config file will probably look something like this:
    <membership defaultProvider="YourWrapper">
      <providers>
        <clear />
        <add name="YourWrapper" type="Whatever Type and assembly your wrapper is located in"/>
      </providers>
    </membership>
To make MVC Forum use your existing users (it can't use the table, it uses the Membership provider to access users):
    <membership defaultProvider="ProviderWrapper">
      <providers>
        <clear />
        <add name="ProviderWrapper" type="mvcForum.Web.Providers.MembershipProviderWrapper" WrappedProvider="YourWrapper" />
        <add name="YourWrapper" type="Whatever Type and assembly your wrapper is located in"/>
      </providers>
    </membership>
So you need to add the ProviderWrapper line, and insert the name of your existing provider in the WrappedProvider attribute and then change the defaultProvider attribute to point to the ProviderWrapper.

If you want the forum tables in the same database as you already use for the users, you'll need to manually create the forum tables (a SQL file for that are on the source page). After that you install the forum and select to import users from an existing provider (go to /forumadmin/basicinstall).

That should be what it takes, if not, let me know what errors you run into.
Developer
Nov 14, 2013 at 7:11 PM
Follow up ... I want to have 1 database for my app. I already have an mvc app with simplemembership. I can add the forum tables to that db just fine and import the users ... question is: will new users entered via simplemembership work with the forum still? Where do all the users get created now?
Coordinator
Nov 15, 2013 at 7:29 AM
I doubt simplemembership works with the old membership MVC Forum is using, you would probably need to create a "copy" of the user in the old membership system (MVC Forum uses this).

MVC Forum has it's own account controller, where user can register. This controller is using the regular, old membership (og ASP.NET), as per the sample given in the MVC 3 (and 4?) template. You can find the code for this in mvcForum.Web.Areas.Forum.Controllers.AccountController.

I have not yet decided to move MVC Forum to the simplemembership set-up, as this will probably make it hard (if possible) to integrate MVC Forum with older MVC and ASp.NET versions.
Developer
Nov 15, 2013 at 11:29 AM
Fair enough ... thank you for the feedback. I'm just looking to add a forum to my current site and didn't want to write one myself when there are so many good ones (yours) out there. And, I didn't want to have to manage multiple logins.

Thanks!

Doug Maurer - Owner

Business Technology Integration, LLC | Grand Rapids, MI

PH: (616) 299-4767 | www.btillc.net | [email removed]


Coordinator
Nov 15, 2013 at 12:40 PM
I plan on moving to SimpleMembership, I just don't want to promise you anything like a deadline.
Life seems to always mess that up!
Developer
Nov 15, 2013 at 1:25 PM
I have twin boys and I know about life messing up ....

Thank you - I will definitely be a beta tester if you need or want to fork your project in that direction ...

Doug Maurer - Owner

Business Technology Integration, LLC | Grand Rapids, MI

PH: (616) 299-4767 | www.btillc.net | [email removed]


Coordinator
Nov 16, 2013 at 2:16 PM
Thank you for your offer, I might just take you up on that!

(Getting my first in February if everything works out as planned).
Developer
Nov 19, 2013 at 12:58 PM
I am also moving my site to bootstrap ... have you thought about that for your forum software?

Doug Maurer - Owner

Business Technology Integration, LLC | Grand Rapids, MI

PH: (616) 299-4767 | www.btillc.net | [email removed]


Coordinator
Nov 19, 2013 at 5:00 PM
The admin part is already Bootstrap (version 2) as you might have noticed, and I plan on moving it to version 3 soon.

I'm working on a Bootstrap theme for the forum, and that will be based on version 3. At the moment the only thing I'm missing before I'm done, is the moderation part.
Developer
Nov 21, 2013 at 3:04 PM
Is there anyway to bundle the forum as an "area" that "plugs in" to existing apps?

Doug Maurer - Owner

Business Technology Integration, LLC | Grand Rapids, MI

PH: (616) 299-4767 | www.btillc.net | [email removed]


Coordinator
Nov 22, 2013 at 10:15 AM
That is more or less what the MVC Forum package (from nuget) is at the moment, well, actually several MVC areas (forum, forumadmin and an api area).

Unfortunately it does take some extra configuration to get everything running (dependency injection, database etc.).

I have successfully added the forum to a couple of running sites, the only real issue you should run into, is if the existing application has something that already handles users, data context, dependency injection, etc.

I hope this kind of answers your question?
Developer
Nov 22, 2013 at 12:08 PM
Yes it does ... I really want to integrate it into my site. I don't want to write my own.

I'll just wait for your work with the simple membership conversion.

Thanks!

Doug Maurer - Owner

Business Technology Integration, LLC | Grand Rapids, MI

PH: (616) 299-4767 | www.btillc.net | [email removed]