MyBB Community Forums

Full Version: how can i use this portal page function in index page?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how can i use this portal page function in index page?

i want to use this portal.php function on index page

{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}
Advanced sidebar plugin has these functions.
https://community.mybb.com/mods.php?action=view&pid=819
i know but i want to use this function
(2019-02-02, 06:41 AM)jack3935 Wrote: [ -> ]how can i use this portal page function in index page?

i want to use this portal.php function on index page

{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}

Which theme are you using?

Are you using the default MyBB theme? 

Or...

Are you using a non-default MyBB theme?
default MyBB theme

(2019-02-02, 07:06 AM)Serpius Wrote: [ -> ]
(2019-02-02, 06:41 AM)jack3935 Wrote: [ -> ]how can i use this portal page function in index page?

i want to use this portal.php function on index page

{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}

Which theme are you using?

Are you using the default MyBB theme? 

Or...

Are you using a non-default MyBB theme?

default MyBB theme
Barring latest threads, everything you listed is already on the index page. For example, instead of {$stats}, the index page uses {$boardstats}. It's not possibly to use the exact same variables without editing core files. If you're willing to edit core files you may as well just use the plugin suggested.
SOLVED BY editing index.php
add

require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/functions_user.php";

and

//myedit

$latestthreads = '';
// Latest forum discussions
if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'] && $mybb->settings['portal_excludediscussion'] != -1)
{
$altbg = alt_trow();
$threadlist = '';

$excludeforums = '';
if(!empty($mybb->settings['portal_excludediscussion']))
{
$excludeforums = "AND t.fid NOT IN ({$mybb->settings['portal_excludediscussion']})";
}

$query = $db->query("
SELECT t.tid, t.fid, t.uid, t.lastpost, t.lastposteruid, t.lastposter, t.subject, t.replies, t.views, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE 1=1 {$excludeforums}{$tunviewwhere} AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC
LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
);
while($thread = $db->fetch_array($query))
{
$forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);

// Make sure we can view this thread
if(isset($forumpermissions[$thread['fid']]['canonlyviewownthreads']) && $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
{
continue;
}

$lastpostdate = my_date('relative', $thread['lastpost']);
if(!$thread['lastposteruid'] && !$thread['lastposter'])
{
$lastposter = htmlspecialchars_uni($lang->guest);
}
else
{
$lastposter = htmlspecialchars_uni($thread['lastposter']);
}
$thread['replies'] = my_number_format($thread['replies']);
$thread['views'] = my_number_format($thread['views']);

// Don't link to guest's profiles (they have no profile).
if($thread['lastposteruid'] == 0)
{
$lastposterlink = $lastposter;
}
else
{
$lastposterlink = build_profile_link($lastposter, $thread['lastposteruid']);
}

$thread['subject'] = $thread['fullsubject'] = $parser->parse_badwords($thread['subject']);
if(my_strlen($thread['subject']) > 25)
{
$thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
}
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$thread['fullsubject'] = htmlspecialchars_uni($thread['fullsubject']);

$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
$thread['forumlink'] = get_forum_link($thread['fid']);
$thread['forumname'] = $forum_cache[$thread['fid']]['name'];
eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
$altbg = alt_trow();
}
if($threadlist)
{
// Show the table only if there are threads
eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
}
}

//endmy edit