HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Messing with activities

2»

Comments

  • Options

    @hgtonight

    I think your way is a "hack" way, and it seems like @R_J is the correct usage, but then again. if it works why break it? :)

    R_J Thanks for the example, I will use it!

  • Options

    Hey guys, I've noticed that in other activities that if they stack up for same Regard it just puts them all in one Activity rather than each activity on it's on, I wonder how is that possible?

  • Options
    ShadowdareShadowdare r_j MVP
    edited January 2014

    @Aviram said:
    About IDE, do you have any recommendation ?

    When I simply want to edit files and don't need the features of an IDE, I use Notepad++ and Sublime Text.

    I used NetBeans before and it provides a lot of features most people look for in an IDE. I like NetBeans because it's free and has a lot of features, but the interface feels clunky and slow, so I started looking into other IDEs recently. A lot of other IDEs that support PHP are also built with Java and feel clunky.

    I tried Komodo IDE, which isn't built with Java, and found that has a very clean interface and feels snappy, but it's missing some features that I find useful in other IDEs and it doesn't do some things as well as NetBeans.

    For example, the code completion feature isn't as streamlined as the other IDEs and adding a PHP include for code completion scanning can't be done per-project, unless you create symbolic links or copy the includes into the project folder. Also, there is no built-in PHP formatting feature for cleaning up code, so you would have to use an external script which is tedious to configure.

    I have started using PHPStorm recently and found that it has a lot of nice features. While it isn't as light as Komodo IDE, it's less clunky and more modern looking compared to NetBeans. I agree with @Lincoln; PHPStorm is fantastic!

    Add Pages to Vanilla with the Basic Pages app

  • Options

    Old thread resurrection. First off, this thread is awesome. I was looking all over trying trying to find how to do this.

    I'm placing the following lines into a plugin and having some issues, I'll skip the setup() portion and go right to the part that's failing. I'm trying to do 2 notifications, and only the first one is succeeding, I assume it's because of some of the variables I'm using for the second one are not getting what they need.

    Here's the portion that's working:

          // notify the player that they have been drafted   
          $ActivityUserID = Gdn::Session()->UserID; // current user
          $ActivityType = 'PlayerDrafted';
          $Story = 'You have been drafted';
          $RegardingUserID = $PlayerID; // The player drafted
          $CommentActivityID = '';
          $Route = '';
          $SendEmail = '1'; // Send email
          $ActivityModel = new ActivityModel();
          $ActivityID = $ActivityModel->Add(
             $ActivityUserID,
             $ActivityType,
             $Story,
             $RegardingUserID,
             $CommentActivityID,
             $Route,
             $SendEmail
          );
          //  $ActivityModel->SendNotification($ActivityID, $Story);
          // lets try Queue instead
          $ActivityModel->Queue($ActivityID, $Story);
    

    So that works with using either SendNotification() or Queue()

    Here's the portion that's not working:

          // notify the owner that the have drafted a player
          $td_ActivityUserID = Gdn::Session()->UserID; // already did this
          $td_ActivityType = 'TeamDrafted';
          $PlayerGT = $Sender->User->Gamertag;  // this does not appear to be working
          $td_Story = 'The ' . $OwnerTeam . ' have drafted ' . $PlayerGT;  // or perhaps this isnt working...
          $td_RegardingUserID = $OwnerID; // The owner
          $td_CommentActivityID = ''; // already did this
          $td_Route = '';  // already did this
          $td_SendEmail = '1'; // Send email
          $td_ActivityModel = new ActivityModel();
          $td_ActivityID = $td_ActivityModel->Add(
             $td_ActivityUserID,
             $td_ActivityType,
             $td_Story,
             $td_RegardingUserID,
             $td_CommentActivityID,
             $td_Route,
             $td_SendEmail
          );
          $td_ActivityModel->Queue($td_ActivityID, $td_Story);
    

    What's the best way to test whether $PlayerGT, or $td_Story are getting the right information? Just echoing them?

  • Options
    hgtonighthgtonight ∞ · New Moderator

    var_dump($PlayerGT); die(); is quick and easy.

    You can also run a PHP debugger and set a breakpoint.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    Thanks, I'll try that.

    Further to write things to the activity table... It doesn't seem like using new ActivityModel() will make things show up publicly on the Activity page. Was that the case for you guys? For my one notification that works, it doesnt show up on the activity page. Perhaps I'm still doing it wrong.

    Since this is an older thread, I'm wondering if there is any newer information on how to send notifications/have them show on the activity page. Thanks

Sign In or Register to comment.