• 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.

[8wayRun.Com] XenPorta (Module Add-Ons)

I don't know how it got that high. ;) The original module works fine but adding a second to the same section in the layout does not display for some reason.
The new module don't display on its own ether. Very odd.
 
This is the Recent Threads module. (y)

File name : RecentTheads2.xml

Code:
<?xml version="1.0" encoding="utf-8"?>
<module>
  <module_name>RecentThreads2</module_name>
  <module_cache>now</module_cache>
  <module_settings>
    <cutoff desc="Recent Thread Cutoff?" format="">5</cutoff>
    <forum desc="Recent Thread Forum?" format="forums">110</forum>
    <RecentThreads2_limit desc="Recent Thread Limit?" format="">3</RecentThreads2_limit>
  </module_settings>
  <module_template><![CDATA[<xen:require css="discussion_list.css" />

<xen:if is="{$position} == 'left' OR {$position} == 'right'">

    <div class="section avatarList">
        <div class="secondaryContent" id="statusUpdates">
            <h3>Recently Active Threads</h3>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads" value="$thread">
                    <li id="thread-{$thread.thread_id}" class="{$thread.discussion_state} {xen:if {$thread.sticky}, 'sticky'} {xen:if {$thread.isNew}, 'unread'}" data-author="{$thread.username}">
                        <xen:avatar user="$thread" size="s" img="true" />
                        <div class="title">
                            <a href="{xen:link "threads{xen:if '{$thread.isNew} AND {$thread.haveReadData}', '/unread'}", $thread}"
                                title="{xen:if '{$thread.isNew} AND {$thread.haveReadData}', {xen:phrase go_to_first_unread_message}}"
                                class="{xen:if $thread.hasPreview, PreviewTooltip}"
                                data-previewUrl="{xen:if $thread.hasPreview, {xen:link threads/preview, $thread}}">{xen:helper snippet, $thread.title, 50}</a>
                        </div>
                        <div class="muted">
                            <a href="{xen:link members, $thread.lastPostInfo}">{$thread.lastPostInfo.username}</a> @
                            <a{xen:if '{$visitor.user_id}', ' href="{xen:link posts, $thread.lastPostInfo}" title="{xen:phrase go_to_last_message}"'} class="dateTime"><xen:datetime time="$thread.lastPostInfo.post_date" /></a>
                        </div>
                    </li>
                </xen:foreach>
            </ol>
        </div>
    </div>

<xen:else />

    <xen:require css="inline_mod.css" />
    <xen:require js="js/xenforo/discussion_list.js" />

    <form action="{xen:link inline-mod/thread/switch}" method="post"
        class="DiscussionList InlineModForm"
        data-cookieName="threads"
        data-controls="#InlineModControls"
        data-imodOptions="#ModerationSelect option">

        <div class="discussionList section sectionMain" id="recentThreads">
            <dl class="sectionHeaders">
                <dt class="posterAvatar"></dt>
                <dd class="main">
                    <a class="title"><span>Recently Active Threads</span></a>
                    <a class="postDate"><span>{xen:phrase start_date}</span></a>
                </dd>
                <dd class="stats">
                    <a class="major"><span>{xen:phrase replies}</span></a>
                    <a class="minor"><span>{xen:phrase views}</span></a>
                </dd>
                <dd class="lastPost"><a><span>{xen:phrase last_message}</span></a></dd>
            </dl>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads" value="$thread">
                    <xen:include template="thread_list_item">
                        <xen:map from="$thread.showForumLink" to="$showForumLink" />
                    </xen:include>
                </xen:foreach>
            </ol>
        </div>

        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    </form>

</xen:if>

<xen:include template="preview_tooltip" />]]></module_template>
</module>
 
The problem is the variables.

I notice the limit variable was changed to RecentThreads2_limit. The other 2 variables need to be changed as well. Jaxel said he took care of it in a recent update but I haven't worked with it yet.

Once you update the source of the variables, then the place those variables are used would also need to be updated. I looked through the code and cannot find where they are used. I can't help any further without understanding where those variables are used. I checked the XML and the EWRporta_block_RecentThreads template but they simple are not there.
 
Server Error

String could not be parsed as XML

My mistake . Now I'm awake, I'm not even sure why I suggested that *LOL* Let's try and backtrack for a minute. You need to rename all the variables.It seems you did that by renaming recentthread_cutoff to cutoff and recentthread_forum to forum. I would rename them to recenthread2_cutoff and recenthtread2_forum if I were you, just to ensure the names will be absolutely unique.

As an indication, here is my RecentNews module code (start of it anyway):

