MyBB Community Forums

Full Version: Would i able to do this? How? So annoying af
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is strawberry annoying, How do i move that latest post above the announcement tab?
[Image: Xedkg6z.png]

GUYS PLEASE HELP!
You're using a gaming theme named "Tesla Game" that appears to be a premium theme.
Please provide purchasing proof, if you want you can do so via pm.
Otherwise we will deny you support.

Thanks,
Consa

However to simplify things for you: look at your index template (templates and theme --> your theme --> index template) and re-position the latestposts variable to where you deem fit.
(2016-05-14, 03:11 PM)Consaholic Wrote: [ -> ]You're using a gaming theme named "Tesla Game" that appears to be a premium theme.
Please provide purchasing proof, if you want you can do so via pm.
Otherwise we will deny you support.

Thanks,
Consa

However to simplify things for you: look at your index template (templates and theme --> your theme --> index template) and re-position the latestposts variable to where you deem fit.

How can i provide that proof to you?

Anyways, I'm using latestpost plugin, which seems to have a latestpost.php on the root directory. And the latestpost variable cannot be found on the index template. I have tried moving all the variables from latestpost.php to index template but it does not work. Is there any way how can i do this ? Thank you very much

Latestpost.php
<?php
/**
 * latest posts sidebar
 *
 * Website: http://mybebb.org
 * Skype: daniel_mit1
 *
 **/
	
/* Hooks */
$plugins->add_hook("index_end", "latestposts");

// Disallow direct access to this file for security reasons
<br>
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.");
}

function latestposts_info()
{
	global $lang;
	$lang->load("latestposts");
    return array(
        "name"          => $lang->plugname,
        "description"   => $lang->plugdesc,
        "website"       => "http://myhebb.org/",
        "author"        => "NORIS",
        "authorsite"    => "http://myhebb.org/",
        "version"       => "1.0",
        "guid"          => "leatestposts",
        "compatibility" => "18*"
    );
}

function latestposts_install()
{
    global $db, $lang;
	$lang->load("latestposts");
    $new_setting_group = array(
    "name" => "latestposts",
    "title" => $lang->settings_name,
    "disporder" => 1,
    "isdefault" => 0
    );

    $gid = $db->insert_query("settinggroups", $new_setting_group);

    $settings[] = array(
    "name" => "latestposts_threadcount",
    "title" => $lang->num_posts_to_show,
    "optionscode" => "text",
    "disporder" => 1,
    "value" => 15,
    "gid" => $gid
    );

    $settings[] = array(
    "name" => "latestposts_forumskip",
    "title" => $lang->forums_to_skip,
    "description" => $lang->forums_to_skip_desc,
    "optionscode" => "text",
    "disporder" => 2,
    "gid" => $gid
    );

    $settings[] = array(
    "name" => "latestposts_showtime",
    "title" => $lang->latestposts_showtime,
    "optionscode" => "yesno",
    "disporder" => 3,
    "value" => 1,
    "gid" => $gid
    );

    $settings[] = array(
    "name" => "latestposts_rightorleft",
    "title" => $lang->rightorleft,
    "optionscode" => "select
right=".$lang->latestposts_right."
left=".$lang->latestposts_left,
    "disporder" => 4,
    "value" => "right",
    "gid" => $gid
    );

    foreach($settings as $array => $content)
    {
        $db->insert_query("settings", $content);
    }
    rebuild_settings();

	require_once(MYBB_ROOT."admin/inc/functions_themes.php");
	
    // Add stylesheet to the master template so it becomes inherited.
    $stylesheet = <<<latestposts
	.latestpost {
		padding: 2px 10px;
	}
latestposts;
    $css = array(
        'sid' => NULL,
        'name' => 'latestposts.css',
        'tid' => '1',
        'stylesheet' => $db->escape_string($stylesheet),
        'cachefile' => 'latestposts.css',
        'lastmodified' => TIME_NOW,
    );
    $db->insert_query('themestylesheets', $css);
    cache_stylesheet(1, "latestposts.css", $stylesheet);
    update_theme_stylesheet_list("1");
}

function latestposts_is_installed()
{
    global $db;
    $query = $db->simple_select("settinggroups", "*", "name='latestposts'");
    if($db->num_rows($query))
    {
        return TRUE;
    }
    return FALSE;
}

function latestposts_activate()
{
    global $db, $lang;
	$lang->load("latestposts");
    $templates['index_sidebar'] = '<table border="0" class="tborder">
<thead>
<tr>
<td class="thead">
<div><strong>{$lang->latest_posts_title}</strong></div>
</td>
</tr>
</thead>
<tbody>
{$postslist}
</tbody>
</table>';
    $templates['index_sidebar_post'] = '<tr>
<td class="trow1 latestpost" valign="top">
<strong><a href="{$mybb->settings[\'bburl\']}/showthread.php?tid={$tid}">{$postname}</a></strong><br>
{$lang->latest_post_by} {$lastposterlink} {$lang->latestposttime}
</td>
</tr>';

    foreach($templates as $title => $template) {
		$new_template = array('title' => $db->escape_string($title), 'template' => $db->escape_string($template), 'sid' => '-1', 'version' => '1800', 'dateline' => TIME_NOW);
		$db->insert_query('templates', $new_template);
	}

    require_once MYBB_ROOT . "/inc/adminfunctions_templates.php";

    find_replace_templatesets('index', "#" . preg_quote('{$forums}') . "#i", '<div style="float:{$left};width: 74%;">{$forums}</div>
<div style="float:{$right};width:25%;">{$sidebar}</div>');
}

function latestposts_deactivate()
{
    global $db;
    $db->delete_query("templates", "title IN('index_sidebar','index_sidebar_post')");

    require_once MYBB_ROOT . "/inc/adminfunctions_templates.php";

    find_replace_templatesets('index', "#" . preg_quote('<div style="float:{$left};width: 74%;">{$forums}</div>
<div style="float:{$right};width:25%;">{$sidebar}</div>') . "#i", '{$forums}');
}

function latestposts_uninstall()
{
    global $db;
    $query = $db->simple_select("settinggroups", "gid", "name='latestposts'");
    $gid = $db->fetch_field($query, "gid");
    if(!$gid) {
        return;
    }
    $db->delete_query("settinggroups", "name='latestposts'");
    $db->delete_query("settings", "gid=$gid");
    rebuild_settings();
}

function latestposts()
{
	global $mybb,$lang, $db, $templates, $postslist, $sidebar, $right, $left;
	$lang->load("latestposts");
    $threadlimit = (int) $mybb->settings['latestposts_threadcount'];
    $where = NULL;

    if(!$threadlimit) {
	    $threadlimit = 15;
	}
    if($mybb->settings['latestposts_forumskip']) {
        $where .= " AND t.fid NOT IN(" . $mybb->settings['latestposts_forumskip'] . ") ";
    }
	require_once MYBB_ROOT."inc/functions_search.php";
    
	$unsearchforums = get_unsearchable_forums();
	if($unsearchforums) {
		$where .= " AND t.fid NOT IN ($unsearchforums)";
	}
	$inactiveforums = get_inactive_forums();
	if($inactiveforums) {
		$where .= " AND t.fid NOT IN ($inactiveforums)";
	}

	$query = $db->query("
		SELECT t.*, u.username AS userusername, u.usergroup, u.displaygroup, lp.usergroup AS lastusergroup, lp.displaygroup as lastdisplaygroup
		FROM ".TABLE_PREFIX."threads t
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
		LEFT JOIN ".TABLE_PREFIX."users lp ON (t.lastposteruid=lp.uid)
        WHERE 1=1 {$where}
		ORDER BY t.lastpost DESC
		LIMIT $threadlimit
	");
	while($thread = $db->fetch_array($query)) {
        $tid = $thread['tid'];
        $postname = $thread['subject'];
        $lastpostlink = get_thread_link($thread['tid'], "", "lastpost");
		$lastposttimeago = my_date("relative", $thread['lastpost']);
		$lastposter = $thread['lastposter'];
		$lastposteruid = $thread['lastposteruid'];
		$permissions = forum_permissions($thread['fid']);
		if($permissions['canview'] != 1 || $permissions['canviewthreads'] != 1)
		{
				continue;
		}
		
        if($mybb->settings['latestposts_showtime'] == 1) {
            $lang->latestposttime = $lang->sprintf($lang->latestposttime, $lastposttimeago);
		}
		else{
			$lang->latestposttime =  NULL;
		}
		
		if($lastposteruid == 0) {
			$lastposterlink = $lastposter;
		}
        else {
        	$lastposterlink = build_profile_link(format_name($lastposter, $thread['lastusergroup'], $thread['lastdisplaygroup']), $lastposteruid);
		}
		
        eval("\$postslist .= \"".$templates->get("index_sidebar_post")."\";");
		}
		
		if($mybb->settings['latestposts_rightorleft'] == "right") {
			$right = "right";
			$left = "left";
		}
		else {
			$right = "left";
			$left = "right";
		}
        eval("\$sidebar = \"".$templates->get("index_sidebar")."\";");
}

?>


My index template
<html>
<head>
	
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
	lang.no_new_posts = "{$lang->no_new_posts}";
	lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
</head>
<body class="bodyimg">
{$header}
<div class="sidebar"> 
   <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>

/* THIS IS THE TOP OF THE ANNOUNCEMENT */

<td class="tcat2" style="text-align:center;">
  <div class="theadtitle2" style="float:none;"><a href="#"><center><i class="fa fa-microphone"></i> Announcements</center></a></div>
</td>
</tr>
<tbody>
<td class="trow1">
  <div class="tgnewsticker">
<ul>
  <li>Welcome to {$mybb->settings['bbname']}.</li>
  <li> Please Join/Register to access our complete website.</li>
  <li>Our server and teamspeak are on under maintenance, Please bear with us!</li>
</ul>
    </div>
</td>
</tbody>
</table>
  <br />    
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="tcat2" style="text-align:center;">
  <div class="theadtitle2" style="float:none;"><a href="#"><center><i class="fa fa-newspaper-o"></i> Side Bar Ads</center></a></div>
</td>
</tr>
<tbody>
<td class="trow1">
  <center> <a href="#"><img src="images/tg/dummyad.png"></a></center>
</td>
</tbody>
</table><br />
	
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
</tr>

	
	
</table>
  <br />
</div>
<div class="forums">
<div style="float:{$left};width: 74%;">{$forums}</div>
<div style="float:{$right};width:25%;">{$sidebar}</div>
</div>
{$boardstats}
{$footer}
</body>
	
</html>

(2016-05-14, 03:11 PM)Consaholic Wrote: [ -> ]You're using a gaming theme named "Tesla Game" that appears to be a premium theme.
Please provide purchasing proof, if you want you can do so via pm.
Otherwise we will deny you support.

Thanks,
Consa

However to simplify things for you: look at your index template (templates and theme --> your theme --> index template) and re-position the latestposts variable to where you deem fit.

How can i provide that proof to you?

Anyways, I'm using latestpost plugin, which seems to have a latestpost.php on the root directory. And the latestpost variable cannot be found on the index template. I have tried moving all the variables from latestpost.php to index template but it does not work. Is there any way how can i do this ? Thank you very much

Latestpost.php
<?php
/**
 * latest posts sidebar
 *
 * Website: http://mybebb.org
 * Skype: daniel_mit1
 *
 **/
	
/* Hooks */
$plugins->add_hook("index_end", "latestposts");

// Disallow direct access to this file for security reasons
<br>
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.");
}

function latestposts_info()
{
	global $lang;
	$lang->load("latestposts");
    return array(
        "name"          => $lang->plugname,
        "description"   => $lang->plugdesc,
        "website"       => "http://myhebb.org/",
        "author"        => "NORIS",
        "authorsite"    => "http://myhebb.org/",
        "version"       => "1.0",
        "guid"          => "leatestposts",
        "compatibility" => "18*"
    );
}

function latestposts_install()
{
    global $db, $lang;
	$lang->load("latestposts");
    $new_setting_group = array(
    "name" => "latestposts",
    "title" => $lang->settings_name,
    "disporder" => 1,
    "isdefault" => 0
    );

    $gid = $db->insert_query("settinggroups", $new_setting_group);

    $settings[] = array(
    "name" => "latestposts_threadcount",
    "title" => $lang->num_posts_to_show,
    "optionscode" => "text",
    "disporder" => 1,
    "value" => 15,
    "gid" => $gid
    );

    $settings[] = array(
    "name" => "latestposts_forumskip",
    "title" => $lang->forums_to_skip,
    "description" => $lang->forums_to_skip_desc,
    "optionscode" => "text",
    "disporder" => 2,
    "gid" => $gid
    );

    $settings[] = array(
    "name" => "latestposts_showtime",
    "title" => $lang->latestposts_showtime,
    "optionscode" => "yesno",
    "disporder" => 3,
    "value" => 1,
    "gid" => $gid
    );

    $settings[] = array(
    "name" => "latestposts_rightorleft",
    "title" => $lang->rightorleft,
    "optionscode" => "select
right=".$lang->latestposts_right."
left=".$lang->latestposts_left,
    "disporder" => 4,
    "value" => "right",
    "gid" => $gid
    );

    foreach($settings as $array => $content)
    {
        $db->insert_query("settings", $content);
    }
    rebuild_settings();

	require_once(MYBB_ROOT."admin/inc/functions_themes.php");
	
    // Add stylesheet to the master template so it becomes inherited.
    $stylesheet = <<<latestposts
	.latestpost {
		padding: 2px 10px;
	}
latestposts;
    $css = array(
        'sid' => NULL,
        'name' => 'latestposts.css',
        'tid' => '1',
        'stylesheet' => $db->escape_string($stylesheet),
        'cachefile' => 'latestposts.css',
        'lastmodified' => TIME_NOW,
    );
    $db->insert_query('themestylesheets', $css);
    cache_stylesheet(1, "latestposts.css", $stylesheet);
    update_theme_stylesheet_list("1");
}

function latestposts_is_installed()
{
    global $db;
    $query = $db->simple_select("settinggroups", "*", "name='latestposts'");
    if($db->num_rows($query))
    {
        return TRUE;
    }
    return FALSE;
}

function latestposts_activate()
{
    global $db, $lang;
	$lang->load("latestposts");
    $templates['index_sidebar'] = '<table border="0" class="tborder">
<thead>
<tr>
<td class="thead">
<div><strong>{$lang->latest_posts_title}</strong></div>
</td>
</tr>
</thead>
<tbody>
{$postslist}
</tbody>
</table>';
    $templates['index_sidebar_post'] = '<tr>
<td class="trow1 latestpost" valign="top">
<strong><a href="{$mybb->settings[\'bburl\']}/showthread.php?tid={$tid}">{$postname}</a></strong><br>
{$lang->latest_post_by} {$lastposterlink} {$lang->latestposttime}
</td>
</tr>';

    foreach($templates as $title => $template) {
		$new_template = array('title' => $db->escape_string($title), 'template' => $db->escape_string($template), 'sid' => '-1', 'version' => '1800', 'dateline' => TIME_NOW);
		$db->insert_query('templates', $new_template);
	}

    require_once MYBB_ROOT . "/inc/adminfunctions_templates.php";

    find_replace_templatesets('index', "#" . preg_quote('{$forums}') . "#i", '<div style="float:{$left};width: 74%;">{$forums}</div>
<div style="float:{$right};width:25%;">{$sidebar}</div>');
}

function latestposts_deactivate()
{
    global $db;
    $db->delete_query("templates", "title IN('index_sidebar','index_sidebar_post')");

    require_once MYBB_ROOT . "/inc/adminfunctions_templates.php";

    find_replace_templatesets('index', "#" . preg_quote('<div style="float:{$left};width: 74%;">{$forums}</div>
<div style="float:{$right};width:25%;">{$sidebar}</div>') . "#i", '{$forums}');
}

function latestposts_uninstall()
{
    global $db;
    $query = $db->simple_select("settinggroups", "gid", "name='latestposts'");
    $gid = $db->fetch_field($query, "gid");
    if(!$gid) {
        return;
    }
    $db->delete_query("settinggroups", "name='latestposts'");
    $db->delete_query("settings", "gid=$gid");
    rebuild_settings();
}

function latestposts()
{
	global $mybb,$lang, $db, $templates, $postslist, $sidebar, $right, $left;
	$lang->load("latestposts");
    $threadlimit = (int) $mybb->settings['latestposts_threadcount'];
    $where = NULL;

    if(!$threadlimit) {
	    $threadlimit = 15;
	}
    if($mybb->settings['latestposts_forumskip']) {
        $where .= " AND t.fid NOT IN(" . $mybb->settings['latestposts_forumskip'] . ") ";
    }
	require_once MYBB_ROOT."inc/functions_search.php";
    
	$unsearchforums = get_unsearchable_forums();
	if($unsearchforums) {
		$where .= " AND t.fid NOT IN ($unsearchforums)";
	}
	$inactiveforums = get_inactive_forums();
	if($inactiveforums) {
		$where .= " AND t.fid NOT IN ($inactiveforums)";
	}

	$query = $db->query("
		SELECT t.*, u.username AS userusername, u.usergroup, u.displaygroup, lp.usergroup AS lastusergroup, lp.displaygroup as lastdisplaygroup
		FROM ".TABLE_PREFIX."threads t
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
		LEFT JOIN ".TABLE_PREFIX."users lp ON (t.lastposteruid=lp.uid)
        WHERE 1=1 {$where}
		ORDER BY t.lastpost DESC
		LIMIT $threadlimit
	");
	while($thread = $db->fetch_array($query)) {
        $tid = $thread['tid'];
        $postname = $thread['subject'];
        $lastpostlink = get_thread_link($thread['tid'], "", "lastpost");
		$lastposttimeago = my_date("relative", $thread['lastpost']);
		$lastposter = $thread['lastposter'];
		$lastposteruid = $thread['lastposteruid'];
		$permissions = forum_permissions($thread['fid']);
		if($permissions['canview'] != 1 || $permissions['canviewthreads'] != 1)
		{
				continue;
		}
		
        if($mybb->settings['latestposts_showtime'] == 1) {
            $lang->latestposttime = $lang->sprintf($lang->latestposttime, $lastposttimeago);
		}
		else{
			$lang->latestposttime =  NULL;
		}
		
		if($lastposteruid == 0) {
			$lastposterlink = $lastposter;
		}
        else {
        	$lastposterlink = build_profile_link(format_name($lastposter, $thread['lastusergroup'], $thread['lastdisplaygroup']), $lastposteruid);
		}
		
        eval("\$postslist .= \"".$templates->get("index_sidebar_post")."\";");
		}
		
		if($mybb->settings['latestposts_rightorleft'] == "right") {
			$right = "right";
			$left = "left";
		}
		else {
			$right = "left";
			$left = "right";
		}
        eval("\$sidebar = \"".$templates->get("index_sidebar")."\";");
}

?>


My index template
<html>
<head>
	
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
	lang.no_new_posts = "{$lang->no_new_posts}";
	lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
</head>
<body class="bodyimg">
{$header}
<div class="sidebar"> 
   <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>

/* THIS IS THE TOP OF THE ANNOUNCEMENT */

<td class="tcat2" style="text-align:center;">
  <div class="theadtitle2" style="float:none;"><a href="#"><center><i class="fa fa-microphone"></i> Announcements</center></a></div>
</td>
</tr>
<tbody>
<td class="trow1">
  <div class="tgnewsticker">
<ul>
  <li>Welcome to {$mybb->settings['bbname']}.</li>
  <li> Please Join/Register to access our complete website.</li>
  <li>Our server and teamspeak are on under maintenance, Please bear with us!</li>
</ul>
    </div>
</td>
</tbody>
</table>
  <br />    
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="tcat2" style="text-align:center;">
  <div class="theadtitle2" style="float:none;"><a href="#"><center><i class="fa fa-newspaper-o"></i> Side Bar Ads</center></a></div>
</td>
</tr>
<tbody>
<td class="trow1">
  <center> <a href="#"><img src="images/tg/dummyad.png"></a></center>
</td>
</tbody>
</table><br />
	
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
</tr>

	
	
</table>
  <br />
</div>
<div class="forums">
<div style="float:{$left};width: 74%;">{$forums}</div>
<div style="float:{$right};width:25%;">{$sidebar}</div>
</div>
{$boardstats}
{$footer}
</body>
	
</html>
^ you should be having email receipt from PayPal
(2016-05-15, 06:52 AM).m. Wrote: [ -> ]^ you should be having email receipt from PayPal

http://imgur.com/89GaNIS

Here you go
index template => replace below content with {$forums}
<div style="float:{$left};width: 74%;">{$forums}</div>
<div style="float:{$right};width:25%;">{$sidebar}</div>

index template => find <tr></tr> (on different lines) and replace with below
<tr><td>
{$sidebar}
</td></tr>

if above doesn't help then you may PM me temporary access to your forum admin panel
Thanks man, i got it fixed, Thank you so much