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

Get visible Threads with Threadmodel

Discussion in 'XenForo Development Discussions' started by ragtek, Sep 23, 2011.

  1. ragtek

    ragtek Guest

    How can i get all not moderated & not deleted threads from an node?

    ATM i'm using
    PHP:
     $threads $this->_getThreadModel()->getThreadsInForum($node['node_id'],
    the prepareThreadConditions method runs the prepareStateLimit ONLY, if
    PHP:
    (isset($conditions['deleted']) || isset($conditions['moderated'])) 
    is set, so it's not possible to send $conditions['visible']
     
  2. Jaxel

    Jaxel Well-Known Member

    That function you are trying to use is more of an "admin" function and is designed to return all threads; not threads with conditions. If you want to use conditions and options, you should really be using getThreads public function.
    Code:
    $conditions = array(
        'forum_id' => $node['node_id'],
        'deleted' => false,
        'moderated' => false
    );
    
    $fetchOptions = array();
    
    $threads = $this->_getThreadModel()->getThreads($conditions, $fetchOptions);
     
    ragtek likes this.
  3. ragtek

    ragtek Guest

    That's not true:p

    Both call getThreads:D

    PHP:
                $fetchConditions = array(
                    
    'deleted' => false,
                    
    'moderated' => false
                
    );
                
    $threads $this->_getThreadModel()->getThreadsInForum($node['node_id'], $fetchConditions);
    PHP:
    $conditions = array(     'forum_id' => $node['node_id'],     'deleted' => false,     'moderated' => false );  $threads $this->_getThreadModel()->getThreads($conditions);
     

Share This Page