Abhinash Jena

Send private message

You must be logged in to send a private message.

Friends

Activity

  • Abhinash Jena added a new discussion topic Message Board Error in the group Elgg Technical Support
    Suppose there are 2 users 'A' & 'B'. A writes on B's message board "Hi, B". The message actually gets posted on B's message board as 'B posted a message on B's messageboard'. The message actually gets posted as if B is writing the message but...
    • This solution is a quick work around to the problem.

      edit the file */mod/messageboard/views/default/widgets/messageboard/veiw.php

      **(Copy and paste the text in the box and paste it over the contents of the file.)


           /**
           * Elgg messageboard plugin view page
           *
           * @todo let users choose how many messages they want displayed
           *
           * @package ElggMessageBoard
           * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
           * @author Curverider Ltd <info@elgg.com>
           * @copyright Curverider Ltd 2008-2009
           * @link http://elgg.com/
           */
           
           // a couple of required variables
           
           //get the full page owner entity
           $entity = get_entity(page_owner());
          
           //the number of message to display
           $num_display = $vars['entity']->num_display;
          
           //if no num set, set to one
           if(!$num_display)
              $num_display = 5;
           
      //Just the loggedin user can send messages
      if(isloggedin()){
      ?>
          <script type="text/JavaScript">
          $(document).ready(function(){
              
              $("#postit").click(function(){
                 
                  //display the ajax loading gif at the start of the function call
                  //$('#loader').html('<img src="<?php echo $vars['url']; ?>_graphics/ajax_loader.gif" />');
                  $('#loader').html('<?php echo elgg_view('ajax/loader',array('slashes' => true)); ?>');
                 
                  //load the results back into the message board contents and remove the loading gif
                  //remember that the actual div being populated is determined on views/default/messageboard/messageboard.php    
                  $("#messageboard_wrapper").load("<?php echo $vars['url']; ?>mod/messageboard/ajax_endpoint/load.php", {messageboard_content:$("[name=message_content]").val(), pageOwner:$("[name=pageOwner]").val(), numToDisplay:<?php echo $num_display; ?>}, function(){
                              $('#loader').empty(); // remove the loading gif
                              $('[name=message_content]').val(''); // clear the input textarea
                          }); //end
                          
              }); // end of the main click function
                 
          }); //end of the document .ready function  
          </script>
         
          <div id="mb_input_wrapper"><!-- start of mb_input_wrapper div -->
         
              <!-- menu options -->
              <div id="messageboard_widget_menu">
                  <a href="<?php echo $vars['url']; ?>pg/messageboard/<?php echo get_entity(page_owner())->username; ?>">Write Message</a>
              </div>
             
              <!-- loading graphic -->
              <div id="loader" class="loading">  </div>
         
          </div><!-- end of mb_input_wrapper div -->

      <?php
      } //    if(isloggedin())
         
              //this for the first time the page loads, grab the latest 5 messages.
              $contents = $entity->getAnnotations('messageboard', $num_display, 0, 'desc');
             
              //as long as there is some content to display, display it
              if (!empty($contents)) {
                 
                  echo elgg_view('messageboard/messageboard',array('annotation' => $contents));
             
              } else {
                 
                  //put the required div on the page for the first message
                  echo "<div id=\"messageboard_wrapper\"></div>";
         
              }
         
      ?>

       

      Not the best solution but works around the problem.

      ** Also address the "Message Board error when not logged in" bug reported by rwallace

      thanks to the patch posted by pedroprez.

       

       


  • Abhinash Jena posted on Trajan's message board
  • Abhinash Jena posted on Tom's message board