Hibernator

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
  • Elgg Spain

    Elgg Spain

    Elgg Spain - Elgg España | Grupo español de usuarios Elgg

Activity

  • Hibernator replied on the discussion topic Show error messages
    Thanks for your fast response! My index page is completely a new view and although it might be better to use RVR approach, as I don't have much time to do the index from scratch using elgg views, I have used Rogit Gupta solution. I will... view reply
  • Hibernator joined the group Elgg Spain
  • Hibernator added a new discussion topic Show error messages in the group Beginning Developers
    Hi everybody! I just started to develop my elgg application and I was wondering how to show error messages. I have been reading the documentation but I didn't find how to show error messages. Particularly, I have used the custom_index plugin...
    • Coz you hasn't using elgg_view_layout() and form view

      Just look at custom index construction:

      //grab the login form
      $login = elgg_view("core/account/login_box");
      
      // lay out the content
      $params = array(
          'login' => $login,
      );
      
      $body = elgg_view_layout('custom_index', $params);
      
      echo elgg_view_page('', $body);

       

    • I also struggled for the same thing for 3-4 days and then finally found a solution.

      1. On top of your php file add the following code:

      $system_messages = _elgg_services()->systemMessages->dumpRegister();
      system_messages(null, "");

      2. Now add the following code where you want to display the error message:

      if (isset($system_messages['error'])) {
          foreach($system_messages['error'] as $sysmsg){
              echo "<b><font color='red'>$sysmsg</font><b>";
          }
      }
      if (isset($system_messages['success'])) {
          foreach($system_messages['success'] as $sysmsg){
              echo "<b><font color='green'>$sysmsg</font></b>";
          }
      }
      

      Note:

      1. I have tried and tested this in elgg 1.12. Not sure if this will work on any other version or not.
      2. This will not display the error/success message as popups that is normally shown in elgg but rather as text which will be part of your content on your webpage.
    • Thanks for your fast response!

      My index page is completely a new view and although it might be better to use RVR approach, as I don't have much time to do the index from scratch using elgg views, I have used Rogit Gupta solution.

      I will keep in touch for my next doubts or suggestions :)