MyBB Community Forums

Full Version: Portal Related Questions!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A few questions:

1) How do i make it so when you go to

http://flamesofsorrow.com

You will be directed to /portal.php (I don't want to change portal.php to index.php and index.php to forum.php, so can someone else tell me a way how to do it?)

2) Is there a way to make a side smaller in width?

EX: http://flamesofsorrow.com/portal.php

On there, I'd like to make the Center a little wider and the sides a little less wider.

Thanks.
1. http://mods.mybboard.net/view/portal-redirect-v110
2. Change the widths of the columns in the portal template.
(2009-04-25, 06:04 PM)MattRogowski Wrote: [ -> ]1. http://mods.mybboard.net/view/portal-redirect-v110
2. Change the widths of the columns in the portal template.

I've seen forums where your taken to portal.php each time you go to the site, not just the first time.

Like here: http://discussadmin.com/
I think you can change the setting of that plugin so it ends up always redirecting you.
I've taken a look at it and it looks like it just sets a cookie after going there once and then checks the cookie again once you refresh and since its already true it doesn't redirect.

I tried to fiddle with the plugin but i didn't get anywhere.

Maybe it would be possible for you to take a crack at it?

<?php
// Portal Redirect Plugin
// By DennisTT - http://www.dennistt.net
// Version 1.1.0

// This plugin (C) DennisTT 2008.  You may not redistribute this plugin without the permission from DennisTT.

if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// The information that shows up on the plugin manager
// Note that the name of the function before _info, _activate, _deactivate must be the same as the filename before the extension.
function portalredirect_info()
{
	global $lang;
	portalredirect_load_language();
	
	return array(
		"name"			=> $lang->portalredirect,
		"description"	=> $lang->portalredirect_desc,
		"website"		=> "http://www.dennistt.net",
		"author"		=> "DennisTT",
		"authorsite"	=> "http://www.dennistt.net",
		"version"		=> "1.1.0",
		"guid"			  => "bc9eeeb7e583a0c77a942beb0f95e9bc",
		"compatibility"   => "14*",
		
		// DennisTT custom info
		"codename" => 'portalredirect',
	);
}

// Helper function to load the language variables
function portalredirect_load_language()
{
	global $lang;
	if(!defined('DENNISTT_PORTALREDIRECT_LANG_LOADED'))
	{
		$lang->load('portalredirect', false, true);
		
		if(!isset($lang->portalredirect))
		{
			$lang->portalredirect = 'Portal Redirect';
			$lang->portalredirect_desc = 'Redirects users from the index page to the portal when they arrive each day. For MyBB 1.4.x.';
			
		}
		
		define('DENNISTT_PORTALREDIRECT_LANG_LOADED', 1);
	}
}

// This function runs when the plugin is activated.
function portalredirect_activate()
{
	global $db;
	
	// Deactivate first to remove any existing settings
	portalredirect_deactivate();
	
	$info = portalredirect_info();
	$setting_group_array = array(
		'name' => str_replace(' ', '_', 'dennistt_'.strtolower($info['codename'])),
		'title' => "$info[name] (DennisTT)",
		'description' => "Settings for the $info[name] plugin",
		'disporder' => 1,
		'isdefault' => 0,
		);
	$db->insert_query('settinggroups', $setting_group_array);
	$group = $db->insert_id();
	
	$settings = array(
		'portalredirect_url' => array('URL', 'The URL to redirect users to', 'text', 'portal.php'),
		'portalredirect_timeout' => array('Timeout', 'Users will every X minutes, where X is specified in this setting.  By default this is 20 hours (1200 minutes)', 'text', '1200'),
		);

	$i = 1;
	foreach($settings as $name => $sinfo)
	{
		$insert_array = array(
			'name' => $name,
			'title' => $sinfo[0],
			'description' => $sinfo[1],
			'optionscode' => $sinfo[2],
			'value' => $sinfo[3],
			'gid' => $group,
			'disporder' => $i,
			'isdefault' => 0
			);
		$db->insert_query("settings", $insert_array);
		$i++;
	}

	rebuild_settings();
}

// This function runs when the plugin is deactivated.
function portalredirect_deactivate()
{
	global $db;
	$info = portalredirect_info();
	$result = $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups WHERE name = '".str_replace(' ', '_', 'dennistt_'.strtolower($info['codename']))."' LIMIT 1");
	$group = $db->fetch_array($result);
	
	if(!empty($group['gid']))
	{
		$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE gid = $group[gid] LIMIT 1");
		$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE gid = $group[gid]");
		rebuildsettings();
	}
}

$plugins->add_hook("index_start", "portalredirect_indexrun");
function portalredirect_indexrun()
{
	global $mybb;
	if ((!isset($_COOKIE['viewedportal']) && !isset($mybb->input['noredirect'])) || isset($mybb->input['forceredirect'])) {
		header('Location: '.$mybb->settings['portalredirect_url']);
		exit;
	}
}

$plugins->add_hook("portal_start", "portalredirect_portalrun");
function portalredirect_portalrun()
{
	global $mybb;
	
	my_setcookie('viewedportal', true, $mybb->settings['portalredirect_timeout']*60);
}

// End of Plugin
?>
Even if you were to change that so the plugin redirects you to the portal each time, you would have to change the links in your header to link to something like index.php?action=forum for the forum index. I could do that later tonight, but I'm not sure what you were trying to avoid, the renaming of index.php or the editing of the header...
(2009-04-25, 09:23 PM)Dennis Tsang Wrote: [ -> ]Even if you were to change that so the plugin redirects you to the portal each time, you would have to change the links in your header to link to something like index.php?action=forum for the forum index. I could do that later tonight, but I'm not sure what you were trying to avoid, the renaming of index.php or the editing of the header...

No need for it, i redirected using .htaccess.