MyBB Community Forums

Full Version: [SOLVED] Create a second portal (with new name)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I want to create my store within a second portal... I sucessfully created the portal by downloading the "portal.php" and renaming "store.php" but what i am now having problems with, is were in the "store.php" can i change what forum the announcements gets pulled from?

Aka main portal pulls from forums id "2"

How could I make just the store portal pull from say forum id 10, or 12, or whatever... help is much apriciated Big Grin

thank you!

http://snowingmodz.com/forums/portal
http://snowingmodz.com/forums/store
Although I just noticed, that both portals say "SM - Forums / Portal" os teh location.. idk if this affects anything
Edit wherever it has the setting for forum to pull announcements from, and change that to a hardcoded value. This is what you need to look for:

$mybb->settings['portal_announcementsfid']
(2010-11-23, 09:53 AM)MattRogowski Wrote: [ -> ]Edit wherever it has the setting for forum to pull announcements from, and change that to a hardcoded value. This is what you need to look for:

$mybb->settings['portal_announcementsfid']

Ok, I havent gone through and searched for it yet, but i know theres atleast one of thoes in there, but im pretty sure theres more, what would i put there to make it pull from something like forum id 5 (for example)
Just change it to 5.
// Get latest news announcements
// First validate announcement fids:
$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
if(is_array($announcementsfids))
{
	foreach($announcementsfids as $fid)
	{
		$fid_array[] = intval($fid);
	}
	$announcementsfids = implode(',', $fid_array);
}
// And get them!
$query = $db->simple_select("forums", "*", "fid IN (".$announcementsfids.")");
while($forumrow = $db->fetch_array($query))
{
    $forum[$forumrow['fid']] = $forumrow;
}
so what in that code would i change to 5? I am normally pretty good at figuring it out i am jst kinda lost with all the $ stuff...
Just change any occurrence of $mybb->settings['portal_announcementsfid'] to 5

$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);

to:

$announcementsfids = explode(',', 5);
if($mybb->settings['portal_showwelcome'] != 0)
{
	if($mybb->user['uid'] != 0)
	{
		// Get number of new posts, threads, announcements
		$query = $db->simple_select("posts", "COUNT(pid) AS newposts", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
		$newposts = $db->fetch_field($query, "newposts");
		if($newposts)
		{ 
			// If there aren't any new posts, there is no point in wasting two more queries
			$query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
			$newthreads = $db->fetch_field($query, "newthreads");

			$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']']);
			if(is_array($announcementsfids))
			{
				foreach($announcementsfids as $fid)
				{
					$fid_array[] = intval($fid);	
				}
				
				$announcementsfids = implode(',', $fid_array);
				$query = $db->simple_select("threads", "COUNT(tid) AS newann", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$announcementsfids.") $unviewwhere");
				$newann = $db->fetch_field($query, "newann");
			}

			if(!$newthreads)
			{
				$newthreads = 0;
			}

			if(!$newann)
			{
				$newann = 0;
			}
		}
		else
		{
			$newposts = 0;
			$newthreads = 0;
			$newann = 0;
		}

		// Make the text
		if($newann == 1)
		{
			$lang->new_announcements = $lang->new_announcement;
		}
		else
		{
			$lang->new_announcements = $lang->sprintf($lang->new_announcements, $newann);
		}
		if($newthreads == 1)
		{
			$lang->new_threads = $lang->new_thread;
		}
		else
		{
			$lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
		}
		if($newposts == 1)
		{
			$lang->new_posts = $lang->new_post;
		}
		else
		{
			$lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
		}
		eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");

	}
	else
	{
		$lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register');
		$mybb->user['username'] = $lang->guest;
		eval("\$welcometext = \"".$templates->get("portal_welcome_guesttext")."\";");
	}
	$lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']);
	eval("\$welcome = \"".$templates->get("portal_welcome")."\";");
	if($mybb->user['uid'] == 0)
	{
		$mybb->user['username'] = "";
	}
}

Ok, so now after changing what you said it ADDS that forum (ie it displays normal portal, aswel as forum "5"

The code above is a second point were it has the "$mybb->settings['portal_announcementsfid']']" Specifically:
>user['lastvisit']."' $unviewwhere");
			$newthreads = $db->fetch_field($query, "newthreads");

			$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']']);
			if(is_array($announcementsfids))
			{

When i change this to "5" it then makes the store all white, nothing displaying, do you know why this is?

On a side note, THANK YOU!!!! youve been a mojor help! seriously!

Somehow i got it working!
Im pretty sure by removing the following code...

// If there aren't any new posts, there is no point in wasting two more queries
			$query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
			$newthreads = $db->fetch_field($query, "newthreads");

			$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
			if(is_array($announcementsfids))
			{
				foreach($announcementsfids as $fid)
				{
					$fid_array[] = intval($fid);	
				}
				
				$announcementsfids = implode(',', $fid_array);
				$query = $db->simple_select("threads", "COUNT(tid) AS newann", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$announcementsfids.") $unviewwhere");
				$newann = $db->fetch_field($query, "newann");
			}
You've changed it to $mybb->settings['portal_announcementsfid']'], got an extra '] on the end, I don't know why you're doing that. All you need to do is change this variable to a number... changing it to 5 shouldn't break anything.

What text editor are you using?? Most of them have a search and replace function that will make all the changes instantly.
(2010-11-23, 10:39 AM)MattRogowski Wrote: [ -> ]You've changed it to $mybb->settings['portal_announcementsfid']'], got an extra '] on the end, I don't know why you're doing that. All you need to do is change this variable to a number... changing it to 5 shouldn't break anything.

What text editor are you using?? Most of them have a search and replace function that will make all the changes instantly.

I use notepad. this is my thinking... when i put the forum number in both sections it was trying to pull the same forum 2 times essentially causing an error. When the code was set to "portal_announcementsfid" then it was successfully pulling both fourms. by eliminating the first set it only pulls the second forum... wich is now the only forum it pulls...


idk if im making sense, but it works! and i am very great-full! thank you!
Pages: 1 2