Reuven

About me: Amateur web developer - Professional volunteer :)

Send private message

You must be logged in to send a private message.

Friends

No friends yet.

Group membership

Activity

  • Tank you but the problem is that the monthly cron is not triggered view reply
  • Elgg 2.3.13 I receive the following error on my-site/cron/monthly/ Any suggestion how to fix? Thank you An exception occurred while executing 'ALTER TABLE elgg_system_log_1573844974 engine=archive': SQLSTATE[42000]: Syntax...
  • Reuven replied on the discussion topic How to override vendor/elgg/elgg/js/lib/ui.js
    Works great. Thank you very much dear RVR view reply
  • Reuven added a new discussion topic How to override vendor/elgg/elgg/js/lib/ui.js in the group Plugin Development
    Elgg 2.3.13 In my plugin I need to to override vendor/elgg/elgg/js/lib/ui.js  How to do it Thank you
    • Copy this file from:

      vendor\elgg\elgg\views\default\elgg.js.php

      To your custom plugin:

      \mod\my_plugin\views\default\elgg.js.php

      Comment this:

      $elggDir->getPath("js/lib/ui.js"),

      Add after:

      foreach ($files as $file) {
         readfile($file);
         // putting a new line between the files to address https://github.com/elgg/elgg/issues/3081
         echo "\n";
      }
      

      Path to your custom ui.js (e.g. \mod\my_plugin\views\default\lib\ui.js):

      readfile(dirname(__FILE__). '/lib/ui.js');
      echo "\n";

      Clean the caches.

      Done.

    • Works great.

      Thank you very much dear RVR

  • Reuven replied on the discussion topic Using OEmbed, but doesn't display a preview
    Oembed works on the output. You'll see the video after save. view reply
  • Reuven added a new discussion topic RSS creates Fatal error in the group Plugin Development
    Elgg 2.3.13 RSS works fine on all pages except on activity (river) page , which return the following fatal error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in...
  • Reuven replied on the discussion topic Fake registrations
    Have you tried Captcha? If the spammer is not too sophisticated it might help. https://elgg.org/plugins/914006   view reply
  • Reuven replied on the discussion topic Need to call menu hook twice
    All is well that ends well Now everything works well and makes sense. Thank you very much Jerome for your help..... and patience :) view reply
  • Reuven replied on the discussion topic Need to call menu hook twice
    Thank you Jerome. Below is my code. It behaves strangely. Hope you find my mistake. //======== In start.php ========== elgg_register_event_handler('init', 'system', 'title_menu_init'); function... view reply
  • Reuven replied on the discussion topic Need to call menu hook twice
    Thank you Jerome, works perfect. However, for the getSections() (in the following code) to give the right results I still need to call $title_menu twice. If not, the results of count($sections,1) and count($sections,0)... view reply
  • Reuven replied on the discussion topic Need to call menu hook twice
    Elgg 2.3.13 view reply
  • Reuven added a new discussion topic Need to call menu hook twice in the group Plugin Development
    I have the following code in start.php elgg_register_plugin_hook_handler('register', 'menu:title', 'title_menu_handler'); -------------------- function title_menu_handler($hook, $type, $items, $params) {...
    • Thank you Jerome. Below is my code.

      It behaves strangely. Hope you find my mistake.

      //======== In start.php ==========
      elgg_register_event_handler('init', 'system', 'title_menu_init');
      
      function title_menu_init() {
          elgg_register_plugin_hook_handler('register', 'menu:title', 'title_menu_handler');
      }
      
      function title_menu_handler($hook, $type, $items, $params) {
      
           $unregister = array("groups:edit", "groups:invite", "edit:icon", "edit:cover");
      
           $owner = elgg_get_page_owner_entity();
      
            if($owner->type == 'group') {
      
                  foreach ($items as $item) {
      
                       $item_name = $item->getName();
      
                       if (in_array($item_name, $unregister)) {
      
                            elgg_unregister_menu_item('title', $item_name);
      
                        } 
      
                   }
      
                  return $items;
      
             }
      
      }
      
      //======== In the view ========
      
      $title_menu = elgg()->menus->getMenu('title', $params);// Trigger the hook
      
      $title_menu = elgg()->menus->getMenu('title', $params);//== need to call twice to get the menu structure after triggering the hook
      
      $sections = $title_menu->getSections();
      
      $diff = count($sections,1) - count($sections,0);
      
      if ($diff > 0) :
      
      ?>
      
      <a class="title-button-nav" rel="toggle" data-toggle-selector=".title-menu-panel" href="#">
      
      <?= elgg_view_icon('cog'); ?> 
      
      </a>
      
      <?php endif; ?>
      
      <nav id="ram-title" class="title-menu-panel" role="navigation">
      
      <?php echo elgg_view_menu('title', array('sort_by' => 'priority')); ?>
      
      </nav>
    • Like i said in my earlier comment, you need to unset the item from $items like this:

      foreach ($items as $index => $item) {
      
                       $item_name = $item->getName();
      
                       if (in_array($item_name, $unregister)) {
      
                            unset($items[$index]);
      
                        } 
      
                   }

      Don't call elgg_unregister_menu_item in the hooks they don't have any effect.

    • All is well that ends well

      Now everything works well and makes sense.

      Thank you very much Jerome for your help..... and patience :)

  • Reuven replied on the discussion topic Menu issue
    I understand. Thank you view reply
  • Reuven added a new discussion topic Menu issue in the group Plugin Development
    Elgg 2.3.13   I'd like to make some changes to the 'title' menu (the code below). It works well with 'menu:owner_block'. However, with 'menu:title' I receive an error: Fatal error:  Call to a...
    • In the title menu there isn't necessarily an 'entity' in params, that's the error.

      Also 'title' menu which is used by many plugins is not found in the developer tools

      That's because in order to show information there we have to fake some menu's but the title menu has to many variables on order to fake correctly.

      Lot's of menu items are dependent on page owner, context or something else.

    • I understand.

      Thank you

  • Reuven replied on the discussion topic Where is the reference for Elgg 2.3 ?
    This is very useful comment for me. I'll start to learn and work with Eclipse IDE. Thank you Jerome. view reply
  • Reuven replied on the discussion topic Where is the reference for Elgg 2.3 ?
    Thank you iionly view reply
  • Reuven added a new discussion topic Where is the reference for Elgg 2.3 ? in the group Plugin Development
    The reference http://reference.elgg.org is for Elgg  Version 3.0. Where is the reference for Elgg 2.3 ? Thanks    
    • Out of curiosity why do you use reference.elgg.org?

      Since I setup Elgg in my IDE (Eclipse) I have autocomplete on all functions and I can click on a function to go to that function and read the documentation.

      Before we had Eclipse setup correctly we used the reference extensively, but after the setup we never looked at it again.

    • This is very useful comment for me.

      I'll start to learn and work with Eclipse IDE.

      Thank you Jerome.

  • Reuven replied on the discussion topic Chang the display of username to display name
    Thank you Jerome.   view reply
  • Reuven replied on the discussion topic Chang the display of username to display name
    Thank you Jerome, Yes, you are right. So far I found the username only in 2 cases: The Wire and a theme that I use, which I can handle. However, exposing the username (e.g. in the URL) might be not the best security approach.  In... view reply
  • Reuven added a new discussion topic Chang the display of username to display name in the group Plugin Development
    Elgg 2.3.13 In our site we want to hide the username and expose only the "Display Name". Is it a way to change all the instances where the username appears (on screen and in emails) to the Display Name, or we have to do it one...
    • Thank you Jerome,

      Yes, you are right. So far I found the username only in 2 cases: The Wire and a theme that I use, which I can handle.

      However, exposing the username (e.g. in the URL) might be not the best security approach. 

      In order not to cause massive problems in the internals of core and every plugin we thought about the following approach:

      1. Add to  elggss_users_entity table column "real_username" which includes the username. This column will be used during registration and login.
      2. The username column will include a unique string (maybe some variation of the user GUID). It will be populated during registration.

      In this way there is no need to change the plugins and the URL will include only the unique string, not the username. The only change should be done to the registration/login proccess.

      What is your opinion?

      Thank you

    • However, exposing the username (e.g. in the URL) might be not the best security approach. 

      Why? Because with this you already have half of the credentials required to login? Maybe, but lots of websites use this approach.

      1. Add to  elggss_users_entity table column "real_username" which includes the username. This column will be used during registration and login.
      2. The username column will include a unique string (maybe some variation of the user GUID). It will be populated during registration.

      What is your opinion?

      Seams like a lot of work for little gain.

    • Thank you Jerome.