Cloning the Forums Feature

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
9/15/2011 6:20:58 AM
Gravatar
Total Posts 42

Re: Cloning the Forums Feature

Hi Joe,

Saw this in the roadmap for the Forums feature.

    Sticky threads - completed
    option for pre-moderation of posts before they are visible
    ability to mark posts as questions and vote posts as answers

1. Please what are "Sticky threads", and what are they used for?

2. I actually intend to try and extend the forum such that one will be able to add comments to Questions/Responses, and also vote on questions. recall that I've asked about this before... in this post

Any advice on the best way to implement this will be appreciated.

3. In the code, I discovered that "mp_" is hard-coded, so the custom forum I cloned is creating entries in the original mp_ tables, even though I changed this in the install script. Do I have to replace all these in the code also? If yes, I'd suggest that the documentation be updated a little to include this, cos it just said to do the replace in the install scripts.

Thanks.

9/15/2011 6:32:30 AM
Gravatar
Total Posts 18439

Re: Cloning the Forums Feature

Hi,

1. sticky threads have a higher sort than other threads, for example we have a sticky thread about important skin changes, it stays at the top of the thread list in the design/skinning forum. It is also a locked thread so only users with page edit permissions can edit it or post on that thread.

2. sorry I have no advice on that its too general a question

3. yes of course you need to change it in your cloned DBForums.cs, for every method you must change that prefix to match your stored procedures so it will use your tables, I just updated the document.

Hope that helps,

Joe

9/15/2011 6:52:50 AM
Gravatar
Total Posts 42

Re: Cloning the Forums Feature

Thanks Joe.

The response speed still beats my imagination.

Regards.

9/15/2011 8:41:47 AM
Gravatar
Total Posts 42

Re: Cloning the Forums Feature

I have an update.

Came upon an error.

In the Install Script, there are some references to the mp_Users table.

If you do a "Replace All" from mp_ to joe_(or your own custom prefix), references to mp_Users will also be renamed.

In my own case, I had to go and manually rename this in the stored procedures already created (espectially the ones that had to do with select).

However, one can actually do another "Replace All" from e.g. joe_Users back to mp_Users before running the scripts and all will be fine.

If there are any comments/objections to this, kindly update all.

Regards.

9/15/2011 11:19:34 AM
Gravatar
Total Posts 42

Re: Cloning the Forums Feature

Dear Joe,

Sorry for my trouble.

Thanks for your help so far.

This part of code is having an IndexOutOfRangeException(pls see highlighted part below).

This portion is in the ForunThread class.

Seems there's a problem with "ModuleID".

I drilled down to the stored procedure cmp_ForumThreads_SelectOne, it seems "ModuleID" is not part of the fields returned.

Kindly assist.

 

private void GetThread(int threadId)
        {
            using (IDataReader reader = DBForums.ForumThreadGetThread(threadId))
            {
                if (reader.Read())
                {
                    this.threadID = int.Parse(reader["ThreadID"].ToString());
                    if (reader["ForumID"] != DBNull.Value)
                    {
                        this.forumID = this.origForumID = int.Parse(reader["ForumID"].ToString());
                    }
                    if (reader["ModuleID"] != DBNull.Value)
                    {
                        this.moduleID = this.origForumID = int.Parse(reader["ModuleID"].ToString());
                    }

9/15/2011 12:01:29 PM
Gravatar
Total Posts 18439

Re: Cloning the Forums Feature

Once you clone a feature it is up to you to be able to solve and problems you have with it. The original forum does not have an error there and the stored procedure mp_ForumThreads_SelectOne does return that field.

Possibly your work on the scripts did not produce a correct result. I would have generated a script for the tables and related procedures based on the latest version of the existing feature as it exists in the db, then I would have modified the script to change the prefixes as needed on the tables and procedure names. I'm guessing you used the complete history of upgrade scripts rather than just generating your own, but somehow you either did not get all of them or are missing some changes or upgrade scripts. For a simple feature with only a few scripts it can work to copy and modify the series of scripts for the original feature but for a feature that has a long upgrade history you are better off making your clone start out with a single installation script that is up to date with the latest schema rather than replicating the entire upgrade history of the old feature.

Hope that helps,

Joe

9/17/2011 10:03:36 AM
Gravatar
Total Posts 42

Re: Cloning the Forums Feature

Thanks Joe.

I discovered that the issue was that f.ModuleID was not in my own customized stored procedure (mp_ForumThreads_SelectOne). I added this, and the issue resolved.

However, i checked the original script, f.ModuleID was not part of the script.

I wonder how this field got created in the stored procedure.

Anyway, the issue is now resolved.

9/17/2011 10:18:37 AM
Gravatar
Total Posts 18439

Re: Cloning the Forums Feature

The forum has an installation script and a number of upgrade scripts.

For a new installation it will first run the highest script version (0.0.1.6) from the folder

/Setup/applications/forums/SchemaInstallScripts/mssql/0.0.1.6.config

after that it will run all the scripts with a higher version in sequence from

/Setup/applications/forums/SchemUpgradeScripts/mssql/

starting with 0.0.1.7 and continuing through 0.0.2.0

the 0.0.1.9 script is the one that updated the procedure mp_FuromsThreads_SelectOne to include ModuleID

So when cloning a feature one could copy and modify all the upgrade scripts but if there are a lot of them it can be cleaner to generate your own up to date script based on the current schema rather than replicating the upgrade history of the original feature.

Hope that helps,

Joe

9/17/2011 2:27:21 PM
Gravatar
Total Posts 42

Re: Cloning the Forums Feature

Yes. Thank you.

That helps a lot, and also clarifies many things.

Thanks for your time and assistance.

You must sign in to post in the forums. This thread is closed to new posts.