Notify a user with notifications or alert
4 posters
Page 1 of 1
Notify a user with notifications or alert
Technical Details
Forum version : #phpBB3
Position : Administrator
Concerned browser(s) : Mozilla Firefox, Google Chrome
Who the problem concerns : All members
Forum link : http://www.forum-promotion.com/
Description of problem
Hello,
So i create a donation system that a member can use it, tag a member and request a donation of points from his/her profile to the member (s)he tagged. What i want is that member who gets tagged to get notified wither to the notification list of fa_toolbar or to his/her browser that the member who posted has donated to him/her the X amount of points.
I do not wish to share the donation system code but if you know how i can add a script or something in my code in order to do this i would appreciate the help.
Thanks
Re: Notify a user with notifications or alert
Do you mean the tag system?
@SLGray
If yes, you will get a notification if you have it set in your profile.
@SLGray
If yes, you will get a notification if you have it set in your profile.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Notify a user with notifications or alert
Despite the tag mention, there are people that don't pay attention to the notifications. Maybe if an alert of the browser is sent to them it may be something better. But still with the notifications i want a notification that will contain information about the donation and not a single tag.
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
Bump!
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
Luffy wrote:Bump!
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
Bump!
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
Bump.
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
Hello,
Rely on the FA.Notification for any function you wish to create is a painful path — trust me, I've been there. I would suggest that you intercept the "donation action" and, before it happens, you send a PM via Ajax with the notice.
PMs have a natural alert, so that should be covered up.
Rely on the FA.Notification for any function you wish to create is a painful path — trust me, I've been there. I would suggest that you intercept the "donation action" and, before it happens, you send a PM via Ajax with the notice.
- Code:
; (function ($) {
'use strict';
$(function () {
/** Before doing donation stuff */
$.post('/privmsg', {
username: 'Donation Receiver',
subject: 'I\'ve just sent you a donation!',
message: 'Lorem ipsum dolor sit amet.',
mode: 'post',
post: 1
}).then(function () {
/** Do the donation stuff */
console.log('I\'m doing stuff.')
});
});
})(jQuery);
PMs have a natural alert, so that should be covered up.
Re: Notify a user with notifications or alert
Hello @Kyo Panda and thank you for your reply.
That code pretty much does what i want but is there a possibility that we can add an alert on the browser too? Within that code, the member who receives the coins to receive an alert also?
That code pretty much does what i want but is there a possibility that we can add an alert on the browser too? Within that code, the member who receives the coins to receive an alert also?
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
The member who receive the coins (and the message) will receive the "You got a new message!" alert, default on Forumotion, assuming that the username field on the ajax call is properly filled with the receiver username.
Of course, we can go rad on this topic and on overall_header:
Inside the switch, we can make another interception to do "custom stuff":
^ Like zis.
Of course, we can go rad on this topic and on overall_header:
- Code:
<!-- BEGIN switch_enable_pm_popup -->
pm = window.open('{U_PRIVATEMSGS_POPUP}', '_faprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');
if(pm != null) { pm.focus(); }
<!-- END switch_enable_pm_popup -->
Inside the switch, we can make another interception to do "custom stuff":
- Code:
<!-- BEGIN switch_enable_pm_popup -->
$.get('/privmsg?folder=inbox', function (data) {
if ($('a.topictitle:eq(0)', data).text().trim() === 'I\'ve just sent you a donation!') {
console.log('Do awesome stuff!');
return;
}
/** Default PM codez */
pm = window.open('{U_PRIVATEMSGS_POPUP}', '_faprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');
if(pm != null) { pm.focus(); }
});
<!-- END switch_enable_pm_popup -->
^ Like zis.
Re: Notify a user with notifications or alert
Hello @Kyo Panda,
Just to make sure i understood this correctly, with the second code to do custom stuff this reads the title of the PM and if it's the one entered 'I\'ve just sent you a donation!' it will show the alert on the console? If this is it then it's perfect.
Just to make sure i understood this correctly, with the second code to do custom stuff this reads the title of the PM and if it's the one entered 'I\'ve just sent you a donation!' it will show the alert on the console? If this is it then it's perfect.
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
Yep, exactly.
---
Basically:
---
Basically:
- Code:
/** When a new PM is received and the alert option is ON on the Administrative Panel (default) */
<!-- BEGIN switch_enable_pm_popup -->
/** Load the receiver PM page */
$.get('/privmsg?folder=inbox', function (data) {
/** If the last PM received has the title "I've just sent you a donation!" */
if ($('a.topictitle:eq(0)', data).text().trim() === 'I\'ve just sent you a donation!') {
/** Do custom stuff */
console.log('Do awesome stuff!');
/** And return without executing the default PM code below */
return;
}
/** Default PM codez */
pm = window.open('{U_PRIVATEMSGS_POPUP}', '_faprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');
if(pm != null) { pm.focus(); }
});
<!-- END switch_enable_pm_popup -->
Re: Notify a user with notifications or alert
An do i have to add the <script> tags or not? Because it's in the templates?
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
This particular part on overall_header is already within a script tag, so you should be covered up.
- Code:
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
<!-- BEGIN switch_enable_pm_popup -->
pm = window.open('{U_PRIVATEMSGS_POPUP}', '_faprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');
if(pm != null) { pm.focus(); }
<!-- END switch_enable_pm_popup -->
<!-- BEGIN switch_report_popup -->
report = window.open('{switch_report_popup.U_REPORT_POPUP}', '_phpbbreport', 'HEIGHT={switch_report_popup.S_HEIGHT},resizable=yes,scrollbars=no,WIDTH={switch_report_popup.S_WIDTH}');
if(report != null) { report.focus(); }
<!-- END switch_report_popup -->
<!-- BEGIN switch_ticker -->
$(document).ready(function() {
Ticker.start({
height : {switch_ticker.HEIGHT},
spacing : {switch_ticker.SPACING},
speed : {switch_ticker.SPEED},
direction : '{switch_ticker.DIRECTION}',
pause : {switch_ticker.STOP_TIME}
});
});
<!-- END switch_ticker -->
});
<!-- BEGIN switch_login_popup -->
var logInPopUpLeft, logInPopUpTop, logInPopUpWidth = {LOGIN_POPUP_WIDTH}, logInPopUpHeight = {LOGIN_POPUP_HEIGHT}, logInBackgroundResize = true, logInBackgroundClass = false;
<!-- END switch_login_popup -->
<!-- BEGIN switch_login_popup -->
$(document).ready( function() {
$(window).resize(function() {
var windowWidth = document.documentElement.clientWidth;
var popupWidth = $("#login_popup").width();
var mypopup = $("#login_popup");
$("#login_popup").css({
"left": windowWidth/2 - popupWidth/2
});
});
});
<!-- END switch_login_popup -->
//]]>
</script>
Re: Notify a user with notifications or alert
or entered within the
|
My bad, i didn't see the code very well. I did enter the code in the overall header but there is nothing showing up once i send a donation. I do get the pm and the notifications on the fa_toolbar but no browser alert.
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
Can you post your overall_header here, so we can check what is happening?
---
EDIT.: No problems. ^-^
---
EDIT.: No problems. ^-^
Last edited by Kyo Panda on December 4th 2016, 2:40 pm; edited 1 time in total
Re: Notify a user with notifications or alert
Oh well, i changed the console.log to alert and it worked. All i wanted is an alert to show up!!
Thanks so much @Kyo Panda!!
Thanks so much @Kyo Panda!!
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Notify a user with notifications or alert
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
Team Leader
Review Section Rules | Request A Review | Sticker Points
Re: Notify a user with notifications or alert
Oops! I completely forgot i could do that!
Thanks once again Kyo Panda!!
Thanks once again Kyo Panda!!
Problem solved & topic archived.
|
Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Similar topics
» Notify user when moderation is complited
» New User Notifications
» Can't access user dashboard or notifications from Forumotion toolbar
» Notifications not appearing in drop down menu on toolbar, but they appear on Notifications page
» How to Notify Member in Post through @Name
» New User Notifications
» Can't access user dashboard or notifications from Forumotion toolbar
» Notifications not appearing in drop down menu on toolbar, but they appear on Notifications page
» How to Notify Member in Post through @Name
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum