Restrict component to only the landing page (registration and login areas)

Joey Champion Posted in Component Development 3 years ago

Good morning friends.
I love the tropical birds component that Arsalan helped make possible.
Is there any way to restrict the component to just the landing page?
The birds are a welcome site to see with the tropical background on the landing page.
However, they continue to run behind the OSSN wall after a user logs in, thus slowing things down.
You can see what I mean here... ( www.OasisIsle.com ).
Please help if you can.
Have an awesome day!

Replies
us Joey Champion Replied 3 years ago

Thank you Arsalan. Yes, your suggestion works. Your a wonderful person. I am grateful for your efforts and you are much appreciated. Have an AWESOME day my friend. The world needs more people like you!

Indonesian Arsalan Shah Replied 3 years ago

@Joey,

Other solution may edit the component ossn_com.php file with below,

<?php
/**
 * Open Source Social Network
 *
 * @package Open Source Social Network
 * @author    Open Social Website Core Team <[email protected]>
 * @copyright 2014-2017 SOFTLAB24 LIMITED
 * @license   Open Source Social Network License (OSSN LICENSE)  http://www.opensource-socialnetwork.org/licence
 * @link      https://www.opensource-socialnetwork.org/
 */
function tropical_init() {
    ossn_add_hook('plugin', 'view:type', 'tropical_pages_restrict');

    ossn_new_external_js('vantajs3', 'components/tropical/vendors/three.min.js');
    ossn_new_external_js('vantajs', 'components/tropical/vendors/vanta.birds.min.js');

    ossn_new_js('tropical', 'js/tropical');     
}
function tropical_pages_restrict($hook, $type, $return, $params){
    $allowed = array('pages/index');
    if(isset($params['plugin']) && in_array($params['plugin'], $allowed)){
        ossn_load_external_js('vantajs3');
        ossn_load_external_js('vantajs'); 

        ossn_load_js('tropical'); 
    }
    return $return;
}

ossn_register_callback('ossn', 'init', 'tropical_init');

It is a dirty solution but works.

us Joey Champion Replied 3 years ago

Thank you ~Z~ Man. You are brilliant... unfortunately, I am not. I hunt and peck until something works. Your guidance is so wonderfully appreciated. Working in OSSN has been challenging because of the modular nature of the site. (I love OSSN, that very same modularity that make the site so fast, awesome and responsive, is a puzzle for old guys like me who were web developers 20 years ago). But, honestly, once again... thank you kind sir for the direction. Your a great guy!

German Michael Zülsdorff Replied 3 years ago

One way could be to check for a class which is only available on the landing page.
Like ossn-layout-startup for example. If in place, let the birds fly, otherwise not.