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

 2 Replies
 2 Subscribed to this topic
 30 Subscribed to this forum
Sort:
Author
Messages
Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

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!  :)  

https://yetanotherforum.n...elete-Superusers-Now

Veteran Member
Posts: 1182
Veteran Member
MVP
MVP
You're an MVP!
Will,

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

Michael Tobisch
DNN★MVP

DNN Connect
Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

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 <code>yaf</code> in it.  I used these queries to find it: 

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

<code>SELECT OBJECT_NAME(id) <br />     FROM SYSCOMMENTS <br />     WHERE &#91;text&#93; LIKE '%yaf%' <br />     AND OBJECTPROPERTY(id, 'IsProcedure') = 1 <br />     GROUP BY OBJECT_NAME(id)</code>

<code>SELECT ROUTINE_NAME, ROUTINE_DEFINITION<br />     FROM INFORMATION_SCHEMA.ROUTINES <br />     WHERE ROUTINE_DEFINITION LIKE '%yaf%' <br />     AND ROUTINE_TYPE='PROCEDURE'</code>

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

<code>/****** Object:  StoredProcedure &#91;dbo&#93;.&#91;RemoveUser&#93;    Script Date: 8/31/2023 9:07:40 AM ******/<br /> DROP PROCEDURE &#91;dbo&#93;.&#91;RemoveUser&#93;<br /> GO</code>

<code>/****** Object:  StoredProcedure &#91;dbo&#93;.&#91;RemoveUser&#93;    Script Date: 8/31/2023 9:07:40 AM ******/<br /> SET ANSI_NULLS ON<br /> GO</code>

<code>SET QUOTED_IDENTIFIER ON<br /> GO</code>

<code>CREATE PROCEDURE &#91;dbo&#93;.&#91;RemoveUser&#93;<br />     @UserID        int,<br />     @PortalID   int<br /> AS<br />     IF @PortalID IS NULL<br />         BEGIN<br />             -- Delete SuperUser<br />             DELETE FROM dbo.Users<br />                 WHERE  UserId = @UserID<br />         END<br />     ELSE<br />         BEGIN<br />             -- Remove User from Portal<br />             DELETE FROM dbo.UserPortals<br />                 WHERE  UserId = @UserID<br />                  AND PortalId = @PortalID<br />             IF NOT EXISTS (SELECT 1 FROM dbo.UserPortals WHERE  UserId = @UserID)<br />                 -- Delete User (but not if SuperUser)<br />                 BEGIN<br />                     DELETE FROM dbo.Users<br />                         WHERE  UserId = @UserID<br />                             AND IsSuperUser = 0<br />                     DELETE FROM dbo.UserRoles<br />                         WHERE  UserID = @UserID<br />                 END<br />             ELSE<br />                 BEGIN<br />                     DELETE ur FROM dbo.UserRoles ur<br />                         INNER JOIN dbo.Roles r ON r.RoleID = ur.RoleID<br />                         WHERE  UserID = @UserID AND r.PortalID = @PortalID<br />                 END<br />         END<br /> GO</code>

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 <code>purge- user</code> 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.  

ERROR MESSAGE

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

<code>StackTrace:</code>

<code>   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)<br />    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)<br />    at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)<br />    at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)<br />    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)<br />    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)<br />    at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)<br />    at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()<br />    at PetaPoco.Database.<>c.<ExecuteNonQueryHelper>b__353_0(IDbCommand c)<br />    at PetaPoco.Database.CommandHelper(IDbCommand cmd, Func`2 cmdFunc)<br />    at PetaPoco.Database.ExecuteNonQueryHelper(IDbCommand cmd)<br />    at PetaPoco.Database.ExecuteInternal(CommandType commandType, String sql, Object&#91;&#93; args)<br />    at DotNetNuke.Data.PetaPoco.PetaPocoHelper.ExecuteNonQuery(String connectionString, CommandType type, Int32 timeoutSec, String sql, Object&#91;&#93; args)<br />    at DotNetNuke.Data.SqlDataProvider.ExecuteNonQuery(String procedureName, Object&#91;&#93; commandParameters)<br />    at DotNetNuke.Security.Membership.AspNetMembershipProvider.RemoveUser(UserInfo user)</code>

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

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

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