Jump to content

socialMediaPanel


sebsimappus

Recommended Posts

Hello,

 

Can you tell me if this is normal, I create the hook file for social network.

 

Yet it is visible on all pages, see print screens.

 

Also can tell me if it is possible to send the links on a new browser tab, because now when you click on facebook or twitter page he left to go to the social networking page.

 

thank you in advance for your help.

 

Accueil_-_MyDATACENTER_-_2016-03-25_19.05.25.png

Link to comment
Share on other sites

Hello,

 

Thank you for your feedback and help I attached the code :

 

<?php

 

use WHMCS\View\Menu\Item as MenuItem;

 

// Add social media links to the end of all secondary sidebars.

add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)

{

// Add a panel to the end of the secondary sidebar for social media links.

// Declare it with the name "social-media" so we can easily retrieve it

// later.

$secondarySidebar->addChild('social-media', array(

'label' => 'Social Media',

'uri' => '#',

'icon' => 'fa-thumbs-up',

));

 

// Retrieve the panel we just created.

$socialMediaPanel = $secondarySidebar->getChild('social-media');

 

// Move the panel to the end of the sorting order so it's always displayed

// as the last panel in the sidebar.

$socialMediaPanel->moveToBack();

 

// Add a Facebook link to the panel.

$socialMediaPanel->addChild('facebook-link', array(

'uri' => 'https://www.facebook.com/facebook',

'label' => 'Like us on Facebook!',

'order' => 1,

'icon' => 'fa-facebook',

));

 

// Add a Twitter link to the panel after the Facebook link.

$socialMediaPanel->addChild('twitter-link', array(

'uri' => 'https://twitter.com/twitter',

'label' => 'Follow us on Twitter!',

'order' => 2,

'icon' => 'fa-twitter',

));

 

// Add a Google+ link to the panel after the Twitter link.

$socialMediaPanel->addChild('google-plus-link', array(

'uri' => 'https://plus.google.com/+Google',

'label' => 'Add us to your circles!',

'order' => 3,

'icon' => 'fa-google-plus',

));

});

 

cordially

Link to comment
Share on other sites

Thank you for your help, I edit the file yet it always appears when he should not, by regarding these target function ok

the following will only appear in clientarea.php file, this mean it will be displayed inside Invoices, Services and Domains etc

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

// Add social media links to the end of all secondary sidebars.
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{
// Add a panel to the end of the secondary sidebar for social media links.
// Declare it with the name "social-media" so we can easily retrieve it
// later.
if (APP::getCurrentFileName()=="clientarea"){
$secondarySidebar->addChild('social-media', array(
'label' => 'Social Media',
'uri' => '#',
'icon' => 'fa-thumbs-up',
));

// Retrieve the panel we just created.
$socialMediaPanel = $secondarySidebar->getChild('social-media');

// Move the panel to the end of the sorting order so it's always displayed
// as the last panel in the sidebar.
$socialMediaPanel->moveToBack();

// Add a Facebook link to the panel.
$socialMediaPanel->addChild('facebook-link', array(
'uri' => 'https://www.facebook.com/facebook',
'label' => 'Like us on Facebook!',
'order' => 1,
'icon' => 'fa-facebook',
))
->setAttribute("target", "_blank");

// Add a Twitter link to the panel after the Facebook link.
$socialMediaPanel->addChild('twitter-link', array(
'uri' => 'https://twitter.com/twitter',
'label' => 'Follow us on Twitter!',
'order' => 2,
'icon' => 'fa-twitter',
))
->setAttribute("target", "_blank");

// Add a Google+ link to the panel after the Twitter link.
$socialMediaPanel->addChild('google-plus-link', array(
'uri' => 'https://plus.google.com/+Google',
'label' => 'Add us to your circles!',
'order' => 3,
'icon' => 'fa-google-plus',
))
->setAttribute("target", "_blank");
}
});

Link to comment
Share on other sites

Hello,

 

A big thank you for your help, and I apologize for not having had more accurate.

 

Good job

 

Would it be possible to ensure that it does not appear in the login page (clientarea.php).

 

thank you in advance

 

this way

<?php

use WHMCS\View\Menu\Item as MenuItem;

