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" Widget on Dashboard | Forum

Joseph
Joseph Mar 17 '14
I am wondering how to put the "Add New" widget on the dashboard
Daisy Team
Daisy Mar 20 '14
Joseph, please take a look at these solutions: http://www.oxwall.org/forum/117/search?&q=addWidget

P.S. I would ask you to search before posting.
The Forum post is edited by Daisy Mar 20 '14
Joseph
Joseph Mar 20 '14
that did not solve my issue I have searched for this already with no result I am looking for how to add the widget known as "Add New" to the dashboard I know how to add common widgets to other places thsi is a base component and I do not know how to do this.



The Forum post is edited by Joseph Mar 20 '14
Joseph
Joseph Mar 20 '14
I just want to place the widget on the dashboard 
Daisy Team
Daisy Mar 20 '14
Joseph, I've provided you with the code that add components to the pages. All you need is to find the component name in phpMyAdmin > ow_base_component table and add the component name to the code. Then simply add this code to activate.php file of any plugin and reactivate the plugin. Or you can add it to the base init.php file, refresh the page, remove the code from the file and check the widget should be added.

I've provided you with solutions, you just need to take a deep look into the code to find out how it works.
Jeffery
Jeffery Apr 1 '14
Joe, did you figure it out?  If not, here you go.  This can help other people, as well. 


It took a little figuring out, at first I thought I broke my site.  Don't be scared, follow this and it will work.


Copy ow_system_plugins/base/views/components add_new_content.html.  Duplicate that and rename the new copy to add_new.html


Copy ow_system_plugins/base/components add_new_content.php.  Duplicate that and rename the new copy to add_new.php


Open ow_system_plugins/base/init.php


At the bottom somewhere add the following code:

$widget = BOL_ComponentAdminService::getInstance()->addWidget('BASE_CMP_AddNew');
$placeWidget = BOL_ComponentAdminService::getInstance()->addWidgetToPlace($widget, BOL_ComponentAdminService::PLACE_DASHBOARD);
BOL_ComponentAdminService::getInstance()->addWidgetToPosition($placeWidget, BOL_ComponentAdminService::SECTION_LEFT);


Save that. Refresh your site.  Then go back and delete that code and save.


This should work, I think I got all the steps.  It worked for me, and the good thing is this creates a duplicate so you can edit the add_new.html file to your liking and won't have to worry about losing it when there are updates.


If you have any problems, let me know.  I will try to help.

Kяuncн Leader
Kяuncн Jun 20 '15
This totally screwed my site:

OW Debug - Warning Message: include(/home/krunch/public_html/ow_system_plugins/base/components/add_new.php) [function.include]: failed to open stream: No such file or directory File: /home/krunch/public_html/ow_core/autoload.php Line: 110

OW Debug - Warning Message: include() [function.include]: Failed opening '/home/krunch/public_html/ow_system_plugins/base/components/add_new.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') File: /home/krunch/public_html/ow_core/autoload.php Line: 110

OW Debug - Warning Message: include(/home/krunch/public_html/ow_system_plugins/base/components/add_new.php) [function.include]: failed to open stream: No such file or directory File: /home/krunch/public_html/ow_core/autoload.php Line: 110

OW Debug - Warning Message: include() [function.include]: Failed opening '/home/krunch/public_html/ow_system_plugins/base/components/add_new.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') File: /home/krunch/public_html/ow_core/autoload.php Line: 110

OW Debug - Warning Message: include(/home/krunch/public_html/ow_system_plugins/base/components/add_new.php) [function.include]: failed to open stream: No such file or directory File: /home/krunch/public_html/ow_core/autoload.php Line: 110

OW Debug - Warning Message: include() [function.include]: Failed opening '/home/krunch/public_html/ow_system_plugins/base/components/add_new.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') File: /home/krunch/public_html/ow_core/autoload.php Line: 110

OW Debug - Warning Message: call_user_func() expects parameter 1 to be a valid callback, class 'BASE_CMP_AddNew' not found File: /home/krunch/public_html/ow_system_plugins/base/components/drag_and_drop_panel.php Line: 67

