MyBB Community Forums

Full Version: MyBB Guest Home - Show homepage for guest
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(2021-02-10, 10:32 AM)chack1172 Wrote: [ -> ]Oh, I saw now the updated code. It is correct but instead of ['uid'] <= "1" the correct condition is ['uid'] < "1".

This is the original plugin cod, where do I fit in here? and exactly what?

<?php

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

$plugins->add_hook("index_start", "mybbguest_page");

function mybbguest_info()
{
	$codename = str_replace('.php', '', basename(__FILE__));
	
	return array(
		"name"			=> "MyBB Guest Home",
		"description"	=> "Show homepage for guest.",
		"website"		=> "https://sinfulsite.com",
		"author"		=> "YASAKA",
		"authorsite"	=> "https://sinfulsite.com/@YASAKA",
		"version"		=> "1.0",
		"guid" 			=> "",
		"codename"		=> $codename,
		"compatibility" => "18*"
	);
}

function mybbguest_is_installed()
{
	global $mybb;

	if(isset($mybb->settings['mybbguest_onoff']))
	{
	    return true;
	}
	
	return false;
}

function mybbguest_install()
{
	mybbguest_install_settings();
	mybbguest_install_templates();
}

function mybbguest_uninstall()
{
	mybbguest_uninstall_settings();
	mybbguest_uninstall_templates();
}

function mybbguest_install_settings()
{
	global $db;

	$group = array(
        "name" => "mybbguest",
        "title" => "MyBB Guest Home",
        "description" => "Show homepage for guest.",
        "disporder" => 1,
        "isdefault" => 0
    );
    $gid = $db->insert_query("settinggroups", $group);

    $setting = array(
        "sid"            => NULL,
        "name"            => "mybbguest_onoff",
        "title"            => "MyBB Guest Home",
        "description"    => "Enable or disable this plugin.",
        "optionscode"    => "onoff",
        "value"            => "1",
        "disporder"        => 0,
        "gid"            => $gid
    );
    $db->insert_query("settings", $setting);

    rebuild_settings();
}

function mybbguest_uninstall_settings()
{
	global $db;

	$db->delete_query('settings', "name IN ('mybbguest_onoff')");
	$db->delete_query('settinggroups', "name = 'mybbguest'");

	rebuild_settings();
}

