paulgibbs / achievements

Achievements gamifies your WordPress site with challenges, badges, and points.
http://achievementsapp.com
63 stars 9 forks source link

Clear achievements after displaying notifications #104

Closed rmccue closed 11 years ago

rmccue commented 11 years ago

Rather than clear these when viewing the achievement page, clear them after the notification has been shown.

Also, use the standard clear notification function.


Apologies for the newline at the end of the file, GitHub's editor appears to have added that. If you'd like, I can repush this.

Alternative solution: implement an Ajax handler for when the background is clicked, or add an action so a plugin can do this.

This fixes the following .org support requests:

paulgibbs commented 11 years ago

Hi Ryan! Big thanks for the code. It looks good.

So, the long term idea was always to implement an AJAX handler for background clicks. I am a bit worried that a user could hide the popup accidentally (say they did really want to read it) and then not be sure where or how to get it to re-appear. Whether this is more or less painful than people being annoyed about the popup window re-appearing all the time, I don't know :) I think I will merge this and see if I get any user feedback in the next release.

I have been avoiding writing any AJAX because I want to learn about things like Backbone to see if building something like that would give me one place where I could put a lot of dynamic update-y stuff. For example, live unlock alerts, updating the "who's unlocked" lists if another user is viewing that list on a page, live updating a leaderboard widget etc, as well as (most importantly) providing an API of sorts that would allow people to make progress towards unlocking an achievement through JavaScript events (instead of just WordPress actions).

rmccue commented 11 years ago

Hi Ryan! Big thanks for the code. It looks good.

Thanks for the plugin. :)

So, the long term idea was always to implement an AJAX handler for background clicks. I am a bit worried that a user could hide the popup accidentally (say they did really want to read it) and then not be sure where or how to get it to re-appear.

I took a look at using Ajax originally, but decided against it for simplicity's sake.

I don't think accidentally hiding the achievement is a huge issue, as it appears in their Activity stream in BuddyPress (if the site has them enabled). One could always reimplement that in Achievements if you want it without BuddyPress, but that feels like feature creep to me.

I have been avoiding writing any AJAX because I want to learn about things like Backbone to see if building something like that would give me one place where I could put a lot of dynamic update-y stuff.

Backbone's great, but the core of the API would most likely be independent of Backbone in case theme authors want to avoid it. IMO, all you need is a Achievements object with complete/update methods for the progress. Using those in Backbone would be fairly easy if needed, but more importantly, you can use them in standard JS without that.

For example, live unlock alerts, updating the "who's unlocked" lists if another user is viewing that list on a page, live updating a leaderboard widget etc

I'd personally wait until 3.6 drops with the new heartbeat API and see if that can be used on the frontend for that purpose, as it seems like a natural match.

paulgibbs commented 11 years ago

Thanks for the JS suggestions :)