Remove duplicate profile widgets


I'm using the Widget Plus plugin that let me propagate a specific widget config to all my users (they have a fixed dashboard, they can't change widgets).

But if i deploy a new config it adds to the old one, thus creating duplicate widgets everywhere :-(

Is there a simple way to forbid the display of duplicate widgets ?

  • I suspect I can force that by altering this specific part of code in widgets.php, but sadly I'm not a php wizard :-(

      <?php  $rightcolumn_widgets = "";
                if (is_array($area3widgets) && sizeof($area3widgets) > 0) {
                    foreach($area3widgets as $widget) {
                        if (!empty($rightcolumn_widgets)) {
                            $rightcolumn_widgets .= "::";
                        $rightcolumn_widgets .= "{$widget->handler}::{$widget->getGUID()}";

  • I'd modify the plugin that is pushing the additional widgets to the profile pages. There are widgets that can be added multiple times so stripping out all duplicates sounds like a bad idea. If you want to learn how to remove widgets programmatically, take a look at my remove widgets plugin.

  • @netking and cash, I think there is a plugin available in the community, which will remove the widgets from the listing once the user adds them to their profile. i forgot the exact name and link. but its not too old. 

  • @team, yes I saw that one, but my problem is different as my users don't have access to the draggable widgets.

    @cash call me big brother if you like :-) but I want to control the layout for my users (I get that it might sound stupid considering the time elgg core team spent building the feature).

    Anyway, in my case, excluding duplicates from profiles would be the best solution...

    I'll have a look to your remove widgets plugin, maybe it can help me :-)

    Thanks anyway guys

  • Tried cash wipe out plugin, works like a charm...

    Problem is my plugin for widgets propagation doesn't seems to work afterwards...

    All my profiles are dead empty :-(

    Hopefully my users are likely sleeping right now... Heading to the coffee machine :-D

  • @cash do your plugin in any way forbid to reuse the deleted widgets ???

  • Just looked through the code and it doesn't prevent widgets from being used again. All it does it delete the current widgets when you run it. Did you modify any other code that could cause your issue?

  • No :-(

    I'm was using the widget plus plugin that was over propagating my widgets to all users (meaning adding layers of the same widgets if already in use).

    You're remove plugin was perfect > cleaning all profiles to blank, then propagate a set of widgets...

    Except that it (widget plus) doesn't propagate anything anymore and all my profiles stays blanks...

    It says everything went ok though, and was working perfect seconds before...

    That's why I was asking this question...

  • Haaaa Yes !!

    Worked it out : the Widget Plus would only propagate locked widgets...

    Change that status and now it's just rollin'

    I can drive my users pages layout whatever I want, I'm the king, yeahhh !!!

    (just kiddin, that fixed layout is a client demand)