Send private message

You must be logged in to send a private message.

Friends

No friends yet.

Group membership

  • Beginning Developers

    Beginning Developers

    This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking

Activity

  • Arnaud replied on the discussion topic Elgg access list - override checking
    Ok, thanks ! view reply
  • Arnaud replied on the discussion topic Elgg access list - override checking
    Hi, Thanks for your answer but that doesn't seem to work. I have an access field i try to modify elgg_view_field([ '#type' => 'access', '#label' => elgg_echo('access'),... view reply
  • Arnaud added a new discussion topic Elgg access list - override checking in the group Beginning Developers
    Hello, Is there a specific hook to override elgg acces List ? And is there a list available somewhere with all hook available (I do not see that in the documentation) ? elgg_view_field([ '#type' => 'access',...
    • Hi,

      Thanks for your answer but that doesn't seem to work.

      I have an access field i try to modify

      elgg_view_field([
          '#type' => 'access',
          '#label' => elgg_echo('access'),
          'name' => 'access_id',
          'value' => $vars['access_id'],
      ]);

      I have created a hook, but $params["entity_type"] and $params["entity_subtype"] are always NULL, so i can not check if it is the right entity i want to modify authorisations to.

       elgg_register_plugin_hook_handler('access:collections:write', 'user', 'myhook');
      
      function myhook($hook, $type, $return_value, $params)
      {
      var_dump($params);
       return $return_value;
      }

      I've tried to change the input manually with the code bellow but the public autorisation is still in the list with the message "Missing access level name" (when i create a new entity)

      $visibility_options = get_write_access_array();
        unset($visibility_options[ACCESS_PUBLIC]);
      
              echo elgg_view_field([
                  '#type' => 'access',
                  '#label' => elgg_echo('access'),
                  'name' => 'access_id',
                  'value' => $vars['access_id'],
                  'options_values' => $visibility_options,
              ]);

      Do you have an idea ?

       

    • if you don't provide the input/access with entity_subtype and/or entity_type the hook will not magically get that information.

      Look at https://github.com/Elgg/Elgg/blob/master/views/default/input/access.php

  • Arnaud replied on the discussion topic Custom Profile fields - best use
    Thanks ! view reply
  • Arnaud added a new discussion topic Multiple entity Icon in the group Beginning Developers
    Hi, I would like to upload 2 differents images for my group profile but I can not see how. Can somebody help me ? I have already read : http://learn.elgg.org/en/stable/guides/file-system.html My code is the following to save the images (in...
  • Arnaud replied on the discussion topic Custom Profile fields - best use
    Thanks, that works perfectly ! do you know if  there is a specific hook to unregister default fields ? view reply
  • Arnaud added a new discussion topic Custom Profile fields - best use in the group Beginning Developers
    Hi, Does somebody know what is the best way to add a custom field to a user profile and then get the value in a custom view ? I have added a custom field via the administration page (http://localhost/elgg/admin/appearance/profile_fields) but i...
    • Thanks, that works perfectly !

      do you know if  there is a specific hook to unregister default fields ?

    • Should work with the same plugin hook:

      function my_custom_profile_fields_handler($hook, $type, $return_value, $params) {
      
          // Following array contains the profile fields that should NOT(!!) be used
          // As example all default fields listed here - remove the WANTED fields from the array
          $profile_defaults_to_remove = array (
              'description' => 'longtext',
              'briefdescription' => 'text',
              'location' => 'location',
              'interests' => 'tags',
              'skills' => 'tags',
              'contactemail' => 'email',
              'phone' => 'text',
              'mobile' => 'text',
              'website' => 'url',
              'twitter' => 'text',
          );
      
          // Array of profile fields to be used
          $my_profile_fields = array();
          // First remove the unwanted fields
          foreach($return_value as $name => $type) {
              if (!array_key_exists($name, $profile_defaults_to_remove)) {
                  $my_profile_fields[$name] = $type;
              }
          }
      
          // Now add custom fields
          // Types of fields: 'text', 'longtext', 'tags', 'url', 'email', 'location', 'date'
          // Add to language file(s) strings for the field label(s) like 'profile:my_first_custom_profile_field' => "Label for my first custom field",
      
          $my_profile_fields['my_first_custom_profile_field'] = 'text';
          $my_profile_fields['my_second_custom_profile_field'] = 'longtext';
      
          return $my_profile_fields;
      }
  • Arnaud replied on the discussion topic Notifications in elgg
    Thanks a lot view reply