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

Having trouble with recent updated threads module...

Discussion in 'XenForo Development Discussions' started by Jaxel, Oct 29, 2010.

  1. Jaxel

    Jaxel Well-Known Member

    example: http://xen1.8wayrun.com/portal/

    here is the public controller for that page:
    class EWRporta_ControllerPublic_Portal extends XenForo_ControllerPublic_Abstract
    	public function actionIndex()
    		$visitor = XenForo_Visitor::getInstance();
    		$conditions = array();
    		$fetchOptions = array(
    			'join' => XenForo_Model_Thread::FETCH_FORUM | XenForo_Model_Thread::FETCH_USER,
    			'readUserId' => $visitor['user_id'],
    			'postCountUserId' => $visitor['user_id'],
    			'order' => 'last_post_date',
    			'limit' => 2,
    		$threads = $this->getModelFromCache('XenForo_Model_Thread')->getThreads($conditions, $fetchOptions);
    		foreach ($threads AS &$thread)
    			$thread = $this->getModelFromCache('XenForo_Model_Thread')->prepareThread($thread, $thread);
    			$thread['canInlineMod'] = false;
    			$thread['canEditThread'] = false;
    		$viewParams = array(
    			'visitor' => $visitor,
    			'threads' => $threads,
    			'showForumLink' => 'true',
    			'newsList' => $this->getModelFromCache('EWRporta_Model_Threads')->getRecent(),
    		return $this->responseView('EWRporta_ViewPublic_Portal', 'EWRporta_Portal', $viewParams);
    The template is as follows:
    <xen:if hascontent="true">
    <div class="discussionList section sectionMain">
    	<dl class="sectionHeaders">
    		<dt class="posterAvatar"></dt>
    		<dd class="main">
    			<a class="title"><span>{xen:phrase title}</span></a>
    			<a class="postDate"><span>{xen:phrase start_date}</span></a>
    		<dd class="stats">
    			<a class="major"><span>{xen:phrase replies}</span></a>
    			<a class="minor"><span>{xen:phrase views}</span></a>
    		<dd class="lastPost"><a><span>{xen:phrase last_message}</span></a></dd>
    	<ol class="discussionListItems">
    		<xen:foreach loop="$threads" value="$thread">
    			<xen:include template="thread_list_item" />
    Inside "thread_list_item", some avatars are built for the thread view. The avatars show up fine, but it produces errors that you can see on the page linked above.
  2. Jaxel

    Jaxel Well-Known Member

    fixed it...

    $visitor = XenForo_Visitor::getInstance();

    $visitor = XenForo_Visitor::getInstance()->toArray();
  3. Jaxel

    Jaxel Well-Known Member

    I do have another question though... how do I limit the getThreads() funtion from getting deleted/moderated threads?

    Figured it out:
    		$conditions = array(
    			'deleted' => false,
    			'moderated' => false,

Share This Page