• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Partial fix [XF 1.4 B3] Can't Delete Orphaned Profile Posts

Kevin

Well-known member
#1
I installed XF 1.4 B3 tonight to one of my sites and realized that the /find-new/profile-posts was a great way of exposing some old spam accounts that I had not come across before (account was created, they post spam to their own profile posts, never come back again). Cleaning up the spam accounts was mostly easy but I ran into one issue: If the account had already been previously deleted, some had profile posts that still existed and were showing up on /find-new/profile-posts but I can't delete them.

Since the account doesn't exist I can't use the 'spam' link on them. When I try the 'delete' link I get the generic "The requested member could not be found." error. When I try to select them in bulk and then delete the selected posts I get an unhandled error.

Error Info
ErrorException: Argument 2 passed to XenForo_Model_ProfilePost::canDeleteProfilePost() must be of the type array, null given, called in /home/{redacted}/public_html/library/XenForo/Model/InlineMod/ProfilePost.php on line 54 and defined - library/XenForo/Model/ProfilePost.php:560
Generated By: Kevin, 6 minutes ago
Stack Trace
#0 /home/{redacted}/public_html/library/XenForo/Model/ProfilePost.php(560): XenForo_Application::handlePhpError(4096, 'Argument 2 pass...', '/home/{redacted}/pu...', 560, Array)
#1 /home/{redacted}/public_html/library/XenForo/Model/InlineMod/ProfilePost.php(54): XenForo_Model_ProfilePost->canDeleteProfilePost(Array, NULL, 'soft', NULL, Array)
#2 /home/{redacted}/public_html/library/XenForo/Model/InlineMod/ProfilePost.php(26): XenForo_Model_InlineMod_ProfilePost->canDeleteProfilePostsData(Array, 'soft', Array, NULL, NULL)
#3 /home/{redacted}/public_html/library/XenForo/ControllerPublic/InlineMod/ProfilePost.php(47): XenForo_Model_InlineMod_ProfilePost->canDeleteProfilePosts(Array, 'soft', NULL)
#4 /home/{redacted}/public_html/library/XenForo/FrontController.php(347): XenForo_ControllerPublic_InlineMod_ProfilePost->actionDelete()
#5 /home/{redacted}/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#6 /home/{redacted}/public_html/index.php(13): XenForo_FrontController->run()
#7 {main}
Request State
array(3) {
["url"] => string(48) "http://{redacted}.com/inline-mod/profile-post/switch"
["_GET"] => array(0) {
}
["_POST"] => array(7) {
["message"] => string(0) ""
["profilePosts"] => array(5) {
[0] => string(3) "110"
[1] => string(3) "109"
[2] => string(3) "108"
[3] => string(3) "107"
[4] => string(3) "106"
}
["_xfToken"] => string(8) "********"
["a"] => string(6) "delete"
["_xfRequestUri"] => string(30) "/find-new/399514/profile-posts"
["_xfNoRedirect"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}
 

Mike

XenForo developer
Staff member
#2
Are these messages really old? Messages posted on a particular user's profile (status updates being on their own profile) are removed when the user is deleted so the profile post should have been removed.

I'm not sure why you can even see this post as I would have expected the view check to fail, though I suppose the join would have still run -- this is the part I'll probably change.
 

Kevin

Well-known member
#3
Mike, yes, they are pretty old with the first that I see in the list going back to Jan 2013.

If they were excluded from showing up on the new sidebar and /find-new/profile-posts, because the user account doesn't exist, then, even if I have to run a query manually to purge the orphaned posts, it'd be great since then the spam posts won't show to the visitors.