function mybbguest_install_templates()
{
	global $db;

	$template = '<html>
<head>
<title>{$mybb->settings[\'bbname\']}</title>
{$headerinclude}
</head>
<body>
{$header}
<div align="center" style="width: 50%; margin: auto;">
	<h1>Welcome to {$mybb->settings[\'bbname\']}</h1>
	<h2>Forum of Cracking</h2>
	<h4>Sinful Site is a forum based on general discussion and sharing of related resources. We encourage creativity, freedom, and above all, individuality. You can also find lots of leaks, tools, software, tutorials, and more. Learn many things here, new friends and have fun with our special features. We will not disappoint you!
If you want to contact us, you can use our contact form.</h4>
	<br>
	<a class="button" href="{$mybb->settings[\'bburl\']}/member.php?action=login" onclick="$(\'#quick_login\').modal({ fadeDuration: 250, keepelement: true, zIndex: (typeof modal_zindex !== \'undefined\' ? modal_zindex : 9999) }); return false;" style="margin-right:10px">Login</a>
	<a href="{$mybb->settings[\'bburl\']}/member.php?action=register" class="button">Register</a>
</div>
{$footer}
</body>
</html>';
	$insert_array = array(
	    'title' => 'index_guest',
	    'template' => $db->escape_string($template),
	    'sid' => '-1',
	    'version' => '',
	    'dateline' => time()
	);
	$db->insert_query('templates', $insert_array);
}

function mybbguest_uninstall_templates()
{
	global $db;

	$db->delete_query("templates", "title = 'index_guest'");
}

function mybbguest_page()
{
	global $mybb, $db, $templates, $lang, $header, $headerinclude, $footer, $theme;

	$uid = $mybb->user['uid'];

	if($mybb->settings['mybbguest_onoff'] == "1" && $uid <= "1")
	{
		eval('$index = "'.$templates->get('index_guest').'";');
		output_page($index);
		die();
	}
}


(2021-02-10, 10:48 AM)MyBBEinstein Wrote: [ -> ]
(2021-02-10, 10:32 AM)chack1172 Wrote: [ -> ]Oh, I saw now the updated code. It is correct but instead of ['uid'] <= "1" the correct condition is ['uid'] < "1".

This is the original plugin cod, where do I fit in here? and exactly what?

<?php

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

$plugins->add_hook("index_start", "mybbguest_page");

function mybbguest_info()
{
	$codename = str_replace('.php', '', basename(__FILE__));
	
	return array(
		"name"			=> "MyBB Guest Home",
		"description"	=> "Show homepage for guest.",
		"website"		=> "https://sinfulsite.com",
		"author"		=> "YASAKA",
		"authorsite"	=> "https://sinfulsite.com/@YASAKA",
		"version"		=> "1.0",
		"guid" 			=> "",
		"codename"		=> $codename,
		"compatibility" => "18*"
	);
}

function mybbguest_is_installed()
{
	global $mybb;

	if(isset($mybb->settings['mybbguest_onoff']))
	{
	    return true;
	}
	
	return false;
}

function mybbguest_install()
{
	mybbguest_install_settings();
	mybbguest_install_templates();
}

function mybbguest_uninstall()
{
	mybbguest_uninstall_settings();
	mybbguest_uninstall_templates();
}

function mybbguest_install_settings()
{
	global $db;

	$group = array(
        "name" => "mybbguest",
        "title" => "MyBB Guest Home",
        "description" => "Show homepage for guest.",
        "disporder" => 1,
        "isdefault" => 0
    );
    $gid = $db->insert_query("settinggroups", $group);

    $setting = array(
        "sid"            => NULL,
        "name"            => "mybbguest_onoff",
        "title"            => "MyBB Guest Home",
        "description"    => "Enable or disable this plugin.",
        "optionscode"    => "onoff",
        "value"            => "1",
        "disporder"        => 0,
        "gid"            => $gid
    );
    $db->insert_query("settings", $setting);

    rebuild_settings();
}

function mybbguest_uninstall_settings()
{
	global $db;

	$db->delete_query('settings', "name IN ('mybbguest_onoff')");
	$db->delete_query('settinggroups', "name = 'mybbguest'");

	rebuild_settings();
}

function mybbguest_install_templates()
{
	global $db;

	$template = '<html>
<head>
<title>{$mybb->settings[\'bbname\']}</title>
{$headerinclude}
</head>
<body>
{$header}
<div align="center" style="width: 50%; margin: auto;">
	<h1>Welcome to {$mybb->settings[\'bbname\']}</h1>
	<h2>Forum of Cracking</h2>
	<h4>Sinful Site is a forum based on general discussion and sharing of related resources. We encourage creativity, freedom, and above all, individuality. You can also find lots of leaks, tools, software, tutorials, and more. Learn many things here, new friends and have fun with our special features. We will not disappoint you!
If you want to contact us, you can use our contact form.</h4>
	<br>
	<a class="button" href="{$mybb->settings[\'bburl\']}/member.php?action=login" onclick="$(\'#quick_login\').modal({ fadeDuration: 250, keepelement: true, zIndex: (typeof modal_zindex !== \'undefined\' ? modal_zindex : 9999) }); return false;" style="margin-right:10px">Login</a>
	<a href="{$mybb->settings[\'bburl\']}/member.php?action=register" class="button">Register</a>
</div>
{$footer}
</body>
</html>';
	$insert_array = array(
	    'title' => 'index_guest',
	    'template' => $db->escape_string($template),
	    'sid' => '-1',
	    'version' => '',
	    'dateline' => time()
	);
	$db->insert_query('templates', $insert_array);
}

function mybbguest_uninstall_templates()
{
	global $db;

	$db->delete_query("templates", "title = 'index_guest'");
}

function mybbguest_page()
{
	global $mybb, $db, $templates, $lang, $header, $headerinclude, $footer, $theme;

	$uid = $mybb->user['uid'];

	if($mybb->settings['mybbguest_onoff'] == "1" && $uid <= "1")
	{
		eval('$index = "'.$templates->get('index_guest').'";');
		output_page($index);
		die();
	}
}




If I am understanding what you are asking perhaps this is what you were misunderstanding and asking in regards to what he was saying?

this:
	if($mybb->settings['mybbguest_onoff'] == "1" && $uid <= "1")

to this:
	if($mybb->settings['mybbguest_onoff'] == "1" && $uid < "1")

ie:
<?php

// Make sure we can't access this file directly from the browser.
if(!defined('IN_MYBB'))
{
	die('This file cannot be accessed directly.');
}

$plugins->add_hook("index_start", "mybbguest_page");

function mybbguest_info()
{
	$codename = str_replace('.php', '', basename(__FILE__));
	
	return array(
		"name"			=> "MyBB Guest Home",
		"description"	=> "Show homepage for guest.",
		"website"		=> "https://sinfulsite.com",
		"author"		=> "YASAKA",
		"authorsite"	=> "https://sinfulsite.com/@YASAKA",
		"version"		=> "1.0",
		"guid" 			=> "",
		"codename"		=> $codename,
		"compatibility" => "18*"
	);
}

function mybbguest_is_installed()
{
	global $mybb;

	if(isset($mybb->settings['mybbguest_onoff']))
	{
	    return true;
	}
	
	return false;
}

function mybbguest_install()
{
	mybbguest_install_settings();
	mybbguest_install_templates();
}

function mybbguest_uninstall()
{
	mybbguest_uninstall_settings();
	mybbguest_uninstall_templates();
}

function mybbguest_install_settings()
{
	global $db;

	$group = array(
        "name" => "mybbguest",
        "title" => "MyBB Guest Home",
        "description" => "Show homepage for guest.",
        "disporder" => 1,
        "isdefault" => 0
    );
    $gid = $db->insert_query("settinggroups", $group);

    $setting = array(
        "sid"            => 0,
        "name"            => "mybbguest_onoff",
        "title"            => "MyBB Guest Home",
        "description"    => "Enable or disable this plugin.",
        "optionscode"    => "onoff",
        "value"            => "1",
        "disporder"        => 0,
        "gid"            => $gid
    );
    $db->insert_query("settings", $setting);

    rebuild_settings();
}

function mybbguest_uninstall_settings()
{
	global $db;

	$db->delete_query('settings', "name IN ('mybbguest_onoff')");
	$db->delete_query('settinggroups', "name = 'mybbguest'");

	rebuild_settings();
}

function mybbguest_install_templates()
{
	global $db;

	$template = '<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->welcome_guest}</title>
{$headerinclude}
</head>
<body>
{$header}
<div align="center" style="width: 50%; margin: auto;">
	<h1>Welcome to {$mybb->settings[\'bbname\']}</h1>
	<h2>Forum of Cracking</h2>
	<h4>Sinful Site is a forum based on general discussion and sharing of related resources. We encourage creativity, freedom, and above all, individuality. You can also find lots of leaks, tools, software, tutorials, and more. Learn many things here, new friends and have fun with our special features. We will not disappoint you!
If you want to contact us, you can use our contact form.</h4>
	<br>
	<a class="button" href="{$mybb->settings[\'bburl\']}/member.php?action=login" onclick="$(\'#quick_login\').modal({ fadeDuration: 250, keepelement: true, zIndex: (typeof modal_zindex !== \'undefined\' ? modal_zindex : 9999) }); return false;" style="margin-right:10px">{$lang->welcome_login}</a>
	<a href="{$mybb->settings[\'bburl\']}/member.php?action=register" class="button">{$lang->welcome_register}</a>
</div>
{$footer}
</body>
</html>';

	$insert_array = array(
	    'title' => 'index_guest',
	    'template' => $db->escape_string($template),
	    'sid' => '-1',
	    'version' => '',
	    'dateline' => time()
	);

	$db->insert_query('templates', $insert_array);
}

function mybbguest_uninstall_templates()
{
	global $db;

	$db->delete_query("templates", "title = 'index_guest'");
}

function mybbguest_page()
{
	global $mybb, $db, $templates, $lang, $header, $headerinclude, $footer, $theme;

	$uid = $mybb->user['uid'];

	if($mybb->settings['mybbguest_onoff'] == "1" && $uid < "1")
	{
		eval('$index = "'.$templates->get('index_guest').'";');
		output_page($index);
		die();
	}
}

[Image: Forums-5.png]

[Image: Plugins.png]

[Image: Board-Settings-My-BB-Guest-Home.png]
(2021-02-10, 11:17 AM)censor_deeznutz Wrote: [ -> ]
(2021-02-10, 10:48 AM)MyBBEinstein Wrote: [ -> ]
(2021-02-10, 10:32 AM)chack1172 Wrote: [ -> ]Oh, I saw now the updated code. It is correct but instead of ['uid'] <= "1" the correct condition is ['uid'] < "1".

This is the original plugin cod, where do I fit in here? and exactly what?

<?php

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

$plugins->add_hook("index_start", "mybbguest_page");

function mybbguest_info()
{
	$codename = str_replace('.php', '', basename(__FILE__));
	
	return array(
		"name"			=> "MyBB Guest Home",
		"description"	=> "Show homepage for guest.",
		"website"		=> "https://sinfulsite.com",
		"author"		=> "YASAKA",
		"authorsite"	=> "https://sinfulsite.com/@YASAKA",
		"version"		=> "1.0",
		"guid" 			=> "",
		"codename"		=> $codename,
		"compatibility" => "18*"
	);
}

function mybbguest_is_installed()
{
	global $mybb;

	if(isset($mybb->settings['mybbguest_onoff']))
	{
	    return true;
	}
	
	return false;
}

function mybbguest_install()
{
	mybbguest_install_settings();
	mybbguest_install_templates();
}

function mybbguest_uninstall()
{
	mybbguest_uninstall_settings();
	mybbguest_uninstall_templates();
}

function mybbguest_install_settings()
{
	global $db;

	$group = array(
        "name" => "mybbguest",
        "title" => "MyBB Guest Home",
        "description" => "Show homepage for guest.",
        "disporder" => 1,
        "isdefault" => 0
    );
    $gid = $db->insert_query("settinggroups", $group);

    $setting = array(
        "sid"            => NULL,
        "name"            => "mybbguest_onoff",
        "title"            => "MyBB Guest Home",
        "description"    => "Enable or disable this plugin.",
        "optionscode"    => "onoff",
        "value"            => "1",
        "disporder"        => 0,
        "gid"            => $gid
    );
    $db->insert_query("settings", $setting);

    rebuild_settings();
}

function mybbguest_uninstall_settings()
{
	global $db;

	$db->delete_query('settings', "name IN ('mybbguest_onoff')");
	$db->delete_query('settinggroups', "name = 'mybbguest'");

	rebuild_settings();
}

function mybbguest_install_templates()
{
	global $db;

	$template = '<html>
<head>
<title>{$mybb->settings[\'bbname\']}</title>
{$headerinclude}
</head>
<body>
{$header}
<div align="center" style="width: 50%; margin: auto;">
	<h1>Welcome to {$mybb->settings[\'bbname\']}</h1>
	<h2>Forum of Cracking</h2>
	<h4>Sinful Site is a forum based on general discussion and sharing of related resources. We encourage creativity, freedom, and above all, individuality. You can also find lots of leaks, tools, software, tutorials, and more. Learn many things here, new friends and have fun with our special features. We will not disappoint you!
If you want to contact us, you can use our contact form.</h4>
	<br>
	<a class="button" href="{$mybb->settings[\'bburl\']}/member.php?action=login" onclick="$(\'#quick_login\').modal({ fadeDuration: 250, keepelement: true, zIndex: (typeof modal_zindex !== \'undefined\' ? modal_zindex : 9999) }); return false;" style="margin-right:10px">Login</a>
	<a href="{$mybb->settings[\'bburl\']}/member.php?action=register" class="button">Register</a>
</div>
{$footer}
</body>
</html>';
	$insert_array = array(
	    'title' => 'index_guest',
	    'template' => $db->escape_string($template),
	    'sid' => '-1',
	    'version' => '',
	    'dateline' => time()
	);
	$db->insert_query('templates', $insert_array);
}

function mybbguest_uninstall_templates()
{
	global $db;

	$db->delete_query("templates", "title = 'index_guest'");
}

function mybbguest_page()
{
	global $mybb, $db, $templates, $lang, $header, $headerinclude, $footer, $theme;

	$uid = $mybb->user['uid'];

	if($mybb->settings['mybbguest_onoff'] == "1" && $uid <= "1")
	{
		eval('$index = "'.$templates->get('index_guest').'";');
		output_page($index);
		die();
	}
}




If I am unerstanding what you are asking perhaps this is what you were misunderstanding and asking in regards to what he was saying?

this:
	if($mybb->settings['mybbguest_onoff'] == "1" && $uid <= "1")

to this:
	if($mybb->settings['mybbguest_onoff'] == "1" && $uid < "1")
[/code]

ie:
<?php

// Make sure we can't access this file directly from the browser.
if(!defined('IN_MYBB'))
{
	die('This file cannot be accessed directly.');
}

$plugins->add_hook("index_start", "mybbguest_page");

function mybbguest_info()
{
	$codename = str_replace('.php', '', basename(__FILE__));
	
	return array(
		"name"			=> "MyBB Guest Home",
		"description"	=> "Show homepage for guest.",
		"website"		=> "https://sinfulsite.com",
		"author"		=> "YASAKA",
		"authorsite"	=> "https://sinfulsite.com/@YASAKA",
		"version"		=> "1.0",
		"guid" 			=> "",
		"codename"		=> $codename,
		"compatibility" => "18*"
	);
}

function mybbguest_is_installed()
{
	global $mybb;

	if(isset($mybb->settings['mybbguest_onoff']))
	{
	    return true;
	}
	
	return false;
}

function mybbguest_install()
{
	mybbguest_install_settings();
	mybbguest_install_templates();
}

function mybbguest_uninstall()
{
	mybbguest_uninstall_settings();
	mybbguest_uninstall_templates();
}

function mybbguest_install_settings()
{
	global $db;

	$group = array(
        "name" => "mybbguest",
        "title" => "MyBB Guest Home",
        "description" => "Show homepage for guest.",
        "disporder" => 1,
        "isdefault" => 0
    );
    $gid = $db->insert_query("settinggroups", $group);

    $setting = array(
        "sid"            => 0,
        "name"            => "mybbguest_onoff",
        "title"            => "MyBB Guest Home",
        "description"    => "Enable or disable this plugin.",
        "optionscode"    => "onoff",
        "value"            => "1",
        "disporder"        => 0,
        "gid"            => $gid
    );
    $db->insert_query("settings", $setting);

    rebuild_settings();
}

function mybbguest_uninstall_settings()
{
	global $db;

	$db->delete_query('settings', "name IN ('mybbguest_onoff')");
	$db->delete_query('settinggroups', "name = 'mybbguest'");

	rebuild_settings();
}

function mybbguest_install_templates()
{
	global $db;

	$template = '<html>
<head>
<title>{$mybb->settings[\'bbname\']}</title>
{$headerinclude}
</head>
<body>
{$header}
<div align="center" style="width: 50%; margin: auto;">
	<h1>Welcome to {$mybb->settings[\'bbname\']}</h1>
	<h2>Forum of Cracking</h2>
	<h4>Sinful Site is a forum based on general discussion and sharing of related resources. We encourage creativity, freedom, and above all, individuality. You can also find lots of leaks, tools, software, tutorials, and more. Learn many things here, new friends and have fun with our special features. We will not disappoint you!
If you want to contact us, you can use our contact form.</h4>
	<br>
	<a class="button" href="{$mybb->settings[\'bburl\']}/member.php?action=login" onclick="$(\'#quick_login\').modal({ fadeDuration: 250, keepelement: true, zIndex: (typeof modal_zindex !== \'undefined\' ? modal_zindex : 9999) }); return false;" style="margin-right:10px">{$lang->welcome_login}</a>
	<a href="{$mybb->settings[\'bburl\']}/member.php?action=register" class="button">{$lang->welcome_register}</a>
</div>
{$footer}
</body>
</html>';

	$insert_array = array(
	    'title' => 'index_guest',
	    'template' => $db->escape_string($template),
	    'sid' => '-1',
	    'version' => '',
	    'dateline' => time()
	);

	$db->insert_query('templates', $insert_array);
}

function mybbguest_uninstall_templates()
{
	global $db;

	$db->delete_query("templates", "title = 'index_guest'");
}

function mybbguest_page()
{
	global $mybb, $db, $templates, $lang, $header, $headerinclude, $footer, $theme;

	$uid = $mybb->user['uid'];

	if($mybb->settings['mybbguest_onoff'] == "1" && $uid < "1")
	{
		eval('$index = "'.$templates->get('index_guest').'";');
		output_page($index);
		die();
	}
}


yes i did that but then this window comes in when i want to go to the plugin in ACP!

what is causing this can it be repaired?
Are you sure about that?
The hook is added to index_start so it will only be displayed on index not ACP.
(2021-02-10, 11:38 AM)chack1172 Wrote: [ -> ]Are you sure about that?
The hook is added to index_start so it will only be displayed on index not ACP.

i changed the plugin .php so emi was installed and when i want to go to the plugin installation this message comes in i can't go to the plugin installation


ACP - Configuration - Plugins

and all plugins disappear, nothing to see

[Image: ysMHzzW.png]
I'm idex_guest cod
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}
<div align="center" style="width: 50%; margin: auto;">
	<h1>Welcome to Torrent-invites.org Forum</h1>
	<h2><u>Read it carefully</u></h2>
	<h4>1: This is a private torrent forum, not public and never will be!
<br>2: We want everyone who visits here to understand this!
<br>3: If you want to be a member of one of the best tracker forums, all you have to do is register
<br>4: Until then you can't see the forum from the inside, nor the chatbox!</h4>
	<br>
	<a class="button" href="{$mybb->settings['bburl']}/member.php?action=login" onclick="$('#quick_login').modal({ fadeDuration: 250, keepelement: true, zIndex: (typeof modal_zindex !== 'undefined' ? modal_zindex : 9999) }); return false;" style="margin-right:10px">Login</a>
	<a href="{$mybb->settings['bburl']}/member.php?action=register" class="button">Register</a>
</div>
{$footer}
</body>
</html>
There is nothing wrong in the screen. This is how the plugin page is displayed.
If you see nothing below that it means there is some error in the plugin file.
Can you post the updated version here?
(2021-02-10, 11:53 AM)chack1172 Wrote: [ -> ]There is nothing wrong in the screen. This is how the plugin page is displayed.
If you see nothing below that it means there is some error in the plugin file.
Can you post the updated version here?


yes, please send me here updated version
How can I send the edit you did? You need to send me the updated version that is not working to you.
(2021-02-10, 12:08 PM)chack1172 Wrote: [ -> ]How can I send the edit you did? You need to send me the updated version that is not working to you.


ok 

it does not work


<?php

// Make sure we can't access this file directly from the browser.
if(!defined('IN_MYBB'))
{
	die('This file cannot be accessed directly.');
}

$plugins->add_hook("index_start", "mybbguest_page");

function mybbguest_info()
{
	$codename = str_replace('.php', '', basename(__FILE__));
	
	return array(
		"name"			=> "MyBB Guest Home",
		"description"	=> "Show homepage for guest.",
		"website"		=> "https://sinfulsite.com",
		"author"		=> "YASAKA",
		"authorsite"	=> "https://sinfulsite.com/@YASAKA",
		"version"		=> "1.0",
		"guid" 			=> "",
		"codename"		=> $codename,
		"compatibility" => "18*"
	);
}

function mybbguest_is_installed()
{
	global $mybb;

	if(isset($mybb->settings['mybbguest_onoff']))
	{
	    return true;
	}
	
	return false;
}

function mybbguest_install()
{
	mybbguest_install_settings();
	mybbguest_install_templates();
}

function mybbguest_uninstall()
{
	mybbguest_uninstall_settings();
	mybbguest_uninstall_templates();
}

function mybbguest_install_settings()
{
	global $db;

	$group = array(
        "name" => "mybbguest",
        "title" => "MyBB Guest Home",
        "description" => "Show homepage for guest.",
        "disporder" => 1,
        "isdefault" => 0
    );
    $gid = $db->insert_query("settinggroups", $group);

    $setting = array(
        "sid"            => 0,
        "name"            => "mybbguest_onoff",
        "title"            => "MyBB Guest Home",
        "description"    => "Enable or disable this plugin.",
        "optionscode"    => "onoff",
        "value"            => "1",
        "disporder"        => 0,
        "gid"            => $gid
    );
    $db->insert_query("settings", $setting);

    rebuild_settings();
}

function mybbguest_uninstall_settings()
{
	global $db;

	$db->delete_query('settings', "name IN ('mybbguest_onoff')");
	$db->delete_query('settinggroups', "name = 'mybbguest'");

	rebuild_settings();
}

function mybbguest_install_templates()
{
	global $db;

	$template = '<html>
<head>
<title>{$mybb->settings[\'bbname\']}</title>
{$headerinclude}
</head>
<body>
{$header}
<div align="center" style="width: 50%; margin: auto;">
	<h1>Welcome to {$mybb->settings[\'bbname\']}</h1>
	<h2>Forum of Cracking</h2>
	<h4>Sinful Site is a forum based on general discussion and sharing of related resources. We encourage creativity, freedom, and above all, individuality. You can also find lots of leaks, tools, software, tutorials, and more. Learn many things here, new friends and have fun with our special features. We will not disappoint you!
If you want to contact us, you can use our contact form.</h4>
	<br>
	<a class="button" href="{$mybb->settings[\'bburl\']}/member.php?action=login" onclick="$(\'#quick_login\').modal({ fadeDuration: 250, keepelement: true, zIndex: (typeof modal_zindex !== \'undefined\' ? modal_zindex : 9999) }); return false;" style="margin-right:10px">{$lang->welcome_login}</a>
	<a href="{$mybb->settings[\'bburl\']}/member.php?action=register" class="button">{$lang->welcome_register}</a>
</div>
{$footer}
</body>
</html>';

	$insert_array = array(
	    'title' => 'index_guest',
	    'template' => $db->escape_string($template),
	    'sid' => '-1',
	    'version' => '',
	    'dateline' => time()
	);

	$db->insert_query('templates', $insert_array);
}

function mybbguest_uninstall_templates()
{
	global $db;

	$db->delete_query("templates", "title = 'index_guest'");
}

function mybbguest_page()
{
	global $mybb, $db, $templates, $lang, $header, $headerinclude, $footer, $theme;

	$uid = $mybb->user['uid'];

	if($mybb->settings['mybbguest_onoff'] == "1" && $uid < "1")
	{
		eval('$index = "'.$templates->get('index_guest').'";');
		output_page($index);
		die();
	}
}

Ok now good , thanks for help !

very good now !
(2021-02-10, 12:10 PM)MyBBEinstein Wrote: [ -> ]Ok now good , thanks for help !

very good now !

Cool beans & no worries...

Oh, also adding these hooks might be wise.... *

After:
$plugins->add_hook("index_start", "mybbguest_page");

Adding:
$plugins->add_hook("portal_start", "mybbguest_page");

$plugins->add_hook("showteam_start", "mybbguest_page");
$plugins->add_hook("misc_start", "mybbguest_page");
$plugins->add_hook("memberlist_start", "mybbguest_page");
$plugins->add_hook("calendar_start", "mybbguest_page");
$plugins->add_hook("search_start", "mybbguest_page");


* Because while yes the index works it leaves the other sections open to the guest ie: portal, memberlist, help, search, calendar, showteam, misc, etc, etc, thus negating the entire point of the plugin from the onset in a sense and in theory simply adding the hooks corrects that as is simply by adding those hooks..., and we can ignore hooking contact us because well the guest should still be able to use/see that form....

but while adding these hooks achieves as is the goal there is one loophole...., the quicksearch, so while the guest is receiving this page on all the hooks if the user searches through quicksearch, some access to the forum will happen if Can search forums? is checked in Home » User Groups » Edit User Group » Guests » Forums and Posts » Viewing Options

so for Home » User Groups » Edit User Group » Guests

Forums and Posts » Viewing Options

uncheck:
Quote:Can search forums?

will eliminate that minor loophole.....


anyhoo, also one more hook to consider:

$plugins->add_hook("archive_start", "mybbguest_page");

though that particular one may have to be thought on a lil diff for template/styling considerations....
Pages: 1 2 3