Send private message

You must be logged in to send a private message.

Friends

No friends yet.

Group membership

Activity

  • TCB replied on the discussion topic Blog library override
    Thanks RvR... I think we posted at the same time.  I had figured after playing around with the code last night that I could override the views to accomplish what I needed to do but I will look at your solution to guide me through some of the... view reply
  • TCB added a new discussion topic Blog library override in the group General Discussion
    Hi, I'm using elgg 2.3.14 and looking for some advice on how to change the behavior of the bundled blog plugin.  What I'm trying to do: When loading the blog view, for each blog entry I need to make a rest call to a...
    • Override views which calls this function:

      mod\blog\views\default\resources\blog\all.php
      mod\blog\views\default\resources\blog\group.php
      mod\blog\views\default\resources\blog\owner.php

      You can use this hook also:

      $options = [
          'type' => 'object',
          'subtype' => 'blog',
          'distinct' => false,
          'no_results' => elgg_echo('blog:none'),
      ];
      
      $viewer = function ($entities, $options) {
          return theme_elgg_view_entity_list($entities, $options);
      };
      
      echo elgg_list_entities($options, 'elgg_get_entities', $viewer);
       
      Where theme_elgg_view_entity_list is your custom function to view entities, e.g.:
       
      function theme_elgg_view_entity_list($entities, array $vars = array()) {
          $offset = (int)get_input('offset', 0);
      
          // list type can be passed as request parameter
          $list_type = get_input('list_type', 'custom_type');
      
          $defaults = [
             'items' => $entities,
             'list_class' => 'custom_class',
             'full_view' => true,
             'pagination' => true,
             'list_type' => 'custom_type',
             'list_type_toggle' => false,
             'offset' => $offset,
             'limit' => null,
         ];
      
         $vars = array_merge($defaults, $vars);
      
         if (!$vars["limit"] && !$vars["offset"]) {
           // no need for pagination if listing is unlimited
           $vars["pagination"] = false;
         }
      
         return elgg_view('page/components/custom_view', $vars);
      }

      Or add any callback which you want to use.

    • Thanks RvR... I think we posted at the same time.  I had figured after playing around with the code last night that I could override the views to accomplish what I needed to do but I will look at your solution to guide me through some of the parts I haven't figured out yet.

  • TCB replied on the discussion topic Changing the color of a menu icon
    Dangit.. why do I keep forgetting about flushing the caches.. that was all I needed to do after the update.  Thanks. view reply
  • TCB added a new discussion topic Changing the color of a menu icon in the group General Discussion
    Using Elgg 2.3.4 I'm trying to override the default color of an icon.  When viewing the page and checking the style in the Chrome dev console, I see the style is set to : .fa-check:before { content:...
    • Why you not checked this in the Chrome Developer directly before changing Elgg CSS file?

      Of course, this will not work bcz:

      1 - .fa-check {color:green}

      2 - Need to run flush the caches

      3 - Learn how to customize CSS

    • Dangit.. why do I keep forgetting about flushing the caches.. that was all I needed to do after the update.  Thanks.

  • TCB replied on the discussion topic Adding item in an Entity menu
    Ah.. ok.  Thank you.. that worked! view reply
  • TCB replied on the discussion topic Adding item in an Entity menu
    Thanks RvR,  I understand how to add to the menu types like 'topbar', 'site', and 'page'.  I know that I need to add an item to an 'entity' menu... specifically the blog and comment entities. ... view reply
  • TCB added a new discussion topic Adding item in an Entity menu in the group General Discussion
    Hi, I'm using Elgg 2.3.4 and working on adding a 'verify' menu item to an entity menu, blogs and comments to start, but eventually for any type of 'save' action.  I want this item to appear after the 'Like'...
    • Thanks RvR, 

      I understand how to add to the menu types like 'topbar', 'site', and 'page'.  I know that I need to add an item to an 'entity' menu... specifically the blog and comment entities.  It wasn't obvious to me how to do this from reading the docs.  So I assume I can do this in my start.php:

      elgg_register_plugin_hook_handler('register', 'menu:entity', 'my_entity_menu_handler');
      
      then
      
      function my_entity_menu_handler($hook, $type, $items, $params) {
          $entity = $params['entity'];
          $handler = elgg_extract('handler', $params, false);
          if ($handler === 'blog') {
              // do something here to add a new menu item.
              elgg_register_menu_item(???)
          }
      }
      
      ​
    • Almost...

      Instead of elgg_register_menu_item() use the ElggMenuItem class:

      $items[] = \ElggMenuItem::factory([
             'name' => 'register',
             'href' => elgg_get_registration_url(),
             'text' => elgg_echo('register'),
             'title' => elgg_echo('register'),
             'priority' => 200,
      ]);
       
      At the end your function:
       
      return $items;
    • Ah.. ok.  Thank you.. that worked!

  • TCB replied on the discussion topic customize blog plugin
    Thanks Jerome.. I did read the docs but I was a little confused about how to override an action that is part of a bundled plugin.  I wasn't sure if it was the same as registering a new action from scratch. view reply