DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

DNN For YAF Uninstalled & Can't Delete Users Now

You are not authorized to post a reply.

Veteran Member

    Hey Everyone: 

    If you're running or know DNN for YAF, I have this pressing issue that I need a bit of help with.  Thanks in advance!  :)  


    Veteran Member


      I had the same problem a while ago, and I don't remember exactly what it was (and unfortunately I did not document it anywhere) - but I think that YAF modified one of the DNN Stored procedures (RemoveUser?), and deleting this procedure and re-creating it from the original DNN script did the trick.

      Hope that helps...

      Happy DNNing!

      Michael Tobisch

      dnnWerk Austria
      DNN Connect

      Veteran Member

        Aha!  I should've thought to search through the sprocs.  You were correct about this.  The RemoveUsers procedure was modified.  This is a core code change.  Had I known this was happening, I wouldn't have ever even tried using this module.  :(  

        It was the only sproc that had the term yaf in it.  I used these queries to find it: 

        SELECT OBJECT_NAME(object_id)
            FROM sys.sql_modules
            WHERE OBJECTPROPERTY(object_id, 'IsProcedure') = 1
            AND definition LIKE '%yaf%'

            WHERE [text] LIKE '%yaf%' 
            AND OBJECTPROPERTY(id, 'IsProcedure') = 1 
            GROUP BY OBJECT_NAME(id)


        I used a clean instance of DNN 9.12 (same version) to drop and recreate the sproc: 

        /****** Object:  StoredProcedure [dbo].[RemoveUser]    Script Date: 8/31/2023 9:07:40 AM ******/
        DROP PROCEDURE [dbo].[RemoveUser]

        /****** Object:  StoredProcedure [dbo].[RemoveUser]    Script Date: 8/31/2023 9:07:40 AM ******/


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

        These are superusers I'm attempting to permanently remove, so far.  They're already marked as deleted, but I still can't use the option in the Users view to "Permanently Delete."  I get a new error, listed below.  However, an interesting thing to note is that running the purge- user prompt command doesn't display any error at all.  If I took that for it's word, the same user accounts I'm trying to delete are deleted, but they're still there.  


        Message:Internal Query Processor Error: The query processor encountered an unexpected error during execution (HRESULT = 0x80040e19).


           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)

        This means that there are likely MORE core code changes that were made.  Ugh... 

        You are not authorized to post a reply.

        These Forums are dedicated to the discussion of DNN Platform.

        For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

        1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
        2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
        3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
        4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
        5. No Flaming or Trolling.
        6. No Profanity, Racism, or Prejudice.
        7. Site Moderators have the final word on approving / removing a thread or post or comment.
        8. English language posting only, please.

        Would you like to help us?

        Awesome! Simply post in the forums using the link below and we'll get you started.

        Get Involved