Recent Topics

1 Mar 14, 2012 03:01    

Is there a way to limit # of widget instances, like there is on plugins ? $number_of_installs

kinda OT: How to use widget id in widget name field. ( to avoid conflict of the same instances of the widget coming from the same plugin.

2 Mar 16, 2012 14:21

There's no easy way. If you really need to limit it, run this query to find out the total number of instances installed, and fire an error.

$x = $DB->get_var('SELECT COUNT(*) wi_ID FROM T_widgets WHERE wi_code = "my-widget-code"');
if( $x > 5 )
{
    $this->msg('Stop adding this widget!', 'error');
}

The problem is that there's no plugin event to hook up to in b2evo v4. It's only available in b2evo 5 :( So you may have to run this code in SessionLoaded and only on widget add request in backoffice.

3 Mar 17, 2012 00:36

sounds like this v5 is going to be very flexible (:


Form is loading...