× Joomla Facebook Connect support forum

Topic-icon Just the Facebook part from JFBConnect Login Module

Active Subscriptions:

None
I have been editing and playing with the jfbconnect module to only get the facebook button for users to log in, i do not need the login fields, i have searched the entire forum by searching for "login" and in all 25 pages nothing explains what code is JUST the facebook code. Can someone paste this code, this is something the developer should have seen since 80% of joomla users use other login modules not the default. Great component btw.

Edit: I posted the code to the module that i want to add the FaceBook login code.
<?php
/**
 * Core Design Login module for Joomla! 1.5
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

if (!defined('_JSCRIPTEGRATOR')) {
	echo JText&#58;&#58;_('CDLOGIN_ENABLE_SCRIPTEGRATOR');
	return;
}

// require Scriptegrator version 1.3.3 or higher
$version = '1.3.4';
if (!JScriptegrator&#58;&#58;versionRequire($version))
{
	echo JText&#58;&#58;sprintf('CDLOGIN_SCRIPTEGRATOR_REQUIREVERSION', $version);
	return;
}

if (!JScriptegrator&#58;&#58;checkLibrary('highslide', 'site'))
{
	echo JText&#58;&#58;_('CDLOGIN_MISSING_HIGHSLIDE');
	return;
}

?>

<?php if ($type == 'logout')&#58; ?>
<?php if ($cd_login_border == 'top' or $cd_login_border == "both")&#58; ?>
<div class="cd_login_border-top"></div>
<?php endif; ?>
<div class="cd_login-logout-greeting"><?php echo $name; ?> <a href="#"
	onclick="return hs.htmlExpand(this, { contentId&#58; 'highslide-html-logoutform', wrapperClassName&#58; 'mod_cd_login', outlineType&#58; '<?php echo
    $outlineType; ?>', align&#58; '<?php echo $align; ?>', anchor&#58; '<?php echo $anchor; ?>', dimmingOpacity&#58; <?php echo
    $dimmingOpacity; ?>, slideshowGroup&#58; 'mod_cd_login_logoutform' } )"
	title="<?php echo
    JText&#58;&#58;_('CDLOGIN_BUTTON_LOGOUT'); ?>"> </a></div>
<div class="highslide-html-content" id="highslide-html-logoutform"
	style="width&#58; 350px">
<div class="highslide-html-content-header">
<div class="highslide-move"
	title="<?php echo JText&#58;&#58;_('CD_LOGIN_TITLE_MOVE'); ?>"><a href="#"
	onclick="return hs.close(this)" class="control"
	title="<?php echo
	JText&#58;&#58;_('CD_LOGIN_CLOSELABEL'); ?>"><?php echo JText&#58;&#58;_('CD_LOGIN_CLOSELABEL'); ?></a>
</div>
</div>
<div class="highslide-body">
<p class="cd_login-bold"><?php echo JText&#58;&#58;_('CD_LOGIN_LOGOUT_CONFIRM'); ?></p>
<div class="cd_login-logoutform">
<form action="index.php" method="post" name="login" id="form-login"><input
	type="submit" name="Submit" class="cd_login-logoutbutton"
	value="<?php echo
    JText&#58;&#58;_('CDLOGIN_BUTTON_LOGOUT'); ?>"
	title="<?php echo JText&#58;&#58;_('CDLOGIN_BUTTON_LOGOUT'); ?>" /> <input
	type="hidden" name="option" value="com_user" /> <input type="hidden"
	name="task" value="logout" /> <input type="hidden" name="return"
	value="<?php echo $return; ?>" /></form>
</div>
</div>
<?php if (JText&#58;&#58;_('CD_LOGIN_LOGOUT_MESSAGE') == '')&#58; ?> <?php else&#58; ?>
<div class="cd_login_message_to_users"><span><?php echo JText&#58;&#58;_('CD_LOGIN_LOGOUT_MESSAGE'); ?></span></div>
<div style="height&#58; 5px"></div>
<?php endif; ?></div>
<?php if ($cd_login_border == 'bottom' or $cd_login_border == "both")&#58; ?>
<div class="cd_login_border-bottom"></div>
<?php endif; ?>
<?php else&#58; ?>

<?php
	$document = &JFactory&#58;&#58;getDocument(); // set document for next usage
	$focus_script = "
				<script type="text/javascript">
					hs.Expander.prototype.onAfterExpand = function () {
					   document.getElementById('modlgn_username').focus();
					}				
				</script>n";
	
	$document->addCustomTag($focus_script);
?>

<?php echo $params->get('pretext'); ?>
<?php if ($cd_login_border == 'top' or $cd_login_border == "both")&#58; ?>
<div class="cd_login_border-top"></div>
<?php endif; ?>

<div class="cd_moduletitle_logo"><a href="#"
	onclick="return hs.htmlExpand(this, { contentId&#58; 'highslide-html-loginform', wrapperClassName&#58; 'mod_cd_login', outlineType&#58; '<?php echo
        $outlineType; ?>', align&#58; '<?php echo $align; ?>', anchor&#58; '<?php echo $anchor; ?>', dimmingOpacity&#58; <?php echo
        $dimmingOpacity; ?>, slideshowGroup&#58; 'mod_cd_login_loginform' } )"
	title="<?php echo
	JText&#58;&#58;_('CD_LOGIN_MODULE_TITLE'); ?>"><?php echo JText&#58;&#58;_('CD_LOGIN_MODULE_TITLE'); ?>
</a></div>

	<?php if ($cd_login_border == 'bottom' or $cd_login_border == "both")&#58; ?>
<div class="cd_login_border-bottom"></div>
	<?php endif; ?>
<div class="highslide-html-content" id="highslide-html-loginform">

<div class="highslide-html-content-header">
<div class="highslide-move"
	title="<?php echo JText&#58;&#58;_('CD_LOGIN_TITLE_MOVE'); ?>"><a href="#"
	onclick="return hs.close(this)" class="control"
	title="<?php echo
	JText&#58;&#58;_('CD_LOGIN_CLOSELABEL'); ?>"><?php echo JText&#58;&#58;_('CD_LOGIN_CLOSELABEL'); ?></a>
</div>
</div>
<div class="highslide-body">

<form
	action="<?php echo JRoute&#58;&#58;_('index.php', true, $params->get('usesecure')); ?>"
	method="post" name="login" id="cd_login_form_login">
<fieldset class="input">
<p id="form-login-username"><label for="modlgn_username"><?php echo JText&#58;&#58;_('CDLOGIN_USERNAME') ?></label><br />
<input id="modlgn_username" type="text" name="username" class="inputbox"
	title="<?php echo
        JText&#58;&#58;_('CDLOGIN_USERNAME') ?>"
	alt="username" size="18" /></p>
<p id="form-login-password"><label for="modlgn_passwd"><?php echo JText&#58;&#58;_('CDLOGIN_PASSWORD') ?></label><br />
<input id="modlgn_passwd" type="password" name="passwd" class="inputbox"
	size="18"
	title="<?php echo
            JText&#58;&#58;_('CDLOGIN_PASSWORD') ?>"
	alt="password" /></p>
            <?php if (JPluginHelper&#58;&#58;isEnabled('system', 'remember'))&#58; ?>
<p id="form-login-remember"><input id="modlgn_remember" type="checkbox"
	name="remember" class="inputbox" value="yes"
	title="<?php echo
            JText&#58;&#58;_('CDLOGIN_REMEMBER_ME') ?>"
	alt="<?php echo JText&#58;&#58;_('CDLOGIN_REMEMBER_ME') ?>" /> <label
	for="modlgn_remember"
	title="<?php echo JText&#58;&#58;_('CDLOGIN_REMEMBER_ME') ?>"><?php echo
	JText&#58;&#58;_('CDLOGIN_REMEMBER_ME') ?></label> <input type="submit"
	name="Submit" id="cd_login_loginbutton"
	title="<?php echo
                JText&#58;&#58;_('CDLOGIN_BUTTON_LOGIN') ?>"
	value="" /></p>
                <?php endif; ?></fieldset>
                <?php if ($display_links)&#58; ?>
<ul>
	<li><a href="<?php echo $forgot_password_link; ?>"
		title="<?php echo JText&#58;&#58;_('CDLOGIN_FORGOT_YOUR_PASSWORD'); ?>"> <?php echo JText&#58;&#58;_('CDLOGIN_FORGOT_YOUR_PASSWORD'); ?></a>
	</li>
	<li><a href="<?php echo $forgot_username_link; ?>"
		title="<?php echo JText&#58;&#58;_('CDLOGIN_FORGOT_YOUR_USERNAME'); ?>"> <?php echo JText&#58;&#58;_('CDLOGIN_FORGOT_YOUR_USERNAME'); ?></a>
	</li>
	<?php
	$usersConfig = &JComponentHelper&#58;&#58;getParams('com_users');
	if ($usersConfig->get('allowUserRegistration'))&#58; ?>
	<li><a href="<?php echo $register_link; ?>"
		title="<?php echo JText&#58;&#58;_('CDLOGIN_REGISTER'); ?>"> <?php echo JText&#58;&#58;_('CDLOGIN_REGISTER'); ?></a>
	</li>
	<?php else&#58; ?>
	<?php endif; ?>
	<?php endif; ?>
</ul>
<?php if (!$display_links)&#58; ?>
<div style="height&#58; 10px"></div>
<?php endif; ?>
<input type="hidden" name="option" value="com_user" /> <input
	type="hidden" name="task" value="login" /> <input type="hidden"
	name="return" value="<?php echo $return; ?>" /> <?php echo JHTML&#58;&#58;_('form.token'); ?>
</form>
</div>
<?php if (JText&#58;&#58;_('CD_LOGIN_LOGIN_MESSAGE') == '')&#58; ?> <?php else&#58; ?>
<div class="cd_login_message_to_users"><span><?php echo JText&#58;&#58;_('CD_LOGIN_LOGIN_MESSAGE'); ?></span></div>
<?php endif; ?></div>
<?php echo $params->get('posttext'); ?>

<?php endif; ?>
The topic has been locked.
Active Subscriptions:

None
14 years 11 months ago #1088 by webanics
I have the same question... please help us :)
The topic has been locked.
Support Specialist
14 years 11 months ago #1096 by alzander
The main thing you'd want from the JFBC login module is the whole top section down to the last </script> statement (~line 33).

Then below that, try:

<?php
if ($formType == "login") ?>
<fb:login-button onlogin="javascript&#058;fb_login_button_click();"></fb:login-button>
<?php else
{ ?> # show logout

Keep this whole section
The topic has been locked.
Active Subscriptions:

None
14 years 11 months ago #1098 by webanics
cool!
it work

thank you
The topic has been locked.
Active Subscriptions:

None
14 years 11 months ago #1102 by vpopovic
i little stupid. what exactly I need to do just to show Facebook button in a position I want?
The topic has been locked.
Active Subscriptions:

None
14 years 11 months ago #1105 by mrperez
sourcecoast thanks for the reply but i am also a nub when it comes to coding, what code from the FBConnect Login Module does one need in order to add it to lets say other modules. i have gotten the module to show just the button my commenting out some of the code, and it works like a charm BUT i would love to add it to other modules.

below is how my module looks like, it hides all the other crap and it shows just the short facebook button and it hide the logout button also, i dont need it since i have another module doing the registration and login stuff

for those that want the long button do the following

find
<fb&#58;login-button onlogin="javascript&#058;fb_login_button_click();"></fb&#58;login-button>

and replace with
<fb&#58;login-button size="medium" length="long" onlogin="javascript&#058;fb_login_button_click();"></fb&#58;login-button>

if you want the logout button to show after login do the following

find
<!-- <div style="padding&#58;5px 0 0 0;"><input type="submit" name="Submit" class="button" style="width&#58;60px;" value="<?php echo JText&#58;&#58;_('Logout') ?>" onclick="javascript&#058;logout_button_click()" /></div> -->

replace with
<div style="padding&#58;5px 0 0 0;"><input type="submit" name="Submit" class="button" style="width&#58;60px;" value="<?php echo JText&#58;&#58;_('Logout') ?>" onclick="javascript&#058;logout_button_click()" /></div>

this is my module
<?php

defined('_JEXEC') or die('Restricted access');

JFBConnectFacebookHelper&#58;&#58;init();
?>

<script type="text/javascript">
function fb_login_button_click()
{
FB.Facebook.get_sessionState().waitUntilReady(
function() {
var fbUserLoginLink = "<?php echo JRoute&#58;&#58;_(JFBConnectFacebookHelper&#58;&#58;getFacebookUserLoginLink()."&return=".$fbLoginUrl, false); ?>";
window.location = fbUserLoginLink;
});
}

function logout_button_click()
{
<?php 
if ($fbClient->user)
echo 'FB.Connect.logout(redirect_to_jfbconnect_logout);';
else
echo 'redirect_to_jfbconnect_logout();';
?>
}

function redirect_to_jfbconnect_logout()
{
window.location = '<?php echo JRoute&#58;&#58;_('index.php?option=com_jfbconnect&task=logout&return='.$logoutUrl, false); ?>';
}
</script>


<?php 
if ($formType == "login")
{ ?>

<!-- <form action="<?php echo JRoute&#58;&#58;_(JURI&#58;&#58;root()); ?>" method="post" name="login" id="form-login" >
<fieldset class="input">
<div id="form-login-username">
<label for="modlgn_username"><?php echo JText&#58;&#58;_('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&#58;&#58;_('Password') ?></label><br />
<input id="modlgn_passwd" type="password" name="passwd" class="inputbox" size="18" alt="password" />
</div>
<input type="submit" name="Submit" class="button" value="<?php echo JText&#58;&#58;_('LOGIN') ?>" />
</fieldset>

<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="login" />
<input type="hidden" name="return" value="<?php echo $jLoginUrl; ?>" />
<?php echo JHTML&#58;&#58;_( 'form.token' ); ?>
</form> -->


<!-- <?php echo JText&#58;&#58;_('Login using Facebook'); ?></a> -->
<fb&#58;login-button onlogin="javascript&#058;fb_login_button_click();"></fb&#58;login-button>
<ul>
<!-- <?php
$usersConfig = &JComponentHelper&#58;&#58;getParams( 'com_users' );
if ($usersConfig->get('allowUserRegistration')) &#58; ?>
<li>
<?php
$registerType = $params->get('register_type');
if ($registerType == "jomsocial")
{
$jspath = JPATH_BASE.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
$link = CRoute&#58;&#58;_( 'index.php?option=com_community&view=register');
}
else 
$link = JRoute&#58;&#58;_( 'index.php?option=com_user&task=register' );
?>
<a href="<?php echo $link ?>">
<?php echo JText&#58;&#58;_('Register for this site'); ?></a>
</li> -->
<?php endif; ?>
</ul>


<? } ###################### end login form #####################################
else
{	# show logout
?>
<?php
# Show their FB avatar (if desired), or give them the option to link accounts
if ($fbClient->user)
{
if($params->get("enableProfilePic")) 
{ 
$picHeightParam = $params->get("profileHeight");
$picWidthParam = $params->get("profileWidth");
$picHeight = $picHeightParam != "" ? 'height="'.$picHeightParam.'px"' &#58; "";
$picWidth = $picWidthParam != "" ? 'width="'.$picWidthParam.'px"' &#58; "";
$linked = ($params->get("linkProfile") == 1)?"true"&#58;"false";
$fbLogo = ($params->get("facebookLogo") == 1)?"true"&#58;"false"; 
$fbUid = $fbClient->user;
?>
<span id="profile-pic">
<fb&#58;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;?>"
/>
</span>
<?php 
}
} 
?>
<!-- <div style="padding&#58;5px 0 0 0;">
<?php echo JText&#58;&#58;_("Welcome")." ".$user->get('name') ?>
</div> -->
<!-- <div style="padding&#58;5px 0 0 0;"><input type="submit" name="Submit" class="button" style="width&#58;60px;" value="<?php echo JText&#58;&#58;_('Logout') ?>" onclick="javascript&#058;logout_button_click()" /></div> -->
<?php
if (!$fbClient->user) # show facebook connect button to join accounts
{ ?>
<!-- <div class="fb_connect_user"><?php echo JText&#58;&#58;_('Connect User'); ?></div>--> 
<fb&#58;login-button onlogin="javascript&#058;fb_login_button_click();"></fb&#58;login-button>
<?php }
?>

<?
} # end logout

?>
The topic has been locked.
Active Subscriptions:

None
14 years 11 months ago #1139 by vpopovic
somebody explain this to me. on, I want just facebook image to show from all module. Whay php file do I edit? modules/mod_jfbclogin/tmpl/defoult ? and I insert this code?
<?php

defined('_JEXEC') or die('Restricted access');

JFBConnectFacebookHelper&#58;&#58;init();
?>

<script type="text/javascript">
	function fb_login_button_click()
	{
		FB.Facebook.get_sessionState().waitUntilReady(
			function() {
				var fbUserLoginLink = "<?php echo JRoute&#58;&#58;_(JFBConnectFacebookHelper&#58;&#58;getFacebookUserLoginLink()."&return=".$fbLoginUrl, false); ?>";
				window.location = fbUserLoginLink;
			});
	}

	function logout_button_click()
	{
		<?php 
		if ($fbClient->user)
   		echo 'FB.Connect.logout(redirect_to_jfbconnect_logout);';
		else
   		echo 'redirect_to_jfbconnect_logout();';
 		?>
	}

	function redirect_to_jfbconnect_logout()
	{
		window.location = '<?php echo JRoute&#58;&#58;_('index.php?option=com_jfbconnect&task=logout&return='.$logoutUrl, false); ?>';
	}
</script>


<?php 
	if ($formType == "login")
	<fb&#58;login-button onlogin="javascript&#058;fb_login_button_click();"></fb&#58;login-button>
<?php else
{ ?> # show logout

I do this but I get a Parse error: syntax error, unexpected '<' in /home/vpopovic/public_html/rugbyleaguespace.com/modules/mod_jfbclogin/tmpl/default.php on line 37.

what do I do wrong?
The topic has been locked.
Support Specialist
14 years 11 months ago #1142 by alzander
A new version of the JFBCLogin module (and JFBConnect) component was released yesterday which should help you a bit. The new module allows you to turn off everything but the button. Try that and let me know if that helps.
The topic has been locked.