PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
pe5pvb
New Member
New Member


Joined: Oct 16, 2007
Posts: 19

PostPosted: Wed Feb 13, 2008 4:35 am Reply with quote Back to top

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.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Wed Feb 13, 2008 5:00 am Reply with quote Back to top

Thanks! Maybe there is a way to make this configurable...
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Wed Feb 13, 2008 7:32 am Reply with quote Back to top

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...
View user's profile Send private message Visit poster's website
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Wed Feb 13, 2008 11:08 am Reply with quote Back to top

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...
View user's profile Send private message
pe5pvb
New Member
New Member


Joined: Oct 16, 2007
Posts: 19

PostPosted: Wed Feb 13, 2008 1:06 pm Reply with quote Back to top

For sure. It's very easy to modify it for that use.
View user's profile Send private message
rasterman
New Member
New Member


Joined: Oct 28, 2007
Posts: 5
Location: Luton UK

PostPosted: Sat Mar 08, 2008 12:01 pm Reply with quote Back to top

Can someone please tell me what I need to add to what language file thx.
View user's profile Send private message Visit poster's website
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Fri Jul 11, 2008 6:31 am Reply with quote Back to top

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.
View user's profile Send private message Visit poster's website
rickleigh
Worker
Worker


Joined: Jan 06, 2009
Posts: 183

PostPosted: Mon Oct 26, 2009 12:26 pm Reply with quote Back to top

Is there anyway to get this to work outside the block? Like using a Java Script in the head of the site some how?
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Tue Oct 27, 2009 3:40 am Reply with quote Back to top

I was thinking of adding a notification icon to nukeNAV for this and other notifications like pending content.
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Tue Oct 27, 2009 11:19 am Reply with quote Back to top

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
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Send e-mail Visit poster's website
rickleigh
Worker
Worker


Joined: Jan 06, 2009
Posts: 183

PostPosted: Tue Oct 27, 2009 11:55 am Reply with quote Back to top

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
Only registered users can see links on this board!
Get registered or login to the forums!


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. Evil or Very Mad
View user's profile Send private message
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 1536
Location: North Carolina

PostPosted: Tue Oct 27, 2009 12:26 pm Reply with quote Back to top

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.
View user's profile Send private message Send e-mail Visit poster's website
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Tue Oct 27, 2009 12:29 pm Reply with quote Back to top

Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Send e-mail Visit poster's website
rickleigh
Worker
Worker


Joined: Jan 06, 2009
Posts: 183

PostPosted: Tue Oct 27, 2009 12:56 pm Reply with quote Back to top

I already have that block, but was trying to get away from using it. Tring to go for a different style for my site:
Only registered users can see links on this board!
Get registered or login to the forums!
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.
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Sat Oct 31, 2009 8:21 am Reply with quote Back to top

rickleigh, you might want to try the "For Hire" forum... maybe someone will be willing to do this for a small amount.
View user's profile Send private message Visit poster's website
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Sat Oct 31, 2009 2:14 pm Reply with quote Back to top

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>';
?>
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum