<?php
/**
 * @package     VP Advanced User
 * @subpackage  Module - VP Advanced User
 * @author      Abhishek Das <info@virtueplanet.com>
 * @copyright   Copyright (C) 2012-2019 VirtuePlanet Services LLP. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @link        https://www.virtueplanet.com
 */

defined('_JEXEC') or die;

// VP Advanced User Component's defination file
$define_file = JPATH_SITE . '/components/com_vpadvanceduser/define.php';

if(is_file($define_file))
{
	require_once $define_file;
}

if(!defined('JPATH_ADVANCEDUSER_ADMIN'))
{
	// VP Advanced User Component not found
	return;
}

// Include module variables
require(__DIR__ . '/variables.php');


// Prepare component's registration form for the module
if(in_array($display, array(2, 3)))
{
	$regForm = ModVPAdvancedUserHelper::prepareForm($regForm, $form_id_prefix);
}

// Prepare component's login form for the module
$loginForm = ModVPAdvancedUserHelper::prepareForm($loginForm, $form_id_prefix);

// Logged users must load the logout sublayout
if (!$user->guest)
{
	$layout .= '_logout';
}

if(!in_array($display, array(2, 3)) && $reg_inprocess)
{
	// If registration in process and only display login form selected
	return '';
}

require JModuleHelper::getLayoutPath('mod_vpadvanceduser', $layout);