• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Moderated/deleted content is everytime visible for author

Marcus

Well-known member
Project:The author of content always sees his own content as visible, regardless if it is moderated or deleted. Simple as that.

Note: The content is deleted or moderated. Please don't touch that. I just want the user see his content as usual in the forum and on the thread.

How to do: That should be ideally done with a simple user-right-permission modification, but I am new to MVC. So I need a coder to do that for me. In my former forum I did this:
1. changed the page to never give an error if the logged in user is the thread author
2. Changed the query to display all posts, with the exception of deleted or approved messages when they were not from author
Code:
SELECT posts WHERE visible AND posts NOT IN (SELECT posts WHERE IN (moderated, deleted) AND post.author != logged in user)
But I would much prefer if you would do this with a simple MVC permission.

Payment is 60 USD. I can pay by Paypal or Bank Wire Transfer.
 
Payment raised to 150 USD. Anyone interested?
You don't need an add-on
look at this fx "canViewPost" in the file /library/XenForo/Model/Post.php

find the code
PHP:
if ($this->isModerated($post))
        {
            if (!$this->_getThreadModel()->canViewModeratedPosts($thread, $forum, $errorPhraseKey, $nodePermissions, $viewingUser))
            {
                if (!$viewingUser['user_id'] || $viewingUser['user_id'] != $post['user_id'])
                {
                    return false;
                }
            }
        }
You can see that if a post is moderated and you are the author and the viewingUser you should be able to see the post.
then for deleted posts the next section you just need to copy the code down so it looks like
PHP:
else if ($this->isDeleted($post))
        {
            if (!$this->_getThreadModel()->canViewDeletedPosts($thread, $forum, $errorPhraseKey, $nodePermissions, $viewingUser))
            {
                if (!$viewingUser['user_id'] || $viewingUser['user_id'] != $post['user_id'])
                    {
                        return false;
                    }
            }
        }


it should work in theory. make a copy of the file before trying it out. I didn't test it and I can't guarantee it will work. And I could be 100% wrong. Your mileage may vary.
 
Top Bottom