Unsubscribe link from forum notification e-mail does not work

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
7/10/2013 2:29:58 AM
Gravatar
Total Posts 23

Unsubscribe link from forum notification e-mail does not work

After clicking the unsubscribe notification link in a notification email it will give you a error that it failed. In the log i get:

2013-07-10 08:35:35,636 ERROR xx.xxx.xx.xx - nl-NL - /Forums/UnsubscribeForum.aspx?mid=5&itemid=1 - mojoPortal.Web.ForumUI.UnsubscribeForum - Forum.UnSubscribe(1, 155, ) failed 

7/10/2013 10:24:25 AM
Gravatar
Total Posts 18439

Re: Unsubscribe link from forum notification e-mail does not work

currently users must be signed into the site to unsubscribe, we have a ticket about this in our project tracker and plan to improve this at some point.

7/11/2013 1:38:14 AM
Gravatar
Total Posts 23

Re: Unsubscribe link from forum notification e-mail does not work

FYI I've tested this myself being logged in and still get the failed message.

7/11/2013 11:23:07 AM
Gravatar
Total Posts 18439

Re: Unsubscribe link from forum notification e-mail does not work

Hi,

I just reproduced this problem on my local machine. However what I found is that in spite of the message shown it did unsubscribe me from the forum as verified by the changed subscribe link on the forum page.

Looking further I found that the bug was that the method forum.UnSubscribe was returning false. The bug was in the data layer:

public static bool Unsubscribe(int forumId, int userId)
        {
            SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_Forumsubscriptions_UnSubscribe", 2);
            sph.DefineSqlParameter("@ForumID", SqlDbType.Int, ParameterDirection.Input, forumId);
            sph.DefineSqlParameter("@UserID", SqlDbType.Int, ParameterDirection.Input, userId);
            int rowsAffected = Convert.ToInt32(sph.ExecuteScalar());
            return (rowsAffected > 0);
        }

The .ExecuteScalar needed to be changed to .ExecuteNonQuery since the update was not selecting anything. This is now fixed in our source code repository so it will be fixed in the next release.

As a workaround you could edit the stored procedures mp_ForumSubscriptions_Unsubscribe and mp_ForumSubscriptions_UnsubscribeAll (the bug existed in 2 places, another one much like the one above)

If you put

SELECT 1

after the update statement it will make the method return true so the correct unsubscribed message will be shown. If you do that you should keep a note about it and change it back after the next upgrade.

Possibly we will get to the issue about needing to be authenticated to unsubscribe in time for the next release.

Thanks for letting me know about this. I had never seen/noticed it because this site is using MySql and this bug was specific to the MS SQL data layer. 

Joe

8/19/2013 1:51:44 PM
Gravatar
Total Posts 18439

Re: Unsubscribe link from forum notification e-mail does not work

fyi, this bug is now fixed in the source code repository and on this site so that the unsubscribe link in the forum notification does not require authentication in order to unsubscribe.

So, this will be fixed in the next release of mojoPortal.

Thanks,

Joe

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