3
#1
Example 16: Friend Request Notification Popup (phpBB3 and IPB2/Invision)
Posted November 10th 2011, 11:46pm
You wanted it, now you have it! The following simple code is all it takes to add a friend request notification pop-up on your phpBB3 or IPB2/Invision board. The modified script for PunBB is here.

As always, please respect my copyright -- do not post this code anywhere nor give it to anyone else! In addition, please do not ask about a PunBB version, because I will not be writing one. However, I would be thrilled if a member modified the script to work on PunBB boards, and posted the modified script as a reply in this topic!

All that is required is to place the following code in a javascript file. It is probably best to have this script active on only the homepage, though it will work on all pages.

var CopyrightNotice = 'Friend request notification for forumotion phpBB3 and IPB2/Invision boards. Copyright © 2012 by Dion Designs. All Rights Reserved. Use and/or modification of this script is allowed, provided this entire copyright notice remains in the original or modified script. Distribution is not allowed without written consent from Dion Designs.';

function setupbox() {
var z=document.getElementById('newfriend');
if (z.getElementsByTagName('FIELDSET')[2].childNodes[0].childNodes[1].childNodes[0].tagName!='EM') {
z.innerHTML='<a href="/profile?mode=editprofile&page_profil=friendsfoes">You have a new friend request</a>';
document.getElementById('ddrequest').style.display='block';
}
else {z.innerHTML='';}
}

$(function() {
x=document.createElement('div');
x.id='ddrequest';
x.style.display='none';
x.innerHTML='<div id="newfriend"></div><a style="cursor:pointer" class="button2" onclick="$(\'#ddrequest\').fadeOut()">Close</a>';
document.body.insertBefore(x,document.body.firstChild);
$('#newfriend').load('/profile?mode=editprofile&page_profil=friendsfoes #main-content fieldset', function() {setupbox();});
});

And you will need the following CSS:

#ddrequest {position: absolute; top: 0px; left: 0px; width: 200px; background: #fff; color: #000; border: 1px solid #888; text-align: center; z-index:1000}
#newfriend {padding: 5px 10px; font-size: 14px; line-height: 20px;}

You should adjust the values of #ddrequest to fit your theme.

Enjoy one of the most requested features on forumotion boards!
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 11th 2011, 1:00am
How do i change into punbb?
φ
Posts: 22
Joined: October 14th 2011, 11:00pm
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 11th 2011, 1:03am
I said:
In addition, please do not ask about a PunBB version, because I will not be writing one. However, I would be thrilled if a member modified the script to work on PunBB boards, and posted the modified script as a reply in this topic!
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Example 16: Friend Request Notification Popup (IPB2/Invision
Posted November 12th 2011, 1:32pm
I can't figure out what to change to make it for PunBB Image
φ
Posts: 71
Joined: October 14th 2011, 11:00pm
Location: CompuTalks
Likes Given: 1
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 12th 2011, 2:45pm
Looks pretty hard for PunBB, had a shot with it just, no luck so far.
φ
Posts: 237
Joined: October 29th 2011, 11:00pm
Location: england, united kingdom, stoke on trent
Likes Given: 20
Likes Received: 4
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 13th 2011, 3:51pm
This is great!

Thanks again for the great stuff Dion :)
φ
Posts: 122
Joined: July 23rd 2011, 11:00pm
Likes Received: 1
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 13th 2011, 7:50pm
I haven't tried this yet, but will sure give it a go when I can. Thank you for sharing! :)
φ
Posts:
Avatar
Guest
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 15th 2011, 4:48pm
I'm surprised you shared this. I'm sure it will serve useful to many members.

This tutorial ca provide as a starting block to those who wish to create a Visitor Message notification too ;)
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 15th 2011, 5:04pm
I shared the script because I guess I've had enough of the "template-based boards on forumotion are best" crowd on the ESF. Over the next few weeks, I'll be posting additional tips/tricks that work well with phpBB3 and Invision boards (due to their having well-written DOM), but will be very difficult to add to PunBB and phpBB2 boards. This is one such example...the DOM on the friends/foes page is horrible on PunBB and phpBB2 boards. And since there is no template for that page, the DOM can't be fixed.

As you know, writing a VM notification script is much more difficult than the friend request notification, because there are bugs in the VM system that need to be addressed. On the bright side, I've heard rumors that eToxic is working on an update to the VM system. One hopes a notification system is part of that update.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 15th 2011, 5:21pm
Sharing tutorials to which the answer to 'Will this work on punBB and phpbb2?' is 'No..' will hopefully minimize that crowd.

The amount of boards i've seen pop up recently all about coding and such things on Forumotion all seem to choose PunBB and have recidulously edited templates to the point where they have deleted vital information from their pages.

I found with VM notifications it was much easier to work with the responseText rather than loading the elements to work with. Its also what allowed me to pull out the users name.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 15th 2011, 9:54pm
LGforum said:
I'm surprised you shared this. I'm sure it will serve useful to many members.

This tutorial ca provide as a starting block to those who wish to create a Visitor Message notification too ;)


I am too, but you're right. I was thinking the same thing when I installed it. :)
φ
Posts:
Avatar
Guest
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted November 15th 2011, 10:00pm
It is very useful. Thank you for sharing this Dion. It works like a charm. :)
φ
Posts:
Avatar
Guest
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted December 3rd 2011, 3:25am
what do you mean this

You should adjust the values of #ddrequest to fit your theme.
φ
Posts:
Avatar
Guest
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted December 3rd 2011, 12:53pm
It means that you should adjust the following values in the #ddrequest CSS rule to fit your theme:

position; top; left; width; background; color; border

They may not need any changes at all, but that is your decision.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Example 16: Friend Request Notification Popup (IPB2/Invision
Posted December 3rd 2011, 2:02pm
Image work properly .. one question .. how u to make the emoticon in reply is in the bar not in the left ?
φ
Posts:
Avatar
Guest
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted December 17th 2011, 3:38am
can u make it to me .. in Punbb please :D
φ
Posts:
Avatar
Guest
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted December 17th 2011, 8:53am
Dion said:
In addition, please do not ask about a PunBB version, because I will not be writing one.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted December 24th 2011, 5:08am
Hi :)
Like most/all things here....
Works a treat... ;)
φ
Posts: 33
Joined: September 25th 2011, 11:00pm
Location: UK
Likes Given: 17
Likes Received: 1
Example 16: Friend Request Notification Popup (IPB2/Invision,phpBB3,PunBB)
Posted December 30th 2011, 8:03am
Ryan said:
Looks pretty hard for PunBB, had a shot with it just, no luck so far.

Yes.
φ
Posts: 63
Joined: November 7th 2011, 12:00am
Likes Received: 4
2
#20
Example 16: Friend Request Notification Popup (IPB2/Invision
Posted January 9th 2012, 8:54am
Dion said:
However, I would be thrilled if a member modified the script to work on PunBB boards, and posted the modified script as a reply in this topic!


var CopyrightNotice = 'Friend request notification for forumotion phpBB3 and IPB2/Invision boards. Copyright © 2011 by Dion Designs. All Rights Reserved. Use and/or modification of this script is allowed, provided this entire copyright notice remains in the original or modified script. Distribution is not allowed without written consent from Dion Designs.';
var Modification="Slight Modification from LGforum @ AvacWeb.com, for PunBB. Credits to Dion";
function setupbox() {
var z=document.getElementById('newfriend');
var x=z.firstChild.lastChild.previousSibling.previousSibling.innerHTML;
if (x.indexOf('title="Accept"')>0) {
z.innerHTML='<a href="/profile?mode=editprofile&page_profil=friendsfoes">You have a new friend request</a>';
document.getElementById('ddrequest').style.display='block';
}
else { z.innerHTML=""; }
}

$(function() {
x=document.createElement('div');
x.id='ddrequest';
x.style.display='none';
x.innerHTML='<div id="newfriend"></div><a style="cursor:pointer" class="button2" onclick="$(\'#ddrequest\').fadeOut()">Close</a>';
document.body.insertBefore(x,document.body.firstChild);
$('#newfriend').load('/profile?mode=editprofile&page_profil=friendsfoes #main-content .main', function() { setupbox();});
});


CSS is needed from the first post.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26

Who is online

Users browsing this forum: No registered users and 0 guests