All Site Activity

  • BlackMautz added a new discussion topic Frage / Hilfe zur installation in the group Elgg Technical Support
    Hallo ihr lieben.   Ich habe versucht Elgg auf meinem Server zu instalieren. Leider bekomme ich eine Fehlermeldung gleich am Start von der .htaccess datei unzwar   Internal Server Error The server encountered an internal...
  • foka_patrick replied on the discussion topic Extend Groups Plugin ?
    this is my new action file,       <?php   /**   * Elgg groups plugin edit... view reply
  • Ben Potter joined the group Plugin Development
  • Ben Potter replied on the discussion topic Replace default "groups" and "user" avatar icons
    Awesome! Got it working. Thank you for your help!    Looking forward to being back in the elgg community.  view reply
  • RvR replied on the discussion topic Replace default "groups" and "user" avatar icons
    It has to do with the elgg-plugin.php right? Nope. Override these: elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'user_avatar_hook'); //Users'... view reply
  • RvR replied on the discussion topic Extend Groups Plugin ?
    Learn Forms+actions Good examples are Create the form for creating a new blog post and Create the action file for saving the blog post view reply
  • Ben Potter replied on the discussion topic Replace default "groups" and "user" avatar icons
    Hi Ismayil. Thanks for the response :)  I actually checked the view inspector and I found these file... view reply
  • foka_patrick added a new discussion topic Extend Groups Plugin ? in the group Plugin Development
    hello all of you, I'm going to extends the plugins groups. not the features but the edit and add form. which I have added other input fields to existing ones. but I am faced with a problem of knowing where should I record the value of the new...
    • this is my new action file,

       
       
       
      <?php
       
      /**
       
      * Elgg groups plugin edit action.
       
      *
       
      * If editing an existing group, only the "group_guid" must be submitted. All other form
       
      * elements may be omitted and the corresponding data will be left as is.
       
      *
       
      * @package ElggGroups
       
      */
       
       
       
      elgg_make_sticky_form('groups');
       
      $title = get_input('name');
       
      // Get group fields
       
      $guid = (int) get_input('group_guid');
       
      $is_new_group = false;
       
      if (!empty($guid)) {
       
      $group = get_entity($guid);
       
      if (!($group instanceof ElggGroup) || !$group->canEdit()) {
       
      return elgg_error_response(elgg_echo('actionunauthorized'));
       
      }
       
      } else {
       
      $is_new_group = true;
       
      $group = new ElggGroup();
       
       
       
      if (!$group->save()) {
       
      return elgg_error_response(elgg_echo('camerproject:save_error'));
       
      }
       
      }
       
       
       
      $user = elgg_get_logged_in_user_entity();
       
       
       
      $group->name = $title;
       
      $group->description = get_input('description');
       
      $group->progress = get_input('progress');
       
      $group->sectorindustry = get_input('sectorindustry');
       
      $group->activity = get_input('activity');
       
      $group->markettype = get_input('markettype');
       
      $group->offertype = get_input('offertype');
       
      $group->turnover = get_input('turnover');
       
      $group->currency = get_input('currency');
       
      $group->ville = get_input('location');
       
      $group->projectwebsite = get_input('projectwebsite');
       
      $group->projectblog = get_input('projectblog');
       
      $group->projectpitch = get_input('projectpitch');
       
       
       
      $group->subtype = "camerproject";
       
       
       
      // Assume we can edit or this is a new group
       
      foreach ($input as $shortname => $value) {
       
      // update access collection name if group name changes
       
      if (!$is_new_group && $shortname == 'name' && $value != $group->name) {
       
      $group_name = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
       
      $ac_name = sanitize_string(elgg_echo('groups:group') . ": " . $group_name);
       
      $acl = get_access_collection($group->group_acl);
       
      if ($acl) {
       
      // @todo Elgg api does not support updating access collection name
       
      $db_prefix = elgg_get_config('dbprefix');
       
      $query = "UPDATE {$db_prefix}access_collections SET name = '$ac_name'
       
      WHERE id = $group->group_acl";
       
      update_data($query);
       
      }
       
      }
       
       
       
      if ($value === '' && !in_array($shortname, ['name', 'description','progress','sectorindustry','activity','markettype','typemark','offertype','turnover','devise','location','projectwebsite','projectblog','projectpitch'])) {
       
      // The group profile displays all profile fields that have a value.
       
      // We don't want to display fields with empty string value, so we
       
      // remove the metadata completely.
       
      $group->deleteMetadata($shortname);
       
      continue;
       
      }
       
       
       
      $group->$shortname = $value;
       
      }
       
       
       
      // Validate create
       
      if (!$group->name) {
       
      register_error(elgg_echo("camerproject:notitle"));
       
      forward(REFERER);
       
      }
       
       
       
      // Set group tool options (only pass along saved entities)
       
      $tool_entity = !$is_new_group ? $group : null;
       
      $tool_options = groups_get_group_tool_options($tool_entity);
       
      if ($tool_options) {
       
      foreach ($tool_options as $group_option) {
       
      $option_toggle_name = $group_option->name . "_enable";
       
      $option_default = $group_option->default_on ? 'yes' : 'no';
       
      $value = get_input($option_toggle_name);
       
       
       
      // if already has option set, don't change if no submission
       
      if ($group->$option_toggle_name && $value === null) {
       
      continue;
       
      }
       
       
       
      $group->$option_toggle_name = $value ? $value : $option_default;
       
      }
       
      }
       
       
       
      // Group membership - should these be treated with same constants as access permissions?
       
      $value = get_input('membership');
       
      if ($group->membership === null || $value !== null) {
       
      $is_public_membership = ($value == ACCESS_PUBLIC);
       
      $group->membership = $is_public_membership ? ACCESS_PUBLIC : ACCESS_PRIVATE;
       
      }
       
       
       
      $group->setContentAccessMode((string)get_input('content_access_mode'));
       
       
       
      if ($is_new_group) {
       
      $group->access_id = ACCESS_PUBLIC;
       
      }
       
       
       
      $old_owner_guid = $is_new_group ? 0 : $group->owner_guid;
       
       
       
      $value = get_input('owner_guid');
       
      $new_owner_guid = ($value === null) ? $old_owner_guid : (int)$value;
       
       
       
      if (!$is_new_group && $new_owner_guid && $new_owner_guid != $old_owner_guid) {
       
      // verify new owner is member and old owner/admin is logged in
       
      if ($group->isMember(get_user($new_owner_guid)) && ($old_owner_guid == $user->guid || $user->isAdmin())) {
       
      $group->owner_guid = $new_owner_guid;
       
      if ($group->container_guid == $old_owner_guid) {
       
      // Even though this action defaults container_guid to the logged in user guid,
       
      // the group may have initially been created with a custom script that assigned
       
      // a different container entity. We want to make sure we preserve the original
       
      // container if it the group is not contained by the original owner.
       
      $group->container_guid = $new_owner_guid;
       
      }
       
       
       
      $metadata = elgg_get_metadata(array(
       
      'guid' => $group_guid,
       
      'limit' => false,
       
      ));
       
      if ($metadata) {
       
      foreach ($metadata as $md) {
       
      if ($md->owner_guid == $old_owner_guid) {
       
      $md->owner_guid = $new_owner_guid;
       
      $md->save();
       
      }
       
      }
       
      }
       
      }
       
      }
       
       
       
      if ($is_new_group) {
       
      // if new group, we need to save so group acl gets set in event handler
       
      if (!$group->save()) {
       
      register_error(elgg_echo("camerproject:save_error"));
       
      forward(REFERER);
       
      }
       
      }
       
       
       
      // Invisible group support
       
      // @todo this requires save to be called to create the acl for the group. This
       
      // is an odd requirement and should be removed. Either the acl creation happens
       
      // in the action or the visibility moves to a plugin hook
       
      if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
       
      $value = get_input('vis');
       
      if ($is_new_group || $value !== null) {
       
      $visibility = (int)$value;
       
       
       
      if ($visibility == ACCESS_PRIVATE) {
       
      // Make this group visible only to group members. We need to use
       
      // ACCESS_PRIVATE on the form and convert it to group_acl here
       
      // because new groups do not have acl until they have been saved once.
       
      $visibility = $group->group_acl;
       
       
       
      // Force all new group content to be available only to members
       
      $group->setContentAccessMode(ElggGroup::CONTENT_ACCESS_MODE_MEMBERS_ONLY);
       
      }
       
       
       
      $group->access_id = $visibility;
       
      }
       
      }
       
       
       
      if (!$group->save()) {
       
      register_error(elgg_echo("camerproject:save_error"));
       
      forward(REFERER);
       
      }
       
       
       
      // group saved so clear sticky form
       
      elgg_clear_sticky_form('groups');
       
       
       
      // group creator needs to be member of new group and river entry created
       
      if ($is_new_group) {
       
       
       
      // @todo this should not be necessary...
       
      elgg_set_page_owner_guid($group->guid);
       
       
       
      $group->join($user);
       
      elgg_create_river_item(array(
       
      'view' => 'river/group/create',
       
      'action_type' => 'create',
       
      'subject_guid' => $user->guid,
       
      'object_guid' => $group->guid,
       
      ));
       
      }
       
       
       
      $has_uploaded_icon = (!empty($_FILES['icon']['type']) && substr_count($_FILES['icon']['type'], 'image/'));
       
       
       
      if ($has_uploaded_icon) {
       
      $filehandler = new ElggFile();
       
      $filehandler->owner_guid = $group->owner_guid;
       
      $filehandler->setFilename("groups/$group->guid.jpg");
       
      $filehandler->open("write");
       
      $filehandler->write(get_uploaded_file('icon'));
       
      $filehandler->close();
       
       
       
      if ($filehandler->exists()) {
       
      // Non existent file throws exception
       
      $group->saveIconFromElggFile($filehandler);
       
      }
       
      }
       
       
       
      system_message(elgg_echo("camerproject:saved"));
       
       
      forward($group->getUrl());

       

      but nothing is change, it save just old attribut but the new nothing. Please help me

    • nobody help me here. if it's not possible to do like that just tell me. i will see how can do or choose other thing

    • No one will teach you unless you want to learn. Read docs. There's all clear

  • NC NS NT : for a responsive interest based social network with a mobile app A social network for activity based community with an iOS & Android hybrid mobile app.  
  • 4ika joined the group Professional Services
  • Ismayil Khayredinov replied on the discussion topic Replace default "groups" and "user" avatar icons
    Don't delete anything. Icons are in the view system these days, so you should be able to replace them in a plugin just like any other view. Enable the developers plugin and you will see how file locations map to view names in View inspector view reply
  • foka_patrick replied on the discussion topic Replace default "groups" and "user" avatar icons
    in the root of plugin you  will see graphics folder, in this folder you have default icon of groups. delete it and put your own on the same name  view reply
  • Ben Potter added a new discussion topic Replace default "groups" and "user" avatar icons in the group Beginning Developers
    Hey everybody. I am looking to replace the default "groups" and "user" icon through a plugin, but it looks like the icons are handled a special way (especially for group). I found this old...
    • Hi Ismayil. Thanks for the response :) 

      I actually checked the view inspector and I found these file locations:

      groups/defaultlarge.gif 500 mod/groups/graphics/defaultlarge.gif
      groups/defaultmedium.gif 500 mod/groups/graphics/defaultmedium.gif
      groups/defaultsmall.gif 500 mod/groups/graphics/defaultsmall.gif
      groups/defaulttiny.gif 500

      mod/groups/graphics/defaulttiny.gif

      I'm still a little thrown off because they aren't in the views/ folder of the groups plugin so I don't know how I would go about overriding it in a different plugin. It has to do with the elgg-plugin.php right?

    • It has to do with the elgg-plugin.php right?

      Nope.

      Override these:

      elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'user_avatar_hook'); //Users' icons
      
      elgg_register_plugin_hook_handler('entity:icon:url', 'group', 'groups_set_icon_url'); //Groups' icons

      in start.php of your own plugin.

      Learn more on http://learn.elgg.org/en/stable/guides/hooks-list.html#other - - entity:icon:url section

    • Awesome! Got it working. Thank you for your help! 

       

      Looking forward to being back in the elgg community.