Code:
<?xml version="1.0" encoding="utf-8"?>
<module>
  <module_name>RecentNews</module_name>
  <module_cache>+1 hours</module_cache>
  <module_settings>
    <recentnews_forum desc="Recent News Forum?" format="forums">78</recentnews_forum>
    <recentnews_limit desc="Recent News Limit?" format="">4</recentnews_limit>
    <recentnews_truncate desc="Recent News Truncate?" format="">10000</recentnews_truncate>
    <recentnews_pagenav desc="Show Page Navigation?" format="check">1</recentnews_pagenav>
  </module_settings>
  <module_template><![CDATA[<xen:require css="message_user_info.css" />
<xen:require css="bb_code.css" />

And here is my RecentNewsBot code:

Code:
<?xml version="1.0" encoding="utf-8"?>
<module>
  <module_name>RecentNewsBot</module_name>
  <module_cache>+1 hours</module_cache>
  <module_settings>
    <recentnewsbot_forum desc="Recent News Forum?" format="forums">78</recentnewsbot_forum>
    <recentnewsbot_limit desc="Recent News Limit?" format="">5</recentnewsbot_limit>
    <recentnewsbot_truncate desc="Recent News Truncate?" format="">1500</recentnewsbot_truncate>
  </module_settings>
  <module_template><![CDATA[<xen:require css="message_user_info.css" />
<xen:require css="bb_code.css" />

If you get that far, and the module parses, did you also remember to create a new php file in the \blocks\ folder? And to create a template to fit the new module?

My RecentNewsBot.php has two changes from the original one. 1 is the one described in the earlier post you quoted, to match the renamed variables to the block, and the other is an additional statement to the SQL query that pulls the data from the database.

If you did that as well, then the last thing to do is to create a matching template to display it all. It should have a name similar to the name of the XML and the block. In my case, the template is named EWRPorta_Block_RecentNewsBot.

In it, just about the only difference from the original is this, at the top:

Code:
<xen:require css="message_user_info.css" />
<xen:require css="bb_code.css" />

<div class="sectionMain">
    <xen:foreach loop="$RecentNewsBot" value="$news">
        <article>

Notice how the foreach loop refers to the new name instead of RecentNews.

Let me know if that did the trick for you?

Peter
 
You no longer need to have unique names for variables... they will now be named and handled automatically...

This is the current RecentThreads.xml: (included in the package)
Code:
<?xml version="1.0" encoding="utf-8"?>
<module>
  <module_name>RecentThreads</module_name>
  <module_cache>now</module_cache>
  <module_settings>
    <cutoff desc="Recent Thread Cutoff?" format="">1</cutoff>
    <forum desc="Recent Thread Forum?" format="forums">0</forum>
    <limit desc="Recent Thread Limit?" format="">3</limit>
  </module_settings>
  <module_template><![CDATA[<xen:require css="discussion_list.css" />

<xen:if is="{$position} == 'left' OR {$position} == 'right'">

    <div class="section avatarList">
        <div class="secondaryContent" id="statusUpdates">
            <h3>Recently Active Threads</h3>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads" value="$thread">
                    <li id="thread-{$thread.thread_id}" class="{$thread.discussion_state} {xen:if {$thread.sticky}, 'sticky'} {xen:if {$thread.isNew}, 'unread'}" data-author="{$thread.username}">
                        <xen:avatar user="$thread" size="s" img="true" />
                        <div class="title">
                            <a href="{xen:link "threads{xen:if '{$thread.isNew} AND {$thread.haveReadData}', '/unread'}", $thread}"
                                title="{xen:if '{$thread.isNew} AND {$thread.haveReadData}', {xen:phrase go_to_first_unread_message}}"
                                class="{xen:if $thread.hasPreview, PreviewTooltip}"
                                data-previewUrl="{xen:if $thread.hasPreview, {xen:link threads/preview, $thread}}">{xen:helper snippet, $thread.title, 50}</a>
                        </div>
                        <div class="muted">
                            <a href="{xen:link members, $thread.lastPostInfo}">{$thread.lastPostInfo.username}</a> @
                            <a{xen:if '{$visitor.user_id}', ' href="{xen:link posts, $thread.lastPostInfo}" title="{xen:phrase go_to_last_message}"'} class="dateTime"><xen:datetime time="$thread.lastPostInfo.post_date" /></a>
                        </div>
                    </li>
                </xen:foreach>
            </ol>
        </div>
    </div>

<xen:else />

    <xen:require css="inline_mod.css" />
    <xen:require js="js/xenforo/discussion_list.js" />

    <form action="{xen:link inline-mod/thread/switch}" method="post"
        class="DiscussionList InlineModForm"
        data-cookieName="threads"
        data-controls="#InlineModControls"
        data-imodOptions="#ModerationSelect option">

        <div class="discussionList section sectionMain" id="recentThreads">
            <dl class="sectionHeaders">
                <dt class="posterAvatar"></dt>
                <dd class="main">
                    <a class="title"><span>Recently Active Threads</span></a>
                    <a class="postDate"><span>{xen:phrase start_date}</span></a>
                </dd>
                <dd class="stats">
                    <a class="major"><span>{xen:phrase replies}</span></a>
                    <a class="minor"><span>{xen:phrase views}</span></a>
                </dd>
                <dd class="lastPost"><a><span>{xen:phrase last_message}</span></a></dd>
            </dl>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads" value="$thread">
                    <xen:include template="thread_list_item">
                        <xen:map from="$thread.showForumLink" to="$showForumLink" />
                    </xen:include>
                </xen:foreach>
            </ol>
        </div>

        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    </form>

</xen:if>

<xen:include template="preview_tooltip" />]]></module_template>
</module>
This is the current RecentThreads.php on 8WR: (not currently included in the package)
Code:
<?php

class EWRporta_Block_RecentThreads extends XenForo_Model
{
    public function getBypass($params)
    {
        $visitor = XenForo_Visitor::getInstance();

        $conditions = array(
            'last_post_date' => array('>', XenForo_Application::$time - 86400 * $params['option']['cutoff']),
            'deleted' => false,
            'moderated' => false
        );
        if ($params['option']['forum'])
        {
            $conditions['forum_ids'] = explode(',', $params['option']['forum']);
        }

        $fetchOptions = array(
            'join' => XenForo_Model_Thread::FETCH_FORUM | XenForo_Model_Thread::FETCH_USER,
            'permissionCombinationId' => $visitor['permission_combination_id'],
            'readUserId' => $visitor['user_id'],
            'watchUserId' => $visitor['user_id'],
            'postCountUserId' => $visitor['user_id'],
            'order' => 'last_post_date',
            'orderDirection' => 'desc',
            'limit' => $params['option']['limit'],
        );

        $threads = $this->getThreads($conditions, $fetchOptions);

        foreach ($threads AS $threadID => &$thread)
        {
            if ($this->getModelFromCache('XenForo_Model_Thread')->canViewThreadAndContainer($thread, $thread))
            {
                $thread = $this->getModelFromCache('XenForo_Model_Thread')->prepareThread($thread, $thread);
                $thread['canInlineMod'] = false;
                $thread['showForumLink'] = true;
            }
            else
            {
                unset($threads[$threadID]);
            }
        }

        return $threads;
    }

    public function getThreads(array $conditions, array $fetchOptions = array())
    {
        $whereConditions = $this->getModelFromCache('XenForo_Model_Thread')->prepareThreadConditions($conditions, $fetchOptions);

        $sqlClauses = $this->getModelFromCache('XenForo_Model_Thread')->prepareThreadFetchOptions($fetchOptions);
        $limitOptions = $this->getModelFromCache('XenForo_Model_Thread')->prepareLimitFetchOptions($fetchOptions);

        if (!empty($conditions['forum_ids']))
        {
            $whereConditions .= ' AND thread.node_id IN ('.$this->_getDb()->quote($conditions['forum_ids']).')';
        }

        return $this->fetchAllKeyed($this->limitQueryResults('
                SELECT thread.*
                    ' . $sqlClauses['selectFields'] . '
                FROM xf_thread AS thread
                ' . $sqlClauses['joinTables'] . '
                WHERE ' . $whereConditions . '
                ' . $sqlClauses['orderClause'] . '
            ', $limitOptions['limit'], $limitOptions['offset']
        ), 'thread_id');
    }
}

If you wanted to create a second RecentTheads block (Called RecentThreads2), just DUPLICATE both of these files, and simply rename all instances of RecentThreads to RecentThreads2.

Why do you guys always over complicate things?
 
Thanks guys, i have tried both suggestions and i'm still unable to get any output from the second module.

Original Module

j2.webp
New Module

j1.webp

Code for new module : RecentThreads2.xml

Code:
<?xml version="1.0" encoding="utf-8"?>
<module>
  <module_name>RecentThreads2</module_name>
  <module_cache>now</module_cache>
  <module_settings>
    <cutoff desc="Recent Thread Cutoff?" format="">1</cutoff>
    <forum desc="Recent Thread Forum?" format="forums">0</forum>
    <limit desc="Recent Thread Limit?" format="">3</limit>
  </module_settings>
  <module_template><![CDATA[<xen:require css="discussion_list.css" />

<xen:if is="{$position} == 'left' OR {$position} == 'right'">

    <div class="section avatarList">
        <div class="secondaryContent" id="statusUpdates">
            <h3>Recently Active Threads</h3>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads2" value="$thread">
                    <li id="thread-{$thread.thread_id}" class="{$thread.discussion_state} {xen:if {$thread.sticky}, 'sticky'} {xen:if {$thread.isNew}, 'unread'}" data-author="{$thread.username}">
                        <xen:avatar user="$thread" size="s" img="true" />
                        <div class="title">
                            <a href="{xen:link "threads{xen:if '{$thread.isNew} AND {$thread.haveReadData}', '/unread'}", $thread}"
                                title="{xen:if '{$thread.isNew} AND {$thread.haveReadData}', {xen:phrase go_to_first_unread_message}}"
                                class="{xen:if $thread.hasPreview, PreviewTooltip}"
                                data-previewUrl="{xen:if $thread.hasPreview, {xen:link threads/preview, $thread}}">{xen:helper snippet, $thread.title, 50}</a>
                        </div>
                        <div class="muted">
                            <a href="{xen:link members, $thread.lastPostInfo}">{$thread.lastPostInfo.username}</a> @
                            <a{xen:if '{$visitor.user_id}', ' href="{xen:link posts, $thread.lastPostInfo}" title="{xen:phrase go_to_last_message}"'} class="dateTime"><xen:datetime time="$thread.lastPostInfo.post_date" /></a>
                        </div>
                    </li>
                </xen:foreach>
            </ol>
        </div>
    </div>

<xen:else />

    <xen:require css="inline_mod.css" />
    <xen:require js="js/xenforo/discussion_list.js" />

    <form action="{xen:link inline-mod/thread/switch}" method="post"
        class="DiscussionList InlineModForm"
        data-cookieName="threads"
        data-controls="#InlineModControls"
        data-imodOptions="#ModerationSelect option">

        <div class="discussionList section sectionMain" id="RecentThreads2">
            <dl class="sectionHeaders">
                <dt class="posterAvatar"></dt>
                <dd class="main">
                    <a class="title"><span>Recently Active Threads</span></a>
                    <a class="postDate"><span>{xen:phrase start_date}</span></a>
                </dd>
                <dd class="stats">
                    <a class="major"><span>{xen:phrase replies}</span></a>
                    <a class="minor"><span>{xen:phrase views}</span></a>
                </dd>
                <dd class="lastPost"><a><span>{xen:phrase last_message}</span></a></dd>
            </dl>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads2" value="$thread">
                    <xen:include template="thread_list_item">
                        <xen:map from="$thread.showForumLink" to="$showForumLink" />
                    </xen:include>
                </xen:foreach>
            </ol>
        </div>

        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    </form>

</xen:if>

<xen:include template="preview_tooltip" />]]></module_template>
</module>

Code for new module : EWRporta_Block_RecentThreads2.php

Code:
<xen:require css="discussion_list.css" />

<xen:if is="{$position} == 'left' OR {$position} == 'right'">

    <div class="section avatarList">
        <div class="secondaryContent" id="statusUpdates">
            <h3>Recently Active Threads</h3>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads2" value="$thread">
                    <li id="thread-{$thread.thread_id}" class="{$thread.discussion_state} {xen:if {$thread.sticky}, 'sticky'} {xen:if {$thread.isNew}, 'unread'}" data-author="{$thread.username}">
                        <xen:avatar user="$thread" size="s" img="true" />
                        <div class="title">
                            <a href="{xen:link "threads{xen:if '{$thread.isNew} AND {$thread.haveReadData}', '/unread'}", $thread}"
                                title="{xen:if '{$thread.isNew} AND {$thread.haveReadData}', {xen:phrase go_to_first_unread_message}}"
                                class="{xen:if $thread.hasPreview, PreviewTooltip}"
                                data-previewUrl="{xen:if $thread.hasPreview, {xen:link threads/preview, $thread}}">{xen:helper snippet, $thread.title, 50}</a>
                        </div>
                        <div class="muted">
                            <a href="{xen:link members, $thread.lastPostInfo}">{$thread.lastPostInfo.username}</a> @
                            <a{xen:if '{$visitor.user_id}', ' href="{xen:link posts, $thread.lastPostInfo}" title="{xen:phrase go_to_last_message}"'} class="dateTime"><xen:datetime time="$thread.lastPostInfo.post_date" /></a>
                        </div>
                    </li>
                </xen:foreach>
            </ol>
        </div>
    </div>

<xen:else />

    <xen:require css="inline_mod.css" />
    <xen:require js="js/xenforo/discussion_list.js" />

    <form action="{xen:link inline-mod/thread/switch}" method="post"
        class="DiscussionList InlineModForm"
        data-cookieName="threads"
        data-controls="#InlineModControls"
        data-imodOptions="#ModerationSelect option">

        <div class="discussionList section sectionMain" id="RecentThreads2">
            <dl class="sectionHeaders">
                <dt class="posterAvatar"></dt>
                <dd class="main">
                    <a class="title"><span>Recently Active Threads</span></a>
                    <a class="postDate"><span>{xen:phrase start_date}</span></a>
                </dd>
                <dd class="stats">
                    <a class="major"><span>{xen:phrase replies}</span></a>
                    <a class="minor"><span>{xen:phrase views}</span></a>
                </dd>
                <dd class="lastPost"><a><span>{xen:phrase last_message}</span></a></dd>
            </dl>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads2" value="$thread">
                    <xen:include template="thread_list_item">
                        <xen:map from="$thread.showForumLink" to="$showForumLink" />
                    </xen:include>
                </xen:foreach>
            </ol>
        </div>

        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    </form>

</xen:if>

<xen:include template="preview_tooltip" />

When adding Jaxel's second piece of code all i get is code being displayed in the module.
I have no idear were to go next. I was really after the Recent News mod as i would like 4 of them from different locations on the forum.

I appreciate all your help guys, anything else i can try. ;)

I have picked a forum in the module settings.
 
Hi Jakel, I have uploaded this file /libary/EWRporta/block/RecentThreads2.php

Still an empty box. :cry:

Code:
<?php

class EWRporta_Block_RecentThreads2 extends XenForo_Model
{
    public function getBypass($params)
    {
        $visitor = XenForo_Visitor::getInstance();

        $conditions = array(
            'last_post_date' => array('>', XenForo_Application::$time - 86400 * $params['option']['cutoff']),
            'deleted' => false,
            'moderated' => false
        );
        if ($params['option']['forum'])
        {
            $conditions['forum_ids'] = explode(',', $params['option']['forum']);
        }

        $fetchOptions = array(
            'join' => XenForo_Model_Thread::FETCH_FORUM | XenForo_Model_Thread::FETCH_USER,
            'permissionCombinationId' => $visitor['permission_combination_id'],
            'readUserId' => $visitor['user_id'],
            'watchUserId' => $visitor['user_id'],
            'postCountUserId' => $visitor['user_id'],
            'order' => 'last_post_date',
            'orderDirection' => 'desc',
            'limit' => $params['option']['limit'],
        );

        $threads = $this->getThreads($conditions, $fetchOptions);

        foreach ($threads AS $threadID => &$thread)
        {
            if ($this->getModelFromCache('XenForo_Model_Thread')->canViewThreadAndContainer($thread, $thread))
            {
                $thread = $this->getModelFromCache('XenForo_Model_Thread')->prepareThread($thread, $thread);
                $thread['canInlineMod'] = false;
                $thread['showForumLink'] = true;
            }
            else
            {
                unset($threads[$threadID]);
            }
        }

        return $threads;
    }

    public function getThreads(array $conditions, array $fetchOptions = array())
    {
        $whereConditions = $this->getModelFromCache('XenForo_Model_Thread')->prepareThreadConditions($conditions, $fetchOptions);

        $sqlClauses = $this->getModelFromCache('XenForo_Model_Thread')->prepareThreadFetchOptions($fetchOptions);
        $limitOptions = $this->getModelFromCache('XenForo_Model_Thread')->prepareLimitFetchOptions($fetchOptions);

        if (!empty($conditions['forum_ids']))
        {
            $whereConditions .= ' AND thread.node_id IN ('.$this->_getDb()->quote($conditions['forum_ids']).')';
        }

        return $this->fetchAllKeyed($this->limitQueryResults('
                SELECT thread.*
                    ' . $sqlClauses['selectFields'] . '
                FROM xf_thread AS thread
                ' . $sqlClauses['joinTables'] . '
                WHERE ' . $whereConditions . '
                ' . $sqlClauses['orderClause'] . '
            ', $limitOptions['limit'], $limitOptions['offset']
        ), 'thread_id');
    }
}
 
Taz, you are missing 4 instances of "recentthreads2"

Everywhere you see "recentthreads" in your original file needs to say "recentthreads2" in the new file you created.
 
Still no go. :whistle:

RecentThreads2.xml

Code:
<?xml version="1.0" encoding="utf-8"?>
<module>
  <module_name>recentthreads2</module_name>
  <module_cache>now</module_cache>
  <module_settings>
    <cutoff desc="Recent Thread Cutoff?" format="">1</cutoff>
    <forum desc="Recent Thread Forum?" format="forums">0</forum>
    <limit desc="Recent Thread Limit?" format="">3</limit>
  </module_settings>
  <module_template><![CDATA[<xen:require css="discussion_list.css" />

<xen:if is="{$position} == 'left' OR {$position} == 'right'">

    <div class="section avatarList">
        <div class="secondaryContent" id="statusUpdates">
            <h3>Recently Active Threads</h3>

            <ol class="discussionListItems">
                <xen:foreach loop="$recentthreads2" value="$thread">
                    <li id="thread-{$thread.thread_id}" class="{$thread.discussion_state} {xen:if {$thread.sticky}, 'sticky'} {xen:if {$thread.isNew}, 'unread'}" data-author="{$thread.username}">
                        <xen:avatar user="$thread" size="s" img="true" />
                        <div class="title">
                            <a href="{xen:link "threads{xen:if '{$thread.isNew} AND {$thread.haveReadData}', '/unread'}", $thread}"
                                title="{xen:if '{$thread.isNew} AND {$thread.haveReadData}', {xen:phrase go_to_first_unread_message}}"
                                class="{xen:if $thread.hasPreview, PreviewTooltip}"
                                data-previewUrl="{xen:if $thread.hasPreview, {xen:link threads/preview, $thread}}">{xen:helper snippet, $thread.title, 50}</a>
                        </div>
                        <div class="muted">
                            <a href="{xen:link members, $thread.lastPostInfo}">{$thread.lastPostInfo.username}</a> @
                            <a{xen:if '{$visitor.user_id}', ' href="{xen:link posts, $thread.lastPostInfo}" title="{xen:phrase go_to_last_message}"'} class="dateTime"><xen:datetime time="$thread.lastPostInfo.post_date" /></a>
                        </div>
                    </li>
                </xen:foreach>
            </ol>
        </div>
    </div>

<xen:else />

    <xen:require css="inline_mod.css" />
    <xen:require js="js/xenforo/discussion_list.js" />

    <form action="{xen:link inline-mod/thread/switch}" method="post"
        class="DiscussionList InlineModForm"
        data-cookieName="threads"
        data-controls="#InlineModControls"
        data-imodOptions="#ModerationSelect option">

        <div class="discussionList section sectionMain" id="recentthreads2">
            <dl class="sectionHeaders">
                <dt class="posterAvatar"></dt>
                <dd class="main">
                    <a class="title"><span>Recently Active Threads</span></a>
                    <a class="postDate"><span>{xen:phrase start_date}</span></a>
                </dd>
                <dd class="stats">
                    <a class="major"><span>{xen:phrase replies}</span></a>
                    <a class="minor"><span>{xen:phrase views}</span></a>
                </dd>
                <dd class="lastPost"><a><span>{xen:phrase last_message}</span></a></dd>
            </dl>

            <ol class="discussionListItems">
                <xen:foreach loop="$recentthreads2" value="$thread">
                    <xen:include template="thread_list_item">
                        <xen:map from="$thread.showForumLink" to="$showForumLink" />
                    </xen:include>
                </xen:foreach>
            </ol>
        </div>

        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    </form>

</xen:if>

<xen:include template="preview_tooltip" />]]></module_template>
</module>

EWRporta_Block_RecentThreads2

Code:
<xen:require css="discussion_list.css" />

<xen:if is="{$position} == 'left' OR {$position} == 'right'">

    <div class="section avatarList">
        <div class="secondaryContent" id="statusUpdates">
            <h3>Recently Active Threads</h3>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads2" value="$thread">
                    <li id="thread-{$thread.thread_id}" class="{$thread.discussion_state} {xen:if {$thread.sticky}, 'sticky'} {xen:if {$thread.isNew}, 'unread'}" data-author="{$thread.username}">
                        <xen:avatar user="$thread" size="s" img="true" />
                        <div class="title">
                            <a href="{xen:link "threads{xen:if '{$thread.isNew} AND {$thread.haveReadData}', '/unread'}", $thread}"
                                title="{xen:if '{$thread.isNew} AND {$thread.haveReadData}', {xen:phrase go_to_first_unread_message}}"
                                class="{xen:if $thread.hasPreview, PreviewTooltip}"
                                data-previewUrl="{xen:if $thread.hasPreview, {xen:link threads/preview, $thread}}">{xen:helper snippet, $thread.title, 50}</a>
                        </div>
                        <div class="muted">
                            <a href="{xen:link members, $thread.lastPostInfo}">{$thread.lastPostInfo.username}</a> @
                            <a{xen:if '{$visitor.user_id}', ' href="{xen:link posts, $thread.lastPostInfo}" title="{xen:phrase go_to_last_message}"'} class="dateTime"><xen:datetime time="$thread.lastPostInfo.post_date" /></a>
                        </div>
                    </li>
                </xen:foreach>
            </ol>
        </div>
    </div>

<xen:else />

    <xen:require css="inline_mod.css" />
    <xen:require js="js/xenforo/discussion_list.js" />

    <form action="{xen:link inline-mod/thread/switch}" method="post"
        class="DiscussionList InlineModForm"
        data-cookieName="threads"
        data-controls="#InlineModControls"
        data-imodOptions="#ModerationSelect option">

        <div class="discussionList section sectionMain" id="RecentThreads2">
            <dl class="sectionHeaders">
                <dt class="posterAvatar"></dt>
                <dd class="main">
                    <a class="title"><span>Recently Active Threads</span></a>
                    <a class="postDate"><span>{xen:phrase start_date}</span></a>
                </dd>
                <dd class="stats">
                    <a class="major"><span>{xen:phrase replies}</span></a>
                    <a class="minor"><span>{xen:phrase views}</span></a>
                </dd>
                <dd class="lastPost"><a><span>{xen:phrase last_message}</span></a></dd>
            </dl>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads2" value="$thread">
                    <xen:include template="thread_list_item">
                        <xen:map from="$thread.showForumLink" to="$showForumLink" />
                    </xen:include>
                </xen:foreach>
            </ol>
        </div>

        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    </form>

</xen:if>

<xen:include template="preview_tooltip" />

/libary/EWRporta/block/RecentThreads2.php

Code:
<?php

class EWRporta_Block_RecentThreads2 extends XenForo_Model
{
    public function getBypass($params)
    {
        $visitor = XenForo_Visitor::getInstance();

        $conditions = array(
            'last_post_date' => array('>', XenForo_Application::$time - 86400 * $params['option']['recentthreads2_cutoff']),
            'deleted' => false,
            'moderated' => false
        );
        if ($params['option']['recentthreads2_forum'])
        {
            $conditions['forum_ids'] = explode(',', $params['option']['recentthreads2_forum']);
        }

        $fetchOptions = array(
            'join' => XenForo_Model_Thread::FETCH_FORUM | XenForo_Model_Thread::FETCH_USER,
            'permissionCombinationId' => $visitor['permission_combination_id'],
            'readUserId' => $visitor['user_id'],
            'watchUserId' => $visitor['user_id'],
            'postCountUserId' => $visitor['user_id'],
            'order' => 'last_post_date',
            'orderDirection' => 'desc',
            'limit' => $params['option']['recentthreads2_limit'],
        );

        $threads = $this->getThreads($conditions, $fetchOptions);

        foreach ($threads AS $threadID => &$thread)
        {
            if ($this->getModelFromCache('XenForo_Model_Thread')->canViewThreadAndContainer($thread, $thread))
            {
                $thread = $this->getModelFromCache('XenForo_Model_Thread')->prepareThread($thread, $thread);
                $thread['canInlineMod'] = false;
                $thread['showForumLink'] = true;
            }
            else
            {
                unset($threads[$threadID]);
            }
        }

        return $threads;
    }

    public function getThreads(array $conditions, array $fetchOptions = array())
    {
        $whereConditions = $this->getModelFromCache('XenForo_Model_Thread')->prepareThreadConditions($conditions, $fetchOptions);

        $sqlClauses = $this->getModelFromCache('XenForo_Model_Thread')->prepareThreadFetchOptions($fetchOptions);
        $limitOptions = $this->getModelFromCache('XenForo_Model_Thread')->prepareLimitFetchOptions($fetchOptions);

        if (!empty($conditions['forum_ids']))
        {
            $whereConditions .= ' AND thread.node_id IN ('.$this->_getDb()->quote($conditions['forum_ids']).')';
        }

        return $this->fetchAllKeyed($this->limitQueryResults('
                SELECT thread.*
                    ' . $sqlClauses['selectFields'] . '
                FROM xf_thread AS thread
                ' . $sqlClauses['joinTables'] . '
                WHERE ' . $whereConditions . '
                ' . $sqlClauses['orderClause'] . '
            ', $limitOptions['limit'], $limitOptions['offset']
        ), 'thread_id');
    }
}
 
Server log

[Multipart parser init failed: Multipart: Multiple boundary parameters in C-T. [hostname "fixitwizkid.com"] [uri "/portal/import]
 
your forums value = 0 so even if everything is set up perfectly, it wouldn't show anything

You may wish to consider hiring Jaxel or another developer to visit your site to set this up.
 
Is it possible to edit the picture like this​


recent.png
 
your forums value = 0 so even if everything is set up perfectly, it wouldn't show anything

You may wish to consider hiring Jaxel or another developer to visit your site to set this up.

I tried changing the value but still nothing. I'll see if me and jaxel can come to some sort of agreement. Thanks for the help Ryan. (y)
 
I tried changing the value but still nothing. I'll see if me and jaxel can come to some sort of agreement. Thanks for the help Ryan. (y)

Try these - they work on my forum - I *have* found for some reason that these files appear to be case sensitive.

For RecentThreads2.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<module>
  <module_name>RecentThreads2</module_name>
  <module_cache>now</module_cache>
  <module_settings>
    <cutoff desc="Recent Thread Cutoff?" format="">1</cutoff>
    <forum desc="Recent Thread Forum?" format="forums">0</forum>
    <limit desc="Recent Thread Limit?" format="">3</limit>
  </module_settings>
  <module_template><![CDATA[<xen:require css="discussion_list.css" />

<xen:if is="{$position} == 'left' OR {$position} == 'right'">

    <div class="section avatarList">
        <div class="secondaryContent" id="statusUpdates">
            <h3>Recently Active Threads</h3>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads2" value="$thread">
                    <li id="thread-{$thread.thread_id}" class="{$thread.discussion_state} {xen:if {$thread.sticky}, 'sticky'} {xen:if {$thread.isNew}, 'unread'}" data-author="{$thread.username}">
                        <xen:avatar user="$thread" size="s" img="true" />
                        <div class="title">
                            <a href="{xen:link "threads{xen:if '{$thread.isNew} AND {$thread.haveReadData}', '/unread'}", $thread}"
                                title="{xen:if '{$thread.isNew} AND {$thread.haveReadData}', {xen:phrase go_to_first_unread_message}}"
                                class="{xen:if $thread.hasPreview, PreviewTooltip}"
                                data-previewUrl="{xen:if $thread.hasPreview, {xen:link threads/preview, $thread}}">{xen:helper snippet, $thread.title, 50}</a>
                        </div>
                        <div class="muted">
                            <a href="{xen:link members, $thread.lastPostInfo}">{$thread.lastPostInfo.username}</a> @
                            <a{xen:if '{$visitor.user_id}', ' href="{xen:link posts, $thread.lastPostInfo}" title="{xen:phrase go_to_last_message}"'} class="dateTime"><xen:datetime time="$thread.lastPostInfo.post_date" /></a>
                        </div>
                    </li>
                </xen:foreach>
            </ol>
        </div>
    </div>

<xen:else />

    <xen:require css="inline_mod.css" />
    <xen:require js="js/xenforo/discussion_list.js" />

    <form action="{xen:link inline-mod/thread/switch}" method="post"
        class="DiscussionList InlineModForm"
        data-cookieName="threads"
        data-controls="#InlineModControls"
        data-imodOptions="#ModerationSelect option">

        <div class="discussionList section sectionMain" id="recentThreads2">
            <dl class="sectionHeaders">
                <dt class="posterAvatar"></dt>
                <dd class="main">
                    <a class="title"><span>Recently Active Threads</span></a>
                    <a class="postDate"><span>{xen:phrase start_date}</span></a>
                </dd>
                <dd class="stats">
                    <a class="major"><span>{xen:phrase replies}</span></a>
                    <a class="minor"><span>{xen:phrase views}</span></a>
                </dd>
                <dd class="lastPost"><a><span>{xen:phrase last_message}</span></a></dd>
            </dl>

            <ol class="discussionListItems">
                <xen:foreach loop="$RecentThreads2" value="$thread">
                    <xen:include template="thread_list_item">
                        <xen:map from="$thread.showForumLink" to="$showForumLink" />
                    </xen:include>
                </xen:foreach>
            </ol>
        </div>

        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    </form>

</xen:if>

<xen:include template="preview_tooltip" />]]></module_template>
</module>

For RecentThreads2.php

Code:
<?php

class EWRporta_Block_RecentThreads2 extends XenForo_Model
{
    public function getBypass($params)
    {
        $visitor = XenForo_Visitor::getInstance();

        $conditions = array(
            'last_post_date' => array('>', XenForo_Application::$time - 86400 * $params['option']['cutoff']),
            'deleted' => false,
            'moderated' => false
        );
        if ($params['option']['forum'])
        {
            $conditions['forum_ids'] = explode(',', $params['option']['forum']);
        }

        $fetchOptions = array(
            'join' => XenForo_Model_Thread::FETCH_FORUM | XenForo_Model_Thread::FETCH_USER,
            'permissionCombinationId' => $visitor['permission_combination_id'],
            'readUserId' => $visitor['user_id'],
            'watchUserId' => $visitor['user_id'],
            'postCountUserId' => $visitor['user_id'],
            'order' => 'last_post_date',
            'orderDirection' => 'desc',
            'limit' => $params['option']['limit'],
        );

        $threads = $this->getThreads($conditions, $fetchOptions);

        foreach ($threads AS $threadID => &$thread)
        {
            if ($this->getModelFromCache('XenForo_Model_Thread')->canViewThreadAndContainer($thread, $thread))
            {
                $thread = $this->getModelFromCache('XenForo_Model_Thread')->prepareThread($thread, $thread);
                $thread['canInlineMod'] = false;
                $thread['showForumLink'] = true;
            }
            else
            {
                unset($threads[$threadID]);
            }
        }

        return $threads;
    }

    public function getThreads(array $conditions, array $fetchOptions = array())
    {
        $whereConditions = $this->getModelFromCache('XenForo_Model_Thread')->prepareThreadConditions($conditions, $fetchOptions);

        $sqlClauses = $this->getModelFromCache('XenForo_Model_Thread')->prepareThreadFetchOptions($fetchOptions);
        $limitOptions = $this->getModelFromCache('XenForo_Model_Thread')->prepareLimitFetchOptions($fetchOptions);

        if (!empty($conditions['forum_ids']))
        {
            $whereConditions .= ' AND thread.node_id IN ('.$this->_getDb()->quote($conditions['forum_ids']).')';
        }

        return $this->fetchAllKeyed($this->limitQueryResults('
                SELECT thread.*
                    ' . $sqlClauses['selectFields'] . '
                FROM xf_thread AS thread
                ' . $sqlClauses['joinTables'] . '
                WHERE ' . $whereConditions . '
                ' . $sqlClauses['orderClause'] . '
            ', $limitOptions['limit'], $limitOptions['offset']
        ), 'thread_id');
    }
}

I also uploaded both files to the server first then installed the module.

Regards,
Renada
 
Hi,

Instead of duplicating the recent threads block I wanted to duplicate the recent news block. Using the original recentnews.xml and recentnews.php I changed every instance of recentnews to recentnews2 in both files.

I've uploaded both files, selected the forum to pull the threads from and it works but the formatting is slightly off. Somewhere along the line it's decided to put the message text underneath the avatar instead of wrapping around it.

Can anyone tell me where I fritzed the file to cause this please?

recentnews.webp

Template contents:

Code:
<xen:require css="message_user_info.css" />
<xen:require css="bb_code.css" />

<div id="recentNews2">
    <xen:foreach loop="$RecentNews2" value="$news">
        <div class="section sectionMain recentNews2" id="{$news.thread_id}">
            <div class="primaryContent">
                <div class="subHeading">
                    <div style="float: right; white-space: nowrap;">
                        <a href="{xen:link threads, $news}"><xen:datetime time="$news.promote_date" /></a>
                        <xen:if is="{$visitor.permissions.EWRporta.canPromote}">
                            &nbsp; (<a href="{xen:link 'threads/edit', $news}" class="OverlayTrigger">{xen:phrase edit}</a>)
                        </xen:if>
                    </div>

                    <a href="{xen:link threads, $news}">{$news.title}</a>
                </div>

                <div class="messageUserBlock">
                    <div class="avatarHolder">
                        <xen:if is="{$news.attach}">
                            <a href="{xen:link threads, $news}"><img src="{$news.attach.thumbnailUrl}" alt="{$news.attach.filename}" /></a>
                        <xen:elseif is="{$news.medio}" />
                            <div style="background: url('data/media/{$news.medio.media_id}.jpg') no-repeat;">
                                <a href="{xen:link 'full:media/popout', $news.medio}" class="OverlayTrigger"><img src="js/8wayrun/EWRmedio_play.png" width="160" height="90" /></a>
                            </div>
                        <xen:elseif is="{$news.image}" />
                            <a href="{xen:link threads, $news}"><img src="{$news.image}" alt="{$news.image}" style="max-height: 150px; max-width: 150px;" /></a>
                        <xen:else />
                            <xen:avatar user="$news" size="m" itemprop="photo" />
                        </xen:if>
                    </div>
                </div>

                <div class="messageContent baseHtml">
                    {xen:raw $news.messageHtml}

                    <div style="text-align: right;">
                        <a href="{xen:link threads, $news}" style="background: transparent url('@imagePath/xenforo/icons/redirect.png') no-repeat left bottom; padding-left: 20px;">
                            {xen:phrase continue_reading}
                        </a>
                    </div>

                    <div style="clear: right;"></div>
                </div>
                <div class="sectionFooter">
                    <div style="float: right; white-space: nowrap;">
                        <a href="{xen:link threads, $news}">{xen:phrase replies}: {xen:number $news.reply_count}</a>
                    </div>
                    {xen:phrase discussion_in_x_started_by_y_date_z, 'forum=<a href="{xen:link forums, $news}">{$news.node_title}</a>', 'name=<a href="{xen:link members, $news}" class="username">{$news.username}</a>', 'date=<a href="{xen:link threads, $news}">{xen:datetime $news.post_date, html}</a>'}
                </div>
            </div>
        </div>
    </xen:foreach>

    <xen:if hascontent="true">
    <div class="section sectionMain">
        <xen:contentcheck>
        <xen:if is="{$xenOptions.EWRporta_breakout}">
            <div style="margin: -5px 0px; {xen:if '{$option.pagenav} && {$option.count} > {$option.limit}', 'float: right;'}">
                <xen:include template="EWRporta_Footer" />
            </div>
        </xen:if>
        <xen:if is="{$option.pagenav} && {$option.count} > {$option.limit}">
            <div style="margin-left: 5px;">
                <xen:pagenav link="portal" page="{$page}" perpage="{$option.limit}" total="{$option.count}" />
            </div>
        </xen:if>
        </xen:contentcheck>
    </div>
    </xen:if>
</div>

Regards,
Renada :)
 
Top Bottom