Topic-icon How to Change Order of Buttons in JomSocial

Active Subscriptions:

None
10 years 5 months ago #38319 by rpellowe
I need to reorder the buttons on the login page for JomSocial. How can I do this?

Thanks,
Paul

File Attachment:
The topic has been locked.
Support Specialist
10 years 5 months ago #38329 by alzander
Right now, there really isn't a way to do that easily. The way the buttons are inserted is actually alphabetical order (by how the files are named). With the next release (adding Twitter) in about a week, it will be the same. We're likely going to be adding an 'ordering' option in the release around the end of the year that will be integrating JLinked into JFBConnect.

With that said, if there's a specific order you're looking for, let me know. There may be something we can help you implement.

Also, in the next release, there will be a language string that you can add before those buttons that will default to "Login with: " and then show the buttons. It should make things a little more obvious, if that's all you're looking to do.

Let me know your thoughts, and we'll help how we can.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 5 months ago #38372 by rpellowe
We are using this on a more corporate site and Facebook should not be first. Preferably it would be last.
The topic has been locked.
Support Specialist
10 years 5 months ago #38385 by alzander
It will take 2 changes to our code to get it last. The first is to swap the Google/Facebook order and the second is to put LinkedIn first (assuming that's what you're looking for). The edits are:
/components/com_jfbconnect/libraries/factory.php around line 34, you'll see:
public static function getAllProviders()
    {
        static $allProviders;
        if (!isset($allProviders))
Update that to:
public static function getAllProviders()
    {
        static $allProviders;
        $allProviders[] = self::provider('google');
        $allProviders[] = self::provider('facebook');
        if (!isset($allProviders))

Then, in /components/com_jfbconnect/libraries/provider/facebook.php around line 138, you'll see:
function getLoginButton($x = null, $y = null, $z = null)
    {
        $providers = JFBCFactory::getAllProviders();
        $html = "";
        foreach ($providers as $p)
            $html .= $p->loginButton();

        if (SCSocialUtilities::isJLinkedInstalled())
            $html .= '<div class="jLinkedLoginImage pull-left"><a class="show" id="sc_lilogin" href="javascript:void(0)" onclick="jlinked.login.login();"><img src="' . JURI::root() . 'media/sourcecoast/images/provider/button_linkedin.png" /></a></div>';
Switch the ordering of those 2 blocks, like so:
function getLoginButton($x = null, $y = null, $z = null)
    {
        $providers = JFBCFactory::getAllProviders();
        $html = "";
        if (SCSocialUtilities::isJLinkedInstalled())
            $html .= '<div class="jLinkedLoginImage pull-left"><a class="show" id="sc_lilogin" href="javascript:void(0)" onclick="jlinked.login.login();"><img src="' . JURI::root() . 'media/sourcecoast/images/provider/button_linkedin.png" /></a></div>';

        foreach ($providers as $p)
            $html .= $p->loginButton();
That should get you going. In the v5.2 release, you'll need to update that again (the same way) to re-order it again and add Twitter. We can gladly help then though as well.

Let me know if you need anything else,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 5 months ago #38507 by joomleb
Hi Alex,
Please, Is there a possibility to have at least the same layout (alphabetical from left to right) also for the Social Buttons - Content Plugin Likes - see my question number 3
The topic has been locked.
Support Specialist
10 years 5 months ago #38510 by alzander
Joomleb,
Ordering of the share buttons is more complex. It can be done, but there's a few places where those buttons are assigned from. If you want to tinker, the places to edit are:
/libraries/sourcecoast/utilities.php , starting around line 159, you'll see:
if ($showTwitterButton)
You can rearrange each of those blocks however you want there. The only one not shown is the Like button, which we always put last due to how the text string "xyz your friends Like this" can display depending on your configuration. If you would rather that first, you can edit the /plugins/content/jfbccontent.php and move the code at line 252 above the block it's currently after. The code to move looks like:
$buttonText .= $likeText;
Facebook just announced a welcome change to the Like button. We also, as mentioned above, have plans to allow re-arranging the social features in a future update.

Hopefully the above gets you going,
Alex
The topic has been locked.