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

  • 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.

       

  • Reuven replied on the discussion topic Error handler
    Thank you @Jerome However, I do not know how to use it. Could you please give me some guidance. Thank you very much. view reply
  • Reuven replied on the discussion topic Error message in the comment
    Thank you @Jerome. All is well that ends well :) However, IMHO it would be good to write "Display PHP errors" instead of "Display fatal PHP errors". Anyway, Thanks a lot. view reply
  • Reuven replied on the discussion topic Error message in the comment
    Thank you @Jerome Please see below my settings. According to these setting I should not get strict notifications on the screen - I think :) Developers : Settings Control your development and debugging settings below. Some of... view reply
  • Reuven replied on the discussion topic Error message in the comment
    This is the problem. It appears on the screen, on the wall inside one comment. I'm not 100% sure when it happened. It seems right after Flush the caches and disappeared after page refresh. view reply
  • Reuven replied on the discussion topic Error handler
    Thank you view reply
  • Reuven replied on the discussion topic Error handler
    Thank you RvR. Does the 404 view respond to all types of php errors or only to wrong addresses? view reply
  • Reuven replied on the discussion topic Error message in the comment
    Sorry for not handling this issue for long time. I was busy with other projects. In the default .htaccess of my Elgg site it is written:  php_value display_errors 0 I understand that this directive stop all errors... view reply