How do you add elements under the left sidebar?

Allon Prooit Posted in Performance and Scalability 3 years ago

I am wanting to put a widget element under the left sidebar. Specifically, the Google translate bar that translates the site language on the fly. I did this with an image in OSSN 5.0 but haven't been able to find the code for it in OSSN 5.6. Any thoughts?

Replies
German Michael Zülsdorff Replied 3 years ago

Ok,
so PHP is echoing (outputting) something here which is returned from
ossn_call_hook('newsfeed', 'sidebar:left, .....).
By default - we know: this is a profile photo and a menu.
Obviously, some way these parts must have been already 'hooked on'.
My way of exploring unknown Ossn stuff is consulting the reference first
In this case I found
https://www.opensource-socialnetwork.org/references/ossn_8lib_8system_8php.html#a2f212f5719e33a233483f3ac67cf372d
and it didn't take long to see: there's a corresponding function ossn_add_hook
Then the next step is using my grep tool to find occurrences of similar named hooks, and voila I'm getting

 ossn_add_hook('newsfeed', "sidebar:left", 'profile_photo_newsefeed', 1);

and

ossn_add_hook('newsfeed', "sidebar:left", 'newfeed_menu_handler');

Thus, have a look into any of these functions, write a new one which is adding your translator and hook it on like

ossn_add_hook('newsfeed', "sidebar:left", 'allons_google_translator');

in the com file of your component.

us Allon Prooit Replied 3 years ago

Ok so I've found the file but am not sure how to cut into it. I've tried a number of things with no good result. Here's the code...

    <div class="sidebar ">
        <div class="sidebar-contents">
             <?php
                if (ossn_is_hook('newsfeed', "sidebar:left")) {
                        $newsfeed_left = ossn_call_hook('newsfeed', "sidebar:left", NULL, array());
                         echo implode('', $newsfeed_left);
                }
             ?> 
        </div>
    </div>

How do I place specific elements into this?

Indonesian Arsalan Shah Replied 3 years ago

You should just search for sidebar.php file in your theme and in that file you should able to edit the contents. As Z-man mentioned it totally depends on theme not all themes have this but the one you are using have this file.

us Allon Prooit Replied 3 years ago

I'm using the White theme.
See it HERE. Username: Guest - Password: 1234pass

German Michael Zülsdorff Replied 3 years ago

Hmm, I don't believe it depends so much on the Ossn version but the theme in use, Which theme are you running?