Hello.
I using joomla 1.7.1 , cb 1.7 and JFBConnect 4.0.1
And when im trying to login with JFBCLogin module i get this message :
Please complete the username and password fields.
Can someone help me?
helper.php
Code:
<?php
/**
* @package JFBConnect
* @copyright (C) 2009-2011 by Source Coast - All rights reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
class modJFBCLoginHelper
{
function getType()
{
$user = & JFactory::getUser();
return (!$user->get('guest')) ? 'logout' : 'login';
}
function getLoginRedirect($params, $loginType)
{
if (JRequest::getString('return'))
return JRequest::getString('return');
$url = '';
if (($loginType == 'jlogin' && $params->get('jlogin_redirect')))
{
$itemId = $params->get($loginType);
if ($itemId)
{
$app = JFactory::getApplication();
$router = $app->getRouter();
$db = JFactory::getDbo();
//Derived from mod_login Joomla 1.6, but modified to be backwards compatible
$query = "SELECT link FROM #__menu WHERE published=1 AND id=".$db->quote($itemId);
$db->setQuery($query);
if ($link = $db->loadResult())
{
if ($router->getMode() == JROUTER_MODE_SEF)
{
$url = 'index.php?Itemid=' . $itemId;
}
else
{
$url = $link . '&Itemid=' . $itemId;
}
}
}
}
if (!$url)
{
$uri = & JURI::getInstance();
$url = $uri->toString(array('path', 'query'));
}
return base64_encode($url);
}
}
mod_jfbclogin.php
Code:
<?php
/**
* @package JFBConnect
* @copyright (C) 2009-2011 by Source Coast - All rights reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.filesystem.file');
$jfbcLibraryFile = JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'libraries'.DS.'facebook.php';
if (!JFile::exists($jfbcLibraryFile)) {
echo "JFBConnect not found. Please reinstall.";
return;
}
require_once(dirname(__FILE__).DS.'helper.php');
require_once ($jfbcLibraryFile);
$fbClient = JFBConnectFacebookLibrary::getInstance();
$formType = modJFBCLoginHelper::getType();
$fbUserId = $fbClient->getUserId(TRUE);
$user =& JFactory::getUser();
$jLoginUrl = modJFBCLoginHelper::getLoginRedirect($params, 'jlogin');
$registerType = $params->get('register_type');
if ($registerType == "jomsocial")
{
$jspath = JPATH_BASE.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
$registerLink = CRoute::_( 'index.php?option=com_community&view=register');
}
else if ($registerType == "communitybuilder")
{
$registerLink = JRoute::_("index.php?option=com_comprofiler&task=registers", false);
$forgotLink = JRoute::_("index.php?option=com_comprofiler&task=lostPassword");
}
else if ($registerType == "virtuemart" && file_exists(JPATH_SITE.DS.'components'.DS.'com_virtuemart'.DS.'virtuemart_parser.php'))
{
require_once (JPATH_SITE.DS.'components'.DS.'com_virtuemart'.DS.'virtuemart_parser.php');
global $sess;
$registerLink = $sess->url( SECUREURL.'index.php?option=com_virtuemart&page=shop.registration' );
}
else
{
$registerLink = '';
//SC15
$registerLink = JRoute::_('index.php?option=com_users&view=registration', false);
//SC16
#echo $registerLink;
}
// common for J!, JomSocial, and Virtuemart
$forgotUsernameLink = '';
$forgotPasswordLink = '';
//SC15
$forgotUsernameLink = JRoute::_('index.php?option=com_users&view=remind', false);
$forgotPasswordLink = JRoute::_('index.php?option=com_users&view=reset', false);
//SC16
require(JModuleHelper::getLayoutPath('mod_jfbclogin'));
?>
defoult.php
Code:
<?php
/**
* @package JFBConnect
* @copyright (C) 2009-2011 by Source Coast - All rights reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
$userIntro = $params->get('user_intro');
if ($userIntro != '')
{
echo '<div class="jfbclogin_desc">' . $userIntro . "</div>";
}
if ($formType == "login")
{
if ($params->get('showLoginForm'))
{
//SC15
$passwordName = 'password';
//SC16
?>
<form action="<?php echo JRoute::_('index.php', true, $params->get('usesecure')); ?>" method="post" id="login-form">
<fieldset class="input">
<div id="form-login-username">
<label for="modlgn_username"><?php echo JText::_('MOD_JFBCLOGIN_USERNAME') ?></label><br/>
<input id="modlgn_username" type="text" name="username" class="inputbox" alt="username" size="18"/>
</div>
<div id="form-login-password">
<label for="modlgn_passwd"><?php echo JText::_('MOD_JFBCLOGIN_PASSWORD') ?></label><br/>
<input id="modlgn_passwd" type="password" name="<?php echo $passwordName; ?>" class="inputbox" size="18"
alt="password"/>
</div>
<?php if (JPluginHelper::isEnabled('system', 'remember'))
{
?>
<p id="form-login-remember">
<label for="modlgn_remember">
<?php
//SC15
echo JText::_('JGLOBAL_REMEMBER_ME');
//SC16
?>
</label>
<input id="modlgn_remember" type="checkbox" name="remember" class="inputbox" value="yes"
alt="Remember Me"/>
</p>
<?php } ?>
<input type="submit" name="Submit" class="button" value="<?php echo JText::_('MOD_JFBCLOGIN_LOGIN') ?>"/>
</fieldset>
<?php if ($registerType != "communitybuilder")
{
//SC15
echo '<input type="hidden" name="option" value="com_users"/>';
echo '<input type="hidden" name="task" value="user.login"/>';
//SC16
echo '<input type="hidden" name="return" value="'.$jLoginUrl.'"/>';
}
else // Use Community Builder's login
{
include_once(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php');
global $_CB_framework;
echo '<input type="hidden" name="option" value="com_comprofiler" />' . "\n";
echo '<input type="hidden" name="task" value="login" />' . "\n";
echo '<input type="hidden" name="op2" value="login" />' . "\n";
echo '<input type="hidden" name="lang" value="' . $_CB_framework->getCfg('lang') . '" />' . "\n";
echo '<input type="hidden" name="force_session" value="1" />' . "\n"; // makes sure to create joomla 1.0.11+12 session/bugfix
echo '<input type="hidden" name="return" value="B:'.$jLoginUrl.'"/>';
echo cbGetSpoofInputTag('login');
}
?>
<?php echo JHTML::_('form.token'); ?>
</form>
<?php
}
$buttonSize = $params->get('loginButtonSize');
echo $fbClient->getLoginButton($buttonSize); ?>
<ul>
<?php
$usersConfig = &JComponentHelper::getParams('com_users');
if ($params->get('showRegisterLink'))
{
?>
<li>
<a href="<?php echo $registerLink ?>">
<?php echo JText::_('MOD_JFBCLOGIN_REGISTER_FOR_THIS_SITE'); ?></a>
</li>
<?php
}
if ($params->get('register_type') == "communitybuilder" && ($params->get('showForgotUsername') || $params->get('showForgotPassword')))
{
?>
<li>
<a href="<?php echo $forgotLink ?>">
<?php echo JText::_('MOD_JFBCLOGIN_FORGOT_LOGIN'); ?></a>
</li>
<?php
}
else
{
if ($params->get('showForgotUsername'))
{
?>
<li>
<a href="<?php echo $forgotUsernameLink ?>">
<?php echo JText::_('MOD_JFBCLOGIN_FORGOT_USERNAME'); ?></a>
</li>
<?php
}
if ($params->get('showForgotPassword'))
{
?>
<li>
<a href="<?php echo $forgotPasswordLink ?>">
<?php echo JText::_('MOD_JFBCLOGIN_FORGOT_PASSWORD'); ?></a>
</li>
<?php
}
}
?>
</ul>
<?php
} ###################### end login form #####################################
else
{ # show logout
?>
<?php
# Show their FB avatar (if desired), or give them the option to link accounts
if ($fbUserId)
{
if ($params->get("enableProfilePic"))
{
$picHeightParam = $params->get("profileHeight");
$picWidthParam = $params->get("profileWidth");
$picHeight = $picHeightParam != "" ? 'height="' . $picHeightParam . 'px"' : "";
$picWidth = $picWidthParam != "" ? 'width="' . $picWidthParam . 'px"' : "";
$linked = ($params->get("linkProfile") == 1) ? "true" : "false";
$fbLogo = ($params->get("facebookLogo") == 1) ? "true" : "false";
$fbUid = $fbUserId;
?>
<div id="profile-pic">
<fb:profile-pic uid="<?php echo $fbUid; ?>"
size="<?php echo $params->get('picQuality'); ?>"
<?php echo $picHeight; ?>
<?php echo $picWidth; ?>
linked="<?php echo $linked; ?>"
facebook-logo="<?php echo $fbLogo; ?>"
/>
</div>
<?php
}
}
?>
<div>
<?php
$showGreeting = $params->get('showGreeting');
$greetingName = $params->get('greetingName');
if ($showGreeting)
{
if ($greetingName == 0) //Username
$name = $user->get('username');
else
$name = $user->get('name');
echo JText::sprintf('MOD_JFBCLOGIN_WELCOME', $name);
}
?>
</div>
<?php
$showLogoutButton = $params->get('showLogoutButton');
if ($showLogoutButton)
{
echo $fbClient->getLogoutButton();
}
?>
<?php
if (!$fbUserId) # show facebook connect button to join accounts
{
$mappedUserId = $fbClient->getFacebookMappedId();
$fbId = $fbClient->getUserId(FALSE);
if (!$mappedUserId)
{
?>
<div class="fb_connect_user"><?php echo JText::_('MOD_JFBCLOGIN_CONNECT_USER'); ?></div>
<fb:login-button v="2"
onlogin="javascript:jfbc.login.login_button_click();"><?php echo JText::_('MOD_JFBCLOGIN_MAP_BUTTON'); ?></fb:login-button>
<?php
}
else if ($params->get('allowReconnections') && $mappedUserId != $fbId)
{
?>
<div class="fb_connect_user"><?php echo JText::_('MOD_JFBCLOGIN_RECONNECT_USER'); ?></div>
<fb:login-button v="2"
onlogin="javascript:jfbc.login.login_button_click();"><?php echo JText::_('MOD_JFBCLOGIN_REMAP_BUTTON'); ?></fb:login-button>
<?php
}
}
?>
<?php
} # end logout
//Powered By Link
$link = 'http://www.sourcecoast.com/jfbconnect/';
$affiliateID = $params->get('affiliateID');
if ($affiliateID)
$link .= '?amigosid=' . $affiliateID;
if ($params->get('showPoweredByLink'))
{
?>
<div class="powered_by">Powered By <a target="_blank" href="<?php echo $link; ?>"
title="Facebook for Joomla">JFBConnect</a></div>
<?php } ?>