elggnoob1

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

Activity

  • elggnoob1 added a new discussion topic Calling an action without clicking on the submit button in the group Beginning Developers
    I have a form with a submit button.  When the file runs I am checking if a SESSION variable is set.  If it is I want to trigger the action the submit button is tied to without the user having to click.  I've tried ajax calls,...
  • Hey All, Does anyone know how to close a comment thread and ratings without making them disappear.  Basically, I have a plugin very similar to the Blog plugin, and I want to allow commenting and rating until an admin closes them. Changing...
  • elggnoob1 added a new discussion topic Adding new tabs in the group Beginning Developers
    How do you control what is seen on a new tab? I have figured out how to add a new tab via overriding the content.php file and adding a new array, and I have populated the resources folder with a corresponding file for the new view.  However,...
  • elggnoob1 replied on the discussion topic Re-purposing the Blog plugin in
    Thank you Ismayil!  This was enough to finally make things click in my head and make sense.  I was able to do what I set out to.  Thank again. Cheers. view reply
  • elggnoob1 added a new discussion topic Re-purposing the Blog plugin in in the group Beginning Developers
    This is a seriously noob question... but I am a serious noob with next to no programming experience. However, I wanted to put up a site... so I dove in. Here's my challenge:  I am trying to re purpose the blog plugin that comes with...
    • Brrrrr..

      What did you write in here?

      Please, just One question==One answer..

       

    • The general rule is that any database write operations should happen in actions, as they offer CSRF protection. So, look in the /actions folder for examples.

      Adding metadata to entities is straightforward:

      $blog = get_entity($blog_guid);
      $blog->author = 'Author Name';
      
      echo $blog->author;
      

      Certain entity attributes (e.g. title, description, owner_guid, container_guid, access_id) require you to call ElggEntity::save() to propagate the changes:

      $blog->title = 'New Title';
      $blog->access_id = ACCESS_PRIVATE;
      $blog->save();
      

      Creating new entities is straightforward as well:

      $blog = new ElggObject();
      $blog->subtype = 'blog';
      $blog->title = 'Wonderful Blog';
      $blog->description = 'A very long lorem ipsum to you';
      $blog->access_id = ACCESS_FRIENDS;
      $blog->author = 'Some Cool Dude';
      $blog->foo = 'bar';
      $guid = $blog->save();
      
      echo "New blog with $guid saved";
      
      $blog->foo = 'bar2'; // you can change the metadata as well
      

       

    • Thank you Ismayil!  This was enough to finally make things click in my head and make sense.  I was able to do what I set out to.  Thank again. Cheers.

  • elggnoob1 joined the group Beginning Developers