sebsimappus Posted March 26, 2016 Share Posted March 26, 2016 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. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted March 26, 2016 Share Posted March 26, 2016 you may share your code for modification 0 Quote Link to comment Share on other sites More sharing options...
sebsimappus Posted March 26, 2016 Author Share Posted March 26, 2016 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 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 26, 2016 Share Posted March 26, 2016 if it's the panel hook from the documentation... http://docs.whmcs.com/Editing_Client_Area_Menus you could modify the links to open in a new window/tab... http://forum.whmcs.com/showthread.php?103006-navbar-addChild-uri-target&p=446758#post446758 0 Quote Link to comment Share on other sites More sharing options...
sebsimappus Posted March 27, 2016 Author Share Posted March 27, 2016 Thank you for your help, I edit the file yet it always appears when he should not, by regarding these target function ok 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted March 27, 2016 Share Posted March 27, 2016 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"); } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 27, 2016 Share Posted March 27, 2016 the social media sidebar is designed to appear on all pages - so it's working normally. you can set it to appear on only some pages, but it would be helpful if you told us where you want to show this sidebar and where you do not want to show it. 0 Quote Link to comment Share on other sites More sharing options...
sebsimappus Posted March 28, 2016 Author Share Posted March 28, 2016 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 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted March 28, 2016 Share Posted March 28, 2016 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"); } }); 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted March 29, 2016 Share Posted March 29, 2016 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"); } }); 0 Quote Link to comment Share on other sites More sharing options...
Ugyen Posted May 16, 2016 Share Posted May 16, 2016 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 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 16, 2016 Share Posted May 16, 2016 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. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.