MyBB Community Forums
the shoutbox on the portal.... is possible? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Themes (https://community.mybb.com/forum-103.html)
+---- Forum: Theme Support (https://community.mybb.com/forum-10.html)
+---- Thread: the shoutbox on the portal.... is possible? (/thread-7817.html)

Pages: 1 2 3 4 5 6


the shoutbox on the portal.... is possible? - Cloud Strife - 2006-03-27

like the title say, is possible to add the shoutbox to the portal? i mean... like, show the shoutbox... and all the shouts on the portal...


RE: the shoutbox on the portal.... is possible? - zabava - 2006-03-27

Or maybe on the index page?


RE: the shoutbox on the portal.... is possible? - zaher1988 - 2006-03-28

Heloo there
open ./portal.php

find
eval("\$portal = \"".$templates->get("portal")."\";"); 

above it add
 //shoutbox



if($action == "do_shout")
{
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts");
	$count = $db->num_rows($query);
	$startat = $count - 5;
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts ORDER BY dateline LIMIT $startat, 5");
	$check = 0;
	while($shout = $db->fetch_array($query))
	{
		$username = $shout['username'];
		if($username == $mybb['username'])
		{
			$check++;
		}
	}
	if($check >= 5)
	{
		eval("\$error = \"".$templates->get("shoutbox_error_flood")."\";");
		outputpage($error);
	}
	else
	{
		$message = addslashes($message);
		$dateline = time();
		$ipaddress = $REMOTE_ADDR;
		$query = $db->query("INSERT INTO ".TABLE_PREFIX."shouts VALUES ('','$mybb[uid]','$mybb[username]','$message','$dateline','$ipaddress')");
		redirect("shoutbox.php", "Shout submitted.", $settings['bbname']." - Shoutbox");
	}
}
elseif($action == "do_delete")
{
	$db->query("DELETE FROM ".TABLE_PREFIX."shouts WHERE sid='$sid'");
	redirect("shoutbox.php", "Shout deleted.", $settings['bbname']." - Shoutbox");
}
elseif($action == "do_edit")
{
	$message = addslashes($message);
	$db->query("UPDATE ".TABLE_PREFIX."shouts SET message='$message' WHERE sid='$sid'");
	redirect("shoutbox.php", "Shout edited.", $settings['bbname']." - Shoutbox");
}
elseif($action == "delete")
{
	if(!$sid)
	{
		error("Invalid Shout", "Invalid shout.");
	}
	else
	{
		$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts WHERE sid='$sid'");
		$shout = $db->fetch_array($query);
		if($mybb['uid'] != $shout['uid'] && $mybb['usergroup'] != 4 && $mybb['usergroup'] != 3)
		{
			nopermission();
		}
		eval("\$deleteshout = \"".$templates->get("shoutbox_deleteshout")."\";");
		outputpage($deleteshout);
	}
}
elseif($action == "edit")
{
	if(!$sid)
	{
		error("Invalid Shout", "Invalid shout.");
	}
	else
	{
		$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts WHERE sid='$sid'");
		$shout = $db->fetch_array($query);
		if($mybb['uid'] != $shout['uid'] && $mybb['usergroup'] != 4 && $mybb['usergroup'] != 3)
		{
			nopermission();
		}
		$shout['message'] = str_replace('"', '"', $shout['message']);
		eval("\$editshout = \"".$templates->get("shoutbox_editshout")."\";");
		outputpage($editshout);
	}
}
else
{
	if(!$page)
	{
		$page = 1;
	}
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts");
	$count = $db->num_rows($query);
	$limit = 24;
	$pages = $count / $limit;
	$pages = ceil($pages);
	if($count == 0)
	{
		eval("\$shouts = \"".$templates->get("shoutbox_error_noshouts")."\";");
	}
	$startat = $count - ($limit * $page);
	if($page == $pages)
	{
		if($startat != 0)
		{
			$limit = $limit + $startat;
			$startat = 0;
		}
	}
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts ORDER BY dateline LIMIT $startat, $limit");
	while($shout = $db->fetch_array($query))
	{
		$shout['shouttime'] = mydate($settings['dateformat'], $shout['dateline']) . " " . mydate($settings['timeformat'], $shout['dateline']);
		$query2 = $db->query("SELECT u.usergroup, g.* FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE u.uid='$shout[uid]'");
		$group = $db->fetch_array($query2);
		$shout['message'] = postify($shout['message']);
		$mecheck = explode(" ", $shout['message']);
		if($mecheck[0] == "/me" || $mecheck[0] == "/slap")
		{
			$shout['message'] = domecode($shout['message'], $shout['username']);
			$shout['username'] = "";
		}
		else
		{
			$shout['username'] = formatname($shout['username'], $group['namestyle']);
			$shout['username'] = "<<a href=\"member.php?action=profile&uid=$shout[uid]\">$shout[username]</a>>";
		}
		if($mybb['usergroup'] == 4 || $mybb['usergroup'] == 3)
		{
			$title = "title=\"Posted: $shout[shouttime], IP: $shout[ipaddress]\"";
		}
		else
		{
			$title = "title=\"Posted: $shout[shouttime]\"";
		}
		if($mybb['uid'] == $shout['uid'] || $mybb['usergroup'] == 4 || $mybb['usergroup'] == 3)
		{
			eval("\$options = \"".$templates->get("shoutbox_options")."\";");
		}
		else
		{
			$options = "";
		}
		if($bgcolor == "trow1")
		{
			$bgcolor = "trow2";
		}
		else
		{
			$bgcolor = "trow1";
		}
		eval("\$shouts .= \"".$templates->get("shoutbox_shout")."\";");
	}
	if($page != 1)
	{
		if($page == $pages)
		{
			$nextpage = $page - 1;
			eval("\$next = \"".$templates->get("shoutbox_next")."\";");
		}
		else
		{
			$prevpage = $page + 1;
			$nextpage = $page - 1;
			eval("\$prev = \"".$templates->get("shoutbox_prev")."\";");
			eval("\$next = \"".$templates->get("shoutbox_next")."\";");
		}
	}
	else
	{
		if($pages > 1)
		{
			$prevpage = $page + 1;
			eval("\$prev = \"".$templates->get("shoutbox_prev")."\";");
		}
	}
	if($pages > 1)
	{
		eval("\$pageselect = \"".$templates->get("shoutbox_pages")."\";");
	}
	eval("\$submit = \"".$templates->get("shoutbox_submit")."\";");
	
	$refresh = "<meta http-equiv=\"refresh\" content=\"60;URL=portal.php\">";
	eval("\$shoutbox = \"".$templates->get("shoutbox")."\";");
}

then open
Admin CP > Templates >Modify / delete > Portal page templates > portal

find

$latestthread

below it add

<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td>
<table border="0" cellspacing="$theme[borderwidth]" cellpadding="$theme[tablespace]" width="100%">
<tr>
<td cellspacing="0" cellpadding="0" >
<span class="smalltext">
$shoutbox</span>
<div align="center">$shoutboxlink | </div>
</td>
</tr>
</table>
</td></tr></table>
<br />

it will look something as here
this will also refresh the portal each few secs, so u can see all the new posts.
take note that you cant post shouts from there, u can only see them
regardsSmile


RE: the shoutbox on the portal.... is possible? - Cloud Strife - 2006-03-28

u rock man!!!! thats what i was looking for... thanx!!


RE: the shoutbox on the portal.... is possible? - zabava - 2006-04-10

How many shouts it will show? Can I control the number of the latest shouts?


RE: the shoutbox on the portal.... is possible? - Cloud Strife - 2006-04-10

in this shoutbox version is impossible, wait for the 2.0


RE: the shoutbox on the portal.... is possible? - zabava - 2006-04-10

ok, thanx. Smile


RE: the shoutbox on the portal.... is possible? - destroyer - 2006-04-11

Can it also be added on the index.php of my forum?


RE: the shoutbox on the portal.... is possible? - zaher1988 - 2006-04-11

Quote:How many shouts it will show? Can I control the number of the latest shouts?

it is the same settings for the mod it self.

Quote:Can it also be added on the index.php of my forum?

Use side boxes mod, and add the same php code to index.php, and the same html code in place described in the sideboxes mod

regards


RE: the shoutbox on the portal.... is possible? - zabava - 2006-04-11

zaher1988 Wrote:
Quote:How many shouts it will show? Can I control the number of the latest shouts?

it is the same settings for the mod it self.



regards

hehe, cool, I limited it to show only the last 10 shouts Big Grin