avidgamer123

About me:
Email:

Send private message

You must be logged in to send a private message.

Activity

  • avidgamer123 added a new discussion topic Deleting a Group in the group Plugin Development
    Hey, I know topics somewhat similar to this have been created, but they all seem super outdated.  I have not changed my groups plugin, so I think this is an issue not created by me (unless I have some hook causing it).  When I go to delete...
  • avidgamer123 replied on the discussion topic Overwrite ElggGroup Function
    Do I need to declare Achievement as a new enitity type as well in my start.php? view reply
  • avidgamer123 replied on the discussion topic Overwrite ElggGroup Function
    Ok, so I must have been out of it when I wrote this... geez. Anyways, it still doesn't work.  I have put a die('crap'); statement at the beginning of the function and it doesn't get called...  So, my leave function must not even be called,... view reply
  • avidgamer123 replied on the discussion topic Overwrite ElggGroup Function
    HAHAHA.... Well it sure does help to have a second pair of eyes sometimes!  I fixed that and still have the same problem. :( view reply
  • avidgamer123 added a new discussion topic Overwrite ElggGroup Function in the group Plugin Development
    I just want to overwrite an ElggGroup function (the 'leave()' function).  Right now, it works (user can't leave) if I have the user join and leave in the same file, but if I wait until the user joins (say through the groups page), and then they...
    • <?php
      class            Achievement
              extends    ElggGroup
      {
          ////////////////////////////////////////
          function __contruct($guid = null)
          {
              parent::__construct($guid);
          }//function __contruct($guid = null)
          ////////////////////////////////////////
          function leave($user, $force_stay = false)
          {
              if ($force_stay)
              {
                  display_message('You Cannot Leave an Achievement.');
                  return false;
              }
              else
              {
                  display_message('OK You Left an Achievement.');
                  parent::leave($user);// Where does this logic go to ???
              }//if ($force_stay)
          }//function leave($user, $force_stay = false)
          ////////////////////////////////////////
      }
      ?>

    • Ok, so I must have been out of it when I wrote this... geez. Anyways, it still doesn't work.  I have put a die('crap'); statement at the beginning of the function and it doesn't get called...  So, my leave function must not even be called, right? 

      As for this:

      parent::leave($user);// Where does this logic go to ???

      This calls the original leave(ElggUser) function defined in the Elgg core system.  Since $force_stay is false, the user is allowed to leave the group. 

       

      I just noticed that the name of $force_stay should be $can_leave.  I want to have the original leave() function work fine, so $achv->leave($user) works like before, but if you do $achv->leave($user, true), the user cannot leave the group.  Here is exactly what I have in that file now:

       

      <?php

      // Achievement class

      class Achievement extends ElggGroup {

              function __contruct($guid = null) {
                      parent::__construct($guid);
              }

              function leave($user, $can_leave = false) {

                      die('crap');

                      if ($can_leave) {
                              echo 'The user is leaving the group';
                              parent::leave($user);
                      } else {
                              echo 'The user is forced to stay in the group';
                              return false;
                              //display_message('You cannot leave an achievement.');
                      }
                      die('end');
              }
      }


    • Do I need to declare Achievement as a new enitity type as well in my start.php?

  • avidgamer123 replied on the discussion topic Object Data and Metadata
    Thanks Brett! I completely missed that second page apparently!  Sorry for the nub question. view reply
  • avidgamer123 added a new discussion topic Object Data and Metadata in the group General Discussion
    I am curious about how data is handled and then stored when creating a new instance of an entity in Elgg.  For example, if I create a new ElggEntity, and do something like this:   $entity = new ElggEntity(); $entity->title = 'Test...

Group membership

Pages

No pages created yet