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

First widget | Forum

Sean
Sean Sep 12 '13
Hi guys,


I'm looking for a bit of help. I've developed several plugins since using OXWALL, all custom for what my site needs to do and I've picked it up pretty well.


However I've not developed a profile widget yet, and this is something I now need to do. I realise I need to create controllers in the 'components' folder and then the .html views as well, but apart from that I am at a loss.


I've analysed the code of some existing widgets, but no matter what I do I cant seem to get mine to show up in the customise profile screen to add the widget.


Is there a crash course guide for widgets, similar to the plugin one? Or can anyone push me in the right direction?


Thanks,

Damien
Damien Sep 12 '13

Excuse my English.

For your question, you must activate your widget to be visible.

For that, you have to add in the "activate.php" file:


$widget = BOL_ComponentAdminService::getInstance()->addWidget( 'PLUGIN_CMP_Widget', true );$placeWidget = BOL_ComponentAdminService::getInstance()->addWidgetToPlace( $widget, BOL_ComponentAdminService::PLACE_PROFILE);BOL_ComponentAdminService::getInstance()->addWidgetToPosition( $placeWidget, BOL_ComponentAdminService::SECTION_LEFT, 0 );


And in "deactivate.php" :


BOL_ComponentAdminService::getInstance()->deleteWidget( 'PLUGIN_CMP_Widget' );

Sean
Sean Sep 12 '13
Thank you so much, I will give this a try! 
Sean
Sean Sep 13 '13
Damien, this worked great, thank you! 


I have one last question now, how would I get the user ID of the current profile I'm looking at? The widget will need to change content depending on the current profile that's being viewed.

Sean
Sean Sep 13 '13
Don't worry, I figures it out :)


Thank you for your help with the first issue!