Topic-icon Display a CSS Facebook login button

Support Specialist
1 year 11 months ago #67991 by mel
So the easysocial style is targeting the button with an ID of es. Easysocial adds this id in their view.
#es .btn-es-facebook {
    color: #fff !important;
    background-color: #4267b2 !important;
    border-color: #4267b2 !important;
}

The id is not present within the SCSocialWidget, since that is our module. The quickest way to fix this would be to remove the #es from the CSS specifier, so it would look like this:
.btn-es-facebook { color:... }
The topic has been locked.
Active Subscriptions:

None
Hello there,

It's fine now for the CSS, thank you.

But, i found out that this custom button for Facebook Login always display from SCSocial Widget module even if i select "Like Button" for instance instead of "Login" in module setting.
What is the best way to insert custom Facebook login button code in SCSocial Widget module so it displays only if you select "Login" and lets other features of module work as expected when selecting?
Please find the original code as below (public_html/templates/TEMPLATE_NAME/html/mod_scsocialwidget/default.php):

START
<?php
/**
 * @package         JFBConnect
 * @copyright (c)   2009-2021 by SourceCoast - All Rights Reserved
 * @license         www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @version         Release v9.0.197
 * @build-date      2022/02/01
 */
if (!(defined('_JEXEC') || defined('ABSPATH'))) {     die('Restricted access'); };
if ($userIntro != '') {
    echo '<div class="sc_social_widget">'.$userIntro."</div>";
}
if($widget)
    echo $widget->render();
require(JPATH_ROOT.'/components/com_jfbconnect/assets/poweredBy.php');
?>
END

Help please.
The topic has been locked.
Support Specialist
1 year 11 months ago #67995 by mel
In your override for the SCSocialWidget tmpl/default.php file, replace
if($widget)
    echo $widget->render();

with
if($widgetType == "login" && $providerType == "facebook")
    echo "blah"; //replace with your button code
else if($widget)
    echo $widget->render();
The topic has been locked.
Active Subscriptions:

None
Hello there,

I edited file as that in attachment, but i get an error.
 

File Attachment:

File Name: JFBCSupport2.txt
File Size:1 KB


Could you kindly share with me the right complete code in a text file? Thank you.

Best regards.
Attachments:
The topic has been locked.
Active Subscriptions:

None
Hello there,

I tried again to replace your "blah" term with this button code with or without php tags (cf. attachment) but at this day, it's always giving me an error 0 syntax error, unexpected...:
 

File Attachment:

File Name: JFBCSuppor...5-22.txt
File Size:1 KB


Please remind that i'm not a developer.
Could you kindly share the full code in a text file?
Thank you.
Attachments:
The topic has been locked.
Support Specialist
1 year 10 months ago - 1 year 10 months ago #68006 by alzander
Sorry for the delayed response. Below should be the correct code to use:
<?php
/**
* @package JFBConnect
* @copyright (c) 2009-2021 by SourceCoast - All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* @version Release v9.0.197
* @build-date 2022/02/01
*/

if (!(defined('_JEXEC') || defined('ABSPATH'))) { die('Restricted access'); };

if ($userIntro != '') {
echo '<div class="sc_social_widget">'.$userIntro."</div>";
}
if ($widgetType == "login" && $providerType == "facebook") { ?>
<div class="jfbconnect-wrapper">
<a href="javascript:void(0)" onclick="jfbc.login.provider('facebook');" class="btn btn-es-facebook btn-sm btn-block">
<i class="fab fa-facebook"></i><?php echo Text::_('FBLOG_JFBC_LAB')?></a>
</div>
<?php }
else if ($widget)
echo $widget->render();

require(JPATH_ROOT.'/components/com_jfbconnect/assets/poweredBy.php');
?>

I hope that helps, but if you need anything else, please let us know.
Last edit: 1 year 10 months ago by alzander.
The topic has been locked.
Active Subscriptions:

None
I pasted your code.

But now if i select "Login" in SCSocial widget module, i get this error: Class 'Text' not found.
It works fine if i select another feature in module as "Like Button", or "Share".

Best regards.
The topic has been locked.
Active Subscriptions:

None
Ok,

Actually, this code was missing:
use Joomla\CMS\Language\Text;

Now seems work fine.

Best regards
The topic has been locked.