My Ultimate Cool Theme Remove the Add Widget Button

Hi I need some help with working on My Ultmate Cool Theme what I need to do is removed the "Add Widget" Button from the dashboard but leave it on the user profiles and groups.

I have done some hunting and found a way to turn them off compleatly but I want the users to be able to use widgets on there profile pages and with in groups.

If you know of a way to do this please let me know.

  • What about elgg_in_context ?

    if(elgg_in_context('dashboard')) {

    return false;

    }

  • @RVR Where would that pice of code go????? Would it replace the one which I commment out to remove it from the whole site?

     

  • There's 2 ways:

    1 - Add 'show_add_widgets' => false, in array for widget parameters on your 'dashboard' page

    2 - Show your widget code with the existing arrays but set limit for showing add widgets button on dashboard like as:

    if(elgg_in_context('dashboard')) {

      $params = array(
            'num_columns' => 3,
            'exact_match' => true,
            'show_add_widgets' => false,
        );

    }

    Add it in start.php of your theme

  • This just does not seam to want to work for me grr.

  • Find this file:

    \views\default\page\layouts\widgets\add_button.php

    Edit it to:

    <?php
    /**
     * Button area for showing the add widgets panel
     */
    if(elgg_in_context('groups')||elgg_in_context('profile')){
        echo "<div class=\"elgg-widget-add-control\">";
        echo elgg_view('output/url', array(
            'href' => '#widgets-add-panel',
            'text' => elgg_echo('widgets:add'),
            'class' => 'elgg-button elgg-button-action',
            'rel' => 'toggle',
            'is_trusted' => true,
        ));
        echo "</div>";
    }
    ?>

    This is the way I have done. It works well, but I don't ensure that is the best way.