OW Debug - Warning Message: call_user_func() expects parameter 1 to be a valid callback, class 'BASE_CMP_Add_New' not found File: /home/krunch/public_html/ow_system_plugins/base/components/drag_and_drop_panel.php Line: 67

OW Debug - Exception

Message: Class BASE_CMP_Add_New does not exist File: /home/krunch/public_html/ow_system_plugins/base/components/drag_and_drop_item.php Line: 208 Trace: #0 /home/krunch/public_html/ow_system_plugins/base/components/drag_and_drop_item.php(208): ReflectionClass->__construct('BASE_CMP_Add_Ne...') #1 /home/krunch/public_html/ow_system_plugins/base/components/drag_and_drop_item.php(92): BASE_CMP_DragAndDropItem->checkComponent('BASE_CMP_Add_Ne...') #2 /home/krunch/public_html/ow_system_plugins/base/components/drag_and_drop_entity_panel.php(200): BASE_CMP_DragAndDropItem->setContentComponentClass('BASE_CMP_Add_Ne...') #3 /home/krunch/public_html/ow_smarty/template_c/7042cced80abb84056f9257e6f3cb2e0b9e13038.file.drag_and_drop_entity_panel.html.php(100): BASE_CMP_DragAndDropEntityPanel->tplComponent(Array, Object(Smarty_Internal_Template)) #4 /home/krunch/public_html/ow_libraries/smarty3/sysplugins/smarty_internal_templatebase.php(180): content_557fa03ccd0874_50470742(Object(Smarty_Internal_Template)) #5 /home/krunch/public_html/ow_core/view_renderer.php(101): Smarty_Internal_TemplateBase->fetch('/home/krunch/pu...') #6 /home/krunch/public_html/ow_core/renderable.php(271): OW_ViewRenderer->renderTemplate('/home/krunch/pu...') #7 /home/krunch/public_html/ow_core/component.php(80): OW_Renderable->render() #8 /home/krunch/public_html/ow_system_plugins/base/controllers/component_panel.php(156): OW_Component->render() #9 /home/krunch/public_html/ow_system_plugins/base/controllers/component_panel.php(183): BASE_CTRL_ComponentPanel->action('dashboard', 1, false, Array, 'drag_and_drop_e...') #10 [internal function]: BASE_CTRL_ComponentPanel->dashboard(Array) #11 /home/krunch/public_html/ow_core/request_handler.php(266): call_user_func_array(Array, Array) #12 /home/krunch/public_html/ow_core/application.php(329): OW_RequestHandler->dispatch() #13 /home/krunch/public_html/index.php(73): OW_Application->handleRequest() #14 {main} Type: ReflectionException
Kяuncн Leader
Kяuncн Jun 20 '15
This was after trying to remove the codes, /index, /dashboard and /admin/user-dashboard pull up error 500's now, something to do with the drag and drop still being at
/admin/user-dashboard...
tammy harris
tammy harris Jun 21 '15
can this be used to add widgets to mobile site ??
kameron
kameron Nov 4 '15
DONT TAKE JEFFREYS ADVICE ....I DID AND IT JUST F&^%& UP MY SITE. SOME DING DONGS SHOULDNT GIVE ADVICE
Irena
Irena Dec 28 '16
You don't need to use the supplied method, you can just take the code and paste it into a custom widget on the dashboard and then re-name it as Add new. Use inspect element to grab the code.

example: 

<a class="ow_add_content ow_ic_files" href="http://site.com/forum/addTopic">Discussion</a>

<a class="ow_add_content ow_ic_comment" id="groups-create-582f6f3e15eba" href="http://site.com/groups/create">Group</a>

<a class="ow_add_content ow_ic_video" href="http://site.com/video/add/index/">Video</a>

<a class="ow_add_content ow_ic_calendar" href="http://site.com/event/add">Event</a>

<a class="ow_add_content ow_ic_write" id="addNewBlogPostBtn" href="http://site.com/blogs/post/new">Blog post</a>

<a class="ow_add_content ow_ic_picture" href="http://site.com/gifaction">New GIF</a>