Ajax popup to notify user that he/she received an achievement or received points
-
Hi,
I would love to see a new feature where an Ajax pop up appears telling user that they earned an achievement or points and as a result the user would see their points updated. It would be neat if it was also associated with a sound. I think this feature exists in the WordPress WPAchievements plugin.
Best regards,
Belal
-
I hope it is still on your project ??
It would be very so nice for learners !
Don’t hesitate to tell us any news about this ??
I would be happy to help if I could but the ajax part seems to be a bit hard for me.
I was thinking about this, an took a deep look into the API.
I found that there was a hook called badgeos_award_achievemnt that triggered when a badge is earned.
Can’t we imagine a jquery pop up that will display when the user earn a badge, using this hook and a custom php function ?
I just writte for you the (very) begining of this idea, to let you evaluate if this is something possible, or if I missed some points.
If you tell me this is possible – if that pop up ideas doesn’t necesseraly involve coding AJAX -, I will be happy to try some things.
Thanks for you advice ??
Some sort of custom solution is most definitely possible, but I can’t say I’m going to spend too much time on it myself. If someone else decides to spend some time on their own version, have at it ??
I know now how to occupy my free time! ??
Note that I am just a beginner, any help is welcome! I think we can do something with the great API.
Thanks to all the people who will help me or who will take time to try it by themselves.
This feature can be so useful for everybody: students, teachers, users, and the BadgeOS team itself ! ??doing support at odd hours of the day instead of socializing? yeah, that’s actually a bit accurate.
doing support is a way to socialize. and you do it well :p
(Actually, it is 4:55 am here ^^)So i digg into this action hook (badgeos_award_achievemnt) that I talked in my previous post and wanted to share what I found.
I decided to start at the very fundamental : display a simple javascript modal alert window when the user get an achievement.
Here where i came up so far.
The idea was to used an action that will be triggered by the hook, and this action will call an-other action that will enqueue the pop up script in wp_head.
But it appears that nothing can be echoing in page following this action hook. We can trigger other functions (add points etc…), but not for displaying things ‘in page’ (for eg. a script) – or at least, I don’t find how. I think it is why AJAX was required.
I don’t think of any other php/java only tricks to make it works at this time, but if someone has any other ideas, feel free to share.Meanwhile,
What is your current way to tell your users that they got an achievement ?
Is it possible to tell them this automatically by email even if they don’t have any credly account ?Thanks to all for participating on this ??
EDIT : I just have an idea but it go far beyond my php knowledge.
The ID would be to use the hook to store infos in a database table, with a variable such as “pending_achievement”. On every page, function will check is there is any pending achievement. If there is, it will display a pop-up using infos of this achievement, and the variable will get reinitialized (or erased). If no were pedning, no action will occur.
— other idea : just store the “pending_achievement” variable and make a function capable to show the last(s) earned achievement badges in a pop_up.(note : the “pending_achievement” could simply store achiement_id. this way, it would be easier to get all infos for the pop-up function.
What do you think of that ? Is this sounds doitable or did I missed the point ?
— sorry if I spam this thread, It is a functionality that I truely think as indispensable for the users)We are pleased to let you know that we released the new “Congratulations” Add-on to BadgeOS earlier this week. You can learn more about the plugin at:
https://badgeos.org/downloads/congratulations/
The “Congratulations” Add-on to BadgeOS automatically displays an overlay “pop-up” window (modal) congratulating users as they earn achievements.
Feature Highlights:
- Notification is immediately displayed when achievements are earned
- Displays one or more achievements in the same window
- Message includes the specific badge image, BadgeOS Congratulations Text, and points (if any) associated with each achievement earned
- Settings let you select which BadgeOS Achievement Types should trigger pop-up Congratulations messages when earned (display Congrats messages for just the Achievement Types you want)
- Greets users when they login if achievements were earned in their absence (great for achievements awarded upon approval, by site admins, or for simply logging in)
We know several of you who posted in this particular forum topic have been patiently waiting for this add-on. To thank you for your involvement in the community, we’re pleased to offer you a discount. If interested, contact us using the form at: https://badgeos.org/contact/. Please reference the link to this forum and your WordPress display name.
Thanks!
BadgeOS TeamThis sounds perfect !!
Thank to the team for listening to us,
and thank you very much for the discount plan ??You rock !
Edit : Just a a question, is this lightbox responsive/mobile friendly ?
Hello Everyone
I have tried some customization ,
i have changed rules-engine.php file and added some custom script to show my html code..at this code
// If the user has completed the achievement, award it
if ( badgeos_check_achievement_completion_for_user( $achievement_id, $user_id, $this_trigger, $site_id, $args ) )I have modified with this below code
// If the user has completed the achievement, award it
if ( badgeos_check_achievement_completion_for_user( $achievement_id, $user_id, $this_trigger, $site_id, $args ) )
{
badgeos_award_achievement_to_user( $achievement_id, $user_id, $this_trigger, $site_id, $args );
?>
<script type=”text/javascript”>
$(‘#deletesuccess’).delay(1000).fadeOut();
</script>
<div id=”deletesuccess” style=”width:300px;height:40px;top:15px;right:5px;position:fixed;z-index:6001;border:3px solid #744150;border-radius:5px;background-color:#744150;”>
<image src=”https://localhost/wordpress/award.png” width=”40″ height=”40″ style=”position:absolute;”><span style=”color:#fff;font-size:26px;width:auto;text-align:right;”> You Earned A Badge</span>
</div>
<?php
}Now for every achievement i can show custom popup which is designed using html/jquery/css.
Hope this helps.
If i am wrong , please let me know.
Cheers,
froliclearning.comfroliclearning, it’d probably be best to jump onto this discount that is being offered for the official version. It’s also been tested and used for some specific clients so it’s potentially a lot better off.
@froliclearning
I’m very curious about that, can you make a video screen about it ?Any way the official plugin seems to handle all or desire : badges name, several badges at the same time, handle badge gave when the user is connected…
I am seriously interested by it – but I have no answer from BadgeOS for now (I sent a message via contact 24hour ago). I figure it is just a question of time ??It’s the weekend, give them time.
Sorry, I was a bit excited by this news ??
It’s ok now, I just get the add-on (the proposed discount was 30%), I’m translating it in French at this precise moment ! ??
- The topic ‘Ajax popup to notify user that he/she received an achievement or received points’ is closed to new replies.