Plugin: Default Widgets (full) v1.1

Release Notes

Hi here is the default widgets plugin that allows you to specify defaults widgets on all new users profile and/or dashboard.

Diego Ramirez has also updated the code for a more easier widget configuration.

I would also like to say that I honestly do not agree with direct mysql manipulation contained within this code.
Chad directly accesses the database to be able to alter and define the default number of items to display for each respective widget.  I personally think the much less intrusive way to do this would be to simply define a "default" value within the actual widget itself when the widget checks and returns no previously stored value for the user.

The benefits here would be:

  • Default widgets plugin woud be reduced to HALF the current size. (I don't like bloated code)
  • No direct manupulation of the database
  • No extra database calls at all.
  • Does not set extra user metadata (the metadata tables will get bigger )
  • If default settings are specified within each  widget, and the user likes these settings, no metadata will ever need to be set for the user to maintain these settings.

Overall I conclude that specifying defaults within the actual plugin is a whole lot leaner than this current method.
Since in both cases you still have to make actual code modifications, I will officially endorse using the the leaner method.

Please write to my wall if you disagree etc . Also i will be updated my lean version with Diegos updates shortly. Untill then
you can download the lean version (without Diegos mods) at : http://tastyseed.com/website-22/Elgg-default-widgets-plugin

 

  • Thanks for this.  It quite elegantly solved my problem.  Any plans for an admin GUI?

  • You saved my time, Thanks! :P
    I can work to something other now, the list is long.

    Anyway, since that you're working on widgets, have you notice when you use a widget and edit your profile page again, the widget is still in the widget gallery? both on the widget area where you stored it and in the gallery.

    I'd like to remove used widgets from the widget gallery. Is it easy?

  • I am a little confused with the instructions.txt.  Where exactly do I edit/add the items I want and where I want them?

     

     

  • I have the same question as Matt Holmen.  I'm assuming we have to add the $profile_handler and the $dashboard_handler functions to the start.php file ourselves.

    @Jade, can you modify this widget a tiny bit and put commented out examples of the variables into the start.php?  Or just point the way to where to make the changes?

    Thanks,

    sr123

  • Okay, figured it out... pretty simple:

    Since the $profile_handler and $dashboard_handler variables aren't actually in the start.php when downloaded, you have to add them.  So far I just added some default widgets to my site's profile by adding the lines in bold below start.php, right under the EDITING INSTRUCTIONS comment:

     

    /* EDITING INSTRUCTIONS
     please see the instruction manual supplied in the plugin folder
     */


    $profile_handler = array("friends","river_widget_friends","messageboard","river_widget","status","a_users_groups","bookmarks","filerepo");
    $profile_column = array(1,1,2,2,3,3,3,3);

    I created these arrays based on the instructions provided with the plugin....

    Now I want to look into how to get other widgets that are not listed in the list of widgets you can use with this default_widgets plugin to work with it....

     

  • doh... I think I jumped the gun on this.

     

    I'm seeing strange behavior from this plugin.  When I add the variables as outlined in my post above, I do get a set of default widgets on my profile, except they are not in the positions I specified them to be in, and some of them are missing!  It also seems to cause the friends widget to appear on the dashboard, even though I didn't even set the $dashboard_handler and $dashboard_column variables (strange!).


    When I comment out the $profile_handler and $profile_column arrays above but leave the default_widget widget activated, when a new user registers no widgets appear on either the dashboard or the profile.  But when I put the above lines back into the start.php I do get some default widgets, things revert back to the strange behavior I described in the previous paragraph.

     

    I'm not happy... I really need this functionality... :(

  • take a look at the following code from start.php (the last line was added by me - and this worked so far for me):

    function AutoAdd_init(){
      global $CONFIG;

      register_elgg_event_handler('create', 'user', 'AutoAddWidgets');

      add_default_widget("status",array("profile_column"=>3));
      add_default_widget("friends",array("profile_column"=>3,"num_display"=>10));
      add_default_widget("a_users_groups",array("profile_column"=>3,"num_display"=>5));
      add_default_widget("river_widget",array("profile_column"=>1,"num_display"=>8));
      add_default_widget("messageboard",array("profile_column"=>2,"num_display"=>5));
      add_default_widget("river_widget_friends",array("dashboard_column"=>1,"num_display"=>8));
      add_default_widget("filerepo",array("dashboard_column"=>2,"num_display"=>8));
    }

  • Ro

    Jade, I am using another mod called autosubscribegroup.  It did work until I started using default_widgets.  Is there something I need to do to get these two to play nicely?  I hope for an easy, effective quick fix.

  • Ro

    Your mod gets the groups widget on the profile, but there is no group auto subscribed when the user logs in after registration.  I need for the autosubscribegroup mod to work too.

  • Ro

    Okay, I figured out the whole autosubscribegroup finally!  I didn't realize that you need to actually put the guid in, instead of the name (user ID) of the group!  So, now they are getting autosubscribed to a group and the be_tom mod is working too!

    Generally speaking, I am happy with the default widgets mod, but I would like more explanation as to how to get more widgets displaying on the dashboard in particular and more settings to add for each of them too.

  • @antifmradio - a version of this is included with Elgg 1.5 now so you don't need this plugin anymore

  • ok i posted in the main discussion but got no reply im having an issues where multiple default widgets are showing. as in two blog widgets for example. I tried removing the plugin and re enabloing it. the interface shows no widgets but it still seems to add widgets. and duplicated at that. Im assuming the setting is saved in the databse and there are duplicate entries any idea how to fix this issue.. i dont mind manually removing the db entries just need to know where to look. thanks..

  • @madshark - Elgg 1.5 included a default widgets plugin that is different from this one. You are looking in the wrong place for help. One of the general forums is the place to look.

  • Its been long time since we didn't here anything from you. Loved your work. Hope you will be back to elgg soon.

    Make Friends Online

  • It seems that the plugin doesn't work in elgg 1.6.1

  • Users who want to use the regular gui and include widget settings with their default widgets can check out my latest plugin Widgets Plus! Includes marking some as locked to prevent editing while allowing your members to add others.

  • Hello,

    I'm trying to set default layout of profiles. I do it as admin then when a new user logs in for the first time via CAS, some of the widgets I've added to default design appear on their profile page but the widgets I've developed (simple as Hello World) doesn't appear. I've tried everything but couldn't solve this.

    When person adds those widgets by themselves, they appear normally. But I couldn't make them appear as default.

    Any suggestions?

    Thanks

  • Darkwaltz4 's Widgets Plus! works perfectly. Thanks for that plugin.

Jade

100% tangible or 100% useless

Stats

  • Category: Uncategorized
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 5077
  • Recommendations: 1

Other Projects

View Jade's plugins