Not Solved the shoutbox on the portal.... is possible?
#1
Not Solved
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...
[Image: banner468x60.jpg]
------
[Image: bluelogo2.gif]
Reply
#2
Not Solved
Or maybe on the index page?
Reply
#3
Not Solved
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
Reply
#4
Not Solved
u rock man!!!! thats what i was looking for... thanx!!
[Image: banner468x60.jpg]
------
[Image: bluelogo2.gif]
Reply
#5
Not Solved
How many shouts it will show? Can I control the number of the latest shouts?
Reply
#6
Not Solved
in this shoutbox version is impossible, wait for the 2.0
[Image: banner468x60.jpg]
------
[Image: bluelogo2.gif]
Reply
#7
Not Solved
ok, thanx. Smile
Reply
#8
Not Solved
Can it also be added on the index.php of my forum?
[Image: destroyerjf8.jpg]

Give us your feedback about MyBB in this thread and become listed on the MyBB website.
Reply
#9
Not Solved
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
Reply
#10
Not Solved
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)