We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

add new | Forum

Talk The Trade
Talk The Trade Nov 25 '11
hello, i was wondering is there a way to modify the "add new" box on the sidebar? i.e remove "blog post" and possibly rename the others? thanks
Sardar
Sardar Dec 5 '11
Hello,
Yes, you can easily do it - you should find the label in languages section and rename it as you wish. To remove any item from this widget you need to disactivate plugin which added the item ( for example you should desactivate blogs plugin to remove `blog post` item ).
The Forum post is edited by Sardar Dec 5 '11
Talk The Trade
Talk The Trade Dec 6 '11
great! thank you Sardar
Arifur Rahman
Arifur Rahman Apr 5 '12
How can I Add New Item on Add new bar? Example I want to Add "ask Question" How can I create it?
Sardar
Sardar Apr 25 '12

Arifur Rahman

You should bind your handler to event `base.add_new_content_item` providing `icon class`, `label` and `url`. This code should be located in your plugin's init.php file.


Here is example from blogs plugin:

------------------------------------

function blogs_add_new_content_item( BASE_CLASS_EventCollector $event )

{


    if ( OW::getUser()->isAuthenticated() && OW::getUser()->isAuthorized('blogs', 'add') )

    {

        $resultArray = array(

            BASE_CMP_AddNewContent::DATA_KEY_ICON_CLASS => 'ow_ic_write',

            BASE_CMP_AddNewContent::DATA_KEY_URL => OW::getRouter()->urlForRoute('post-save-new'),

            BASE_CMP_AddNewContent::DATA_KEY_LABEL => OW::getLanguage()->text('blogs', 'add_new_link')

        );


        $event->add($resultArray);

    }

}

OW::getEventManager()->bind('base.add_new_content_item', 'blogs_add_new_content_item');


--------------------------------------------

Michael I.
Michael I. Nov 1 '12
Topic was moved from Core.
Erik
Erik Mar 20 '14
Topic not moved.. and still seeking answer
Daisy Team
Daisy Mar 20 '14
Erik, please describe the problem in more details and I will try to find the proper solution.
The Forum post is edited by Daisy Mar 20 '14
Erik
Erik Mar 21 '14
There is no way to add more tabs or remove a tab.. the description above is hard to understand.

The Forum post is edited by Erik Mar 21 '14
Alia Team
Alia Mar 24 '14
Erik, things changed a little bit from the moment Sardar gave his instructions. But the logic behind is still the same.

>>To remove tabs:
Example: we are trying to remove "Event" tab.
File to edit: ow_plugins/event/classes/event_handler.php
Code to remove:

if ( !OW::getUser()->isAuthorized('event', 'add_event') )
        {
            return;
        }

        $resultArray = array(
            BASE_CMP_AddNewContent::DATA_KEY_ICON_CLASS => 'ow_ic_calendar',
            BASE_CMP_AddNewContent::DATA_KEY_URL => OW::getRouter()->urlForRoute('event.add'),
            BASE_CMP_AddNewContent::DATA_KEY_LABEL => OW::getLanguage()->text('event', 'add_new_link_label')
        );

        $event->add($resultArray);

>>
To add tabs:
File to edit: ow_plugins/plugin_name/classes/event_handler.php
Example how this is done within "Events" plugin:

 public function addNewContentItem( BASE_CLASS_EventCollector $event )
    {
        if ( !OW::getUser()->isAuthorized('event', 'add_event') )
        {
            return;
        }

        $resultArray = array(
            BASE_CMP_AddNewContent::DATA_KEY_ICON_CLASS => 'ow_ic_calendar',
            BASE_CMP_AddNewContent::DATA_KEY_URL => OW::getRouter()->urlForRoute('event.add'),
            BASE_CMP_AddNewContent::DATA_KEY_LABEL => OW::getLanguage()->text('event', 'add_new_link_label')
        );

        $event->add($resultArray);
    }