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

post view for guests

Discussion in 'XenForo Development Discussions' started by Jim Boy, Sep 2, 2014.

  1. Jim Boy

    Jim Boy Well-Known Member

    I'm trying to deteremine whether posts can be viewed by guests, including when the post is in a private node:

    The code I have is

      $post = $postmodel->getPostById($postid, array(
      'join' => XenForo_Model_Post::FETCH_USER | XenForo_Model_Post::FETCH_USER_PROFILE | XenForo_Model_Post::FETCH_THREAD | XenForo_Model_Post::FETCH_FORUM
      $userModel = XenForo_Model::create('XenForo_Model_User');
      if (!empty($post) && $postmodel->canViewPost($post, $post, $post, $errorPhraseKey, null, $userModel->getVisitingGuestUser()))
      return true;
      return false;
    but it returns a false positive when I use this in a restricted forum.

    Any ideas what I am doing wrong? Is there a better way to go about this?
  2. Jim Boy

    Jim Boy Well-Known Member

    In fact what I would really love to do is get a better grip on permissions in general, for example whether a particular usergroup (which may not be associated with the visitor) has permissions against content, eg does a particular usergroup have permission to view a post on a restricted node completely irregardless of the impact of other permissions. How would that be called in a query?
  3. Jim Boy

    Jim Boy Well-Known Member

    Am I right in thinking that guest always has a permission_combination_id value of 1? If so, I think I can take it from there.

Share This Page