// Add social media links to the end of all secondary sidebars.
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{
// Add a panel to the end of the secondary sidebar for social media links.
// Declare it with the name "social-media" so we can easily retrieve it
// later.
if (APP::getCurrentFileName()=="clientarea" && $templatefile!="login.tpl"){
$secondarySidebar->addChild('social-media', array(
'label' => 'Social Media',
'uri' => '#',
'icon' => 'fa-thumbs-up',
));

// Retrieve the panel we just created.
$socialMediaPanel = $secondarySidebar->getChild('social-media');

// Move the panel to the end of the sorting order so it's always displayed
// as the last panel in the sidebar.
$socialMediaPanel->moveToBack();

// Add a Facebook link to the panel.
$socialMediaPanel->addChild('facebook-link', array(
'uri' => 'https://www.facebook.com/facebook',
'label' => 'Like us on Facebook!',
'order' => 1,
'icon' => 'fa-facebook',
))
->setAttribute("target", "_blank");

// Add a Twitter link to the panel after the Facebook link.
$socialMediaPanel->addChild('twitter-link', array(
'uri' => 'https://twitter.com/twitter',
'label' => 'Follow us on Twitter!',
'order' => 2,
'icon' => 'fa-twitter',
))
->setAttribute("target", "_blank");

// Add a Google+ link to the panel after the Twitter link.
$socialMediaPanel->addChild('google-plus-link', array(
'uri' => 'https://plus.google.com/+Google',
'label' => 'Add us to your circles!',
'order' => 3,
'icon' => 'fa-google-plus',
))
->setAttribute("target", "_blank");
}
});

Link to comment
Share on other sites

forum do not allow me to edit the last post!

 

this is how it should look like, @Brian thanks for the correction ;)

<?php

use WHMCS\View\Menu\Item as MenuItem;

// Add social media links to the end of all secondary sidebars.
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{

// Add a panel to the end of the secondary sidebar for social media links.
// Declare it with the name "social-media" so we can easily retrieve it
// later.
if (APP::getCurrentFileName()=="clientarea" && !is_null(Menu::context('client'))){
$secondarySidebar->addChild('social-media', array(
'label' => 'Social Media',
'uri' => '#',
'icon' => 'fa-thumbs-up',
));

// Retrieve the panel we just created.
$socialMediaPanel = $secondarySidebar->getChild('social-media');

// Move the panel to the end of the sorting order so it's always displayed
// as the last panel in the sidebar.
$socialMediaPanel->moveToBack();

// Add a Facebook link to the panel.
$socialMediaPanel->addChild('facebook-link', array(
'uri' => 'https://www.facebook.com/facebook',
'label' => 'Like us on Facebook!',
'order' => 1,
'icon' => 'fa-facebook',
))
->setAttribute("target", "_blank");

// Add a Twitter link to the panel after the Facebook link.
$socialMediaPanel->addChild('twitter-link', array(
'uri' => 'https://twitter.com/twitter',
'label' => 'Follow us on Twitter!',
'order' => 2,
'icon' => 'fa-twitter',
))
->setAttribute("target", "_blank");

// Add a Google+ link to the panel after the Twitter link.
$socialMediaPanel->addChild('google-plus-link', array(
'uri' => 'https://plus.google.com/+Google',
'label' => 'Add us to your circles!',
'order' => 3,
'icon' => 'fa-google-plus',
))
->setAttribute("target", "_blank");
}
});

Link to comment
Share on other sites

  • 1 month later...

Hi whmcs community,

 

How can I add different facebook links for different languages... So that every country can have different facebook link in their language.

 

I added this code... I got error...

// Add a Facebook link to the panel.

$socialMediaPanel->addChild('facebook-link', array(

'uri' => 'https://www.facebook.com/facebook1',

{if $LANG.facebook}<link rel="stylesheet" type="text/css" href="https://www.facebook.com/facebook" />{/if}

'label' => 'Like us on Facebook!',

'order' => 1,

'icon' => 'fa-facebook',

));

 

Looking forward hearing from you all.

 

With Best Regards,

 

Ugyen

Link to comment
Share on other sites

How can I add different facebook links for different languages... So that every country can have different facebook link in their language.

 

I added this code... I got error...

that's because you added a bit of Smarty code to the middle of the hook - and you can't use Smarty in these hooks.

 

the simplest way would be to just use a Language Override for every language...

 

// Add a Facebook link to the panel.
$socialMediaPanel->addChild('facebook-link', array(
'uri' => Lang::trans('facebookurl'),
'label' => 'Like us on Facebook!',
'order' => 1,
'icon' => 'fa-facebook',
))
->setAttribute("target", "_blank");

and set add an override for every language, e.g, for overrides/english.php you could add...

 

$_LANG['facebookurl'] = "https://en-gb.facebook.com/";

for lang/overrides/french.php, you could add...

 

$_LANG['facebookurl'] = "https://fr-fr.facebook.com/";

as long as you remember to add a URL for every language choice, it should work fine... depending on your facebook URLs and if the sidebar were for clients-only, there would be cleverer ways to do this, but the above should meet your requirement. :idea:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated