| Author |
Message |
pe5pvb New Member


Joined: Oct 16, 2007 Posts: 19
|
Posted:
Wed Feb 13, 2008 4:35 am |
|
I added an extra feature to the Block-User_info.php. It will show a popup when you have a new message. Please don't forget to update your language file when adding this.
How to install:
1. Open Block-User_info.php and add these lines at the end of the settings. (before "You should not need to modify anything below this line")
| Code: | $pm_notify_dropin = TRUE; //Notify users of private message by using a javascript drop box
$pm_dropin_once = FALSE; //If set to true, users will only be notified of private messages once per visit
$dropin_bgcolor = '#EEEEEE'; //Set background color of drop box
$dropin_bordercolor = '#4C44BA'; //Set border color of drop box |
2. Find "$content .= '<img src="images/blocks/email-y.gif"" and add this code before this line:
| Code: | ////////////////Drop box for new Private Message added by Murdock/////////
if ($pm_notify_dropin && $newpms > 0)
{
$content .= '
<script type="text/javascript" language="JavaScript1.2">
// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"
var bouncelimit=32 //(must be divisible by 8)
var direction="up"
function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}
function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+40+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}
function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}
function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}
function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (bad_tag.length > 0) {
offset = bad_tag.indexOf(search)
if (offset != -1) {
offset += search.length
end = bad_tag.indexOf(";", offset)
if (end == -1)
end = bad_tag.length;
returnvalue=unescape(bad_tag.substring(offset, end))
}
}
return returnvalue;
}
function dropornot(){';
if ($pm_dropin_once)
{
$content .= '
if (get_cookie("droppedin")==""){
window.onload=initbox
bad_tag="droppedin=yes"
}';
}
else
{
$content .= '
window.onload=initbox
';
}
$content .= '
}
dropornot()
</script>
';
$content .= '
<div id="dropin" style="position:absolute;visibility:hidden;left:300px;top:100px;width:300px;height:50px;background-color:'.$dropin_bgcolor.';border: 1px solid '.$dropin_bordercolor.'">
<div align="right"><a href="#" onClick="dismissbox();return false">['._CLOSE.'] </a></div>
<br />';
if ($newpms == 1) {
$content .= '<a href=modules.php?name=Private_Messages onClick="dismissbox();">'._YOUHAVE.' <strong>'. $newpms .'</strong> '._NEWMESSAGE.'.</a></div>';
} else {
$content .= '<a href=modules.php?name=Private_Messages onClick="dismissbox();">'._YOUHAVE.' <strong>'. $newpms .'</strong> '._NEWMESSAGES.'.</a></div>';
}
}
////////////////End code for Drop box///////// |
You can change some settings if you like in the setup. Good luck with it. This code was taken from the Info_box block and changed a little to work in the Ravennuke User Info block. |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Wed Feb 13, 2008 5:00 am |
|
Thanks! Maybe there is a way to make this configurable... |
|
|
|
 |
montego Site Admin

Joined: Aug 29, 2004 Posts: 9136 Location: Arizona
|
Posted:
Wed Feb 13, 2008 7:32 am |
|
Personally, I've never liked the BBtoNuke integration how the pop-up doesn't work outside of BBtoNuke. IMO, it really should be made a part of mainfile or header just like the site message is... but, that is just me... |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Wed Feb 13, 2008 11:08 am |
|
It might also be used to have a different approach for notifying an admin that content is pending, instead of showing it in a hard-coded admin block... |
|
|
|
 |
pe5pvb New Member


Joined: Oct 16, 2007 Posts: 19
|
Posted:
Wed Feb 13, 2008 1:06 pm |
|
For sure. It's very easy to modify it for that use. |
|
|
|
 |
rasterman New Member


Joined: Oct 28, 2007 Posts: 5 Location: Luton UK
|
Posted:
Sat Mar 08, 2008 12:01 pm |
|
Can someone please tell me what I need to add to what language file thx. |
|
|
|
 |
montego Site Admin

Joined: Aug 29, 2004 Posts: 9136 Location: Arizona
|
Posted:
Fri Jul 11, 2008 6:31 am |
|
rasterman, it would be under root/languages. Unless the blocks load their own language files (which I have only seen one of mine do that <wink>), any defines would have to go into these "core" language files. |
|
|
|
 |
rickleigh Worker


Joined: Jan 06, 2009 Posts: 183
|
Posted:
Mon Oct 26, 2009 12:26 pm |
|
Is there anyway to get this to work outside the block? Like using a Java Script in the head of the site some how? |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Tue Oct 27, 2009 3:40 am |
|
I was thinking of adding a notification icon to nukeNAV for this and other notifications like pending content. |
|
|
|
 |
Guardian2003 Site Admin

Joined: Aug 28, 2003 Posts: 6373 Location: Vsetin, Czech Republic
|
Posted:
Tue Oct 27, 2009 11:19 am |
|
I think gotcha at nukecoder.com used this in his RN compatible User Info block some time back.
Here's the link to the original Dynamic Drive script
|
|
|
|
 |
rickleigh Worker


Joined: Jan 06, 2009 Posts: 183
|
Posted:
Tue Oct 27, 2009 11:55 am |
|
| Guardian2003 wrote: | I think gotcha at nukecoder.com used this in his RN compatible User Info block some time back.
Here's the link to the original Dynamic Drive script
|
Thats what I'm looking for but I don't know how to embed the code needed to make it drop when a new PM is in my inbox.
I hate feeling like a dumb ()()s and not being able to learn fast enough.  |
|
|
|
 |
nuken RavenNuke(tm) Development Team

Joined: Mar 11, 2007 Posts: 1536 Location: North Carolina
|
Posted:
Tue Oct 27, 2009 12:26 pm |
|
I use the nukecoder User Info block on my site and the only thing needed is activate the block. When a pm is received, the popup notifies you. You have some config options inside the block for the popup settings. |
|
|
|
 |
Guardian2003 Site Admin

Joined: Aug 28, 2003 Posts: 6373 Location: Vsetin, Czech Republic
|
Posted:
Tue Oct 27, 2009 12:29 pm |
|
|
|
 |
rickleigh Worker


Joined: Jan 06, 2009 Posts: 183
|
Posted:
Tue Oct 27, 2009 12:56 pm |
|
I already have that block, but was trying to get away from using it. Tring to go for a different style for my site: and wanted to somehow strip this feature from that block and have it work in a Java Scripted on my site. But, I don't understand the code enough to do it. |
|
|
|
 |
montego Site Admin

Joined: Aug 29, 2004 Posts: 9136 Location: Arizona
|
Posted:
Sat Oct 31, 2009 8:21 am |
|
rickleigh, you might want to try the "For Hire" forum... maybe someone will be willing to do this for a small amount. |
|
|
|
 |
Palbin Site Admin

Joined: Mar 30, 2006 Posts: 2456 Location: Pittsburgh, Pennsylvania
|
Posted:
Sat Oct 31, 2009 2:14 pm |
|
Create /includes/addons/head-pm_popup.php
| Code: |
<?php
global $db, $dropin_bgcolor, $dropin_bordercolor, $new_pms, $prefix, $user, $userinfo;
// notify users of private message by using a javascript drop box
$pm_notify_dropin = true;
// if set to true, users will only be notified of private messages once per visit
$pm_dropin_once = false;
// set the colors for the dropin box
$dropin_bgcolor = '#EEEEEE';
$dropin_bordercolor = '#4C44BA';
if (is_user($user)) {
// check new pms
$sql = 'SELECT `privmsgs_to_userid` FROM `' . $prefix . '_bbprivmsgs` WHERE `privmsgs_to_userid`="' . $userinfo['user_id'] . '" AND (privmsgs_type = "5" OR privmsgs_type = "1")';
if ( !($result = $db->sql_query($sql)) ) {
// error
die('error checking new pms');
}
$new_pms = $db->sql_numrows($result);
$db->sql_freeresult($result);
} else {
$new_pms = 0;
}
if ($pm_notify_dropin && $new_pms > 0) {
$inlineJS = '<script type="text/javascript" language="JavaScript1.2">
// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"
var bouncelimit=32 //(must be divisible by 8)
var direction="up"
function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}
function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top) {
crossobj.top=parseInt(crossobj.top)+40+calunits
} else {
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}
function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}
function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}
function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (bad_tag.length > 0) {
offset = bad_tag.indexOf(search)
if (offset != -1) {
offset += search.length
end = bad_tag.indexOf(";", offset)
if (end == -1)
end = bad_tag.length;
returnvalue=unescape(bad_tag.substring(offset, end))
}
}
return returnvalue;
}
function dropornot(){';
if ($pm_dropin_once) {
$inlineJS .= 'if (get_cookie("droppedin")==""){
window.onload=initbox
bad_tag="droppedin=yes"
}';
} else {
$inlineJS .= 'window.onload=initbox';
}
$inlineJS .= '}
dropornot()
</script>';
addJSToHead($inlineJS, 'inline');
}
?>
|
Create /includes/custom_files/custom_footer.php
| Code: |
<?php
global $new_pms, $dropin_bgcolor, $dropin_bordercolor;
echo '<div id="dropin" style="position:absolute;visibility:hidden;left:400px;top:100px;width:300px;height:100px;background-color:' . $dropin_bgcolor . ';border: 1px solid ' . $dropin_bordercolor . '">'
. '<div align="right"><a href="#" onclick="dismissbox();return false">[Close Box] </a></div>'
. '<br />'
. '<a href="modules.php?name=Private_Messages" onclick="dismissbox();">You have <strong>' . $new_pms . '</strong> new Private Messages.</a>'
. '</div>';
?>
|
|
|
|
|
 |
|
|
|
|