YAFLogo

will.strohl@gmail.com
a year ago
I'm currently running DNN Platform 9.12.0, but before upgrading to it from 9.10.02, I uninstalled the YAF for DNN module.  We had to migrate it to Community Forums for technical reasons.  

Anyhow, I'm unable to delete any user account that had ever interacted with YAF now.  I keep getting the same error message and I don't know where/how to get rid of it.  My searches for triggers and whatnot have been fruitless so far.  

Message:Invalid object name 'dbo.yaf_User'.

StackTrace:

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at PetaPoco.Database.<>c.<ExecuteNonQueryHelper>b__353_0(IDbCommand c)
   at PetaPoco.Database.CommandHelper(IDbCommand cmd, Func`2 cmdFunc)
   at PetaPoco.Database.ExecuteNonQueryHelper(IDbCommand cmd)
   at PetaPoco.Database.ExecuteInternal(CommandType commandType, String sql, Object args)
   at DotNetNuke.Data.PetaPoco.PetaPocoHelper.ExecuteNonQuery(String connectionString, CommandType type, Int32 timeoutSec, String sql, Object args)
   at DotNetNuke.Data.SqlDataProvider.ExecuteNonQuery(String procedureName, Object commandParameters)
   at DotNetNuke.Security.Membership.AspNetMembershipProvider.RemoveUser(UserInfo user)
Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
a year ago
Restore the original SP for removeuser

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'{databaseOwner}[{objectQualifier}RemoveUser]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE {databaseOwner}{objectQualifier}RemoveUser
GO

CREATE PROCEDURE {databaseOwner}[{objectQualifier}RemoveUser]
    @UserID        int,
    @PortalID   int
AS
    IF @PortalID IS NULL
        BEGIN
            -- Delete SuperUser
            DELETE FROM {databaseOwner}{objectQualifier}Users
                WHERE  UserId = @UserID
        END
    ELSE
        BEGIN
            -- Remove User from Portal
            DELETE FROM {databaseOwner}{objectQualifier}UserPortals
                WHERE  UserId = @UserID
                 AND PortalId = @PortalID
            IF NOT EXISTS (SELECT 1 FROM {databaseOwner}{objectQualifier}UserPortals WHERE  UserId = @UserID)
                -- Delete User (but not if SuperUser)
                BEGIN
                    DELETE FROM {databaseOwner}{objectQualifier}Users
                        WHERE  UserId = @UserID
                            AND IsSuperUser = 0
                    DELETE FROM {databaseOwner}{objectQualifier}UserRoles
                        WHERE  UserID = @UserID
                END
            ELSE
                BEGIN
                    DELETE ur FROM {databaseOwner}{objectQualifier}UserRoles ur
                        INNER JOIN {databaseOwner}{objectQualifier}Roles r ON r.RoleID = ur.RoleID
                        WHERE  UserID = @UserID AND r.PortalID = @PortalID
                END
        END
GO

Then it should work

will.strohl@gmail.com
a year ago
Thank you for the update!  

Are you sure that this is all that's needed?  I managed to figure that out from a response on the DNN Community forums , but...  I'm still getting errors.  

Here is my additional troubleshooting:   https://dnncommunity.org/forums/using-dnn/extensions/dnn-for-yaf-uninstalled-cant-delete-users-now/#10771 

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
a year ago
Yes I'm 100% sure, there are no other modifications.

What errors are you getting? Are there still yaf related?