1
DefJef
Pop up a "you have a new private message" when inbox has new msg?
  • 2005/8/17 15:00

  • DefJef

  • Just popping in

  • Posts: 53

  • Since: 2005/8/8 2


How could we Pop up a "you have a new private message" window when inbox has new msg? Know what i mean?

-Jeff

2
talunceford
Re: Pop up a "you have a new private message" when inbox has new msg?

I doubt that would be too hard at all. It can be easily done with an "if" statement in your theme.html file.

<{php}> GLOBAL $xoopsUser$pm_handler =& 
                                      
xoops_gethandler('privmessage'); $uid 
                                      
$xoopsUser->getVar('uid'); $criteria = new 
                                      
CriteriaCompo(new Criteria('read_msg'0)); 
                                      
$criteria->add(new Criteria('to_userid'
                                      
$uid)); $msgcount $pm_handler->getCount($criteria); 
                                      
$GLOBALS['xoopsTpl']->assign('msgcount'
                                      
$msgcount); <{/php}>
                                      
                                       <{if 
$msgcount }>
                                      <
table><tr><td width="2" align="center" valign="middle"><img src="<{$xoops_imageurl}>images/site_top_div.gif" width="2" height="37" onload="MM_popupMsg('You have a new Private Message')" />td>tr>table>
                                      <{else}>
                                       <
table><tr><td width="2" align="center" valign="middle"><img src="<{$xoops_imageurl}>images/site_top_div.gif" width="2" height="37" />td>tr>table>
                                       <{/if}>


Here is an example of the theme.html file that I use for tswn.com

xml version="1.0" encoding="windows-1251"?>




" />
" />
" />
" />
" />
" />
" />

<{$xoops_sitename}> - <{$xoops_pagetitle}>
/favicon.ico" rel="SHORTCUT ICON" />




<{$xoops_module_header}> 
























































































 

   
    
         
          images/l1.jpg" WIDTH=100% HEIGHT=100%  bgcolor="#6D6F6D" style="background-repeat:repeat-x; background-position:top ">
        
         
          images/l2.jpg" WIDTH=100% HEIGHT=132 ALT="">
        
      
    
        flash/main.swf">
        
        flash/main.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="766" height="286"> 
      
    
         
          images/r1.jpg" WIDTH=100% HEIGHT=100%  bgcolor="#6D6F6D" style="background-repeat:repeat-x; background-position:top ">
        
         
          images/l2.jpg" WIDTH=100% HEIGHT=132 ALT="">
        
      
  
   
     images/2.jpg" WIDTH=766 HEIGHT=13 ALT="">
  
   
     
         
           
               
                images/bak1.jpg" WIDTH=68 HEIGHT=100%> 
                  images/3.jpg" WIDTH=68 HEIGHT=319 ALT="">
              
               
                 images/4.jpg" WIDTH=68 HEIGHT=59 ALT="">
              
            
           
               
                images/5t1.jpg" WIDTH=628 HEIGHT=34 ALT=""> 
                  

              
               
                images/5bak1.jpg"  WIDTH=628 HEIGHT=100% >images/5t2.jpg" WIDTH=628 HEIGHT=100% style="background-repeat:no-repeat "   border="0" cellspacing="0" cellpadding="0">
                     
                        
                          
                             
                               
                                <{if $xoops_isuser}>  
                                  
                                     
                                      images/site_top_div.gif" height="37" width="2" />
                                       
                                        Your Account
                                          images/spacer.gif" height="10" width="1" /> 
                                        



                                        
                                        
                                           
                                            images/l_top.gif" width="32" />
                                            images/top.gif" width="100%"> 
                                                NAVIGATION

                                            images/r_top.gif" />
                                          
                                           
                                            images/l_side.gif">images/l_side_lrg.gif" />
                                            images/c-bg.gif">
                                                
                                                   
                                                    

                                                      <{foreach item=block from=$xoops_lblocks}><{include 
                                                      file="tswn_gaming/theme_blockleft.html"}> 
                                                      <{/foreach}> 
                                                      
                                                      
                                                  
                                                
                                              
                                            images/r_side.gif">images/r_side_lrg.gif" />
                                          
                                           
                                            images/l_bottom.gif" />
                                            images/bottom.gif" width="100%">
                                            images/r_bottom.gif" />
                                          
                                          
                                        
                                      
                                      <{/if}>
                                    <{if $xoops_contents}> 
                                      
                                        
                                        
                                        
                                           
                                            images/l_top.gif" />
                                            images/top.gif" width="100%"> 
                                            images/r_top.gif" />
                                          
                                           
                                            images/l_side.gif">images/l_side_lrg.gif" />
                                            images/c-bg.gif">
                                                
                                                   
                                                     

<{$xoops_contents}>


                                                  
                                                
                                              
                                            images/r_side.gif">images/r_side_lrg.gif" />
                                          
                                           
                                            images/l_bottom.gif" />
                                            images/bottom.gif" width="100%">
                                            images/r_bottom.gif" />
                                          
                                          
                                        
                                      
                                      <{/if}> <{foreach 
                                      item=block from=$xoops_ccblocks}><{include 
                                      file="tswn_gaming/theme_blockcenter_c.html"}> 
                                      <{/foreach}> 
                                      
                                      
                                  
                                
                            
                          
                        

                    
                  
              
               
                 images/5t3.jpg" WIDTH=628 HEIGHT=15 ALT="">
              
            
           
               
                images/bak2.jpg" WIDTH=70 HEIGHT=100%> 
                  images/5.jpg" WIDTH=70 HEIGHT=319 ALT="">
              
               
                 images/6.jpg" WIDTH=70 HEIGHT=59 ALT="">
              
            
        
      
  
   
    images/1.jpg" WIDTH=766 HEIGHT=73 ALT=""> 
      







    >
  
   
    images/l3.jpg" width="50%" height="100%">
    images/bot.jpg" WIDTH=766 HEIGHT=100% ALT="">
    images/r3.jpg" width="50%" height="100%"> 
  




Just copy the second code group and edit it in your favorite html editor, and you will see at about line 1625 where the code goes.
Tim
http://www.tswn.com | http://www.bf2online.com | aquaria.tswn.com | http://www.bf2142online.org

3
DefJef
Re: Pop up a "you have a new private message" when inbox has new msg?
  • 2005/8/18 3:20

  • DefJef

  • Just popping in

  • Posts: 53

  • Since: 2005/8/8 2


Thanks for the help!

So...insert that entire code into any place in my theme.html?

Sorry it was a little unclear.

Thanks again,
Jeff

4
talunceford
Re: Pop up a "you have a new private message" when inbox has new msg?

Well, that code is just an example of how to do it. You will probably have to customize the code to suit your own theme.html file.
Tim
http://www.tswn.com | http://www.bf2online.com | aquaria.tswn.com | http://www.bf2142online.org

5
piroman
Re: Pop up a "you have a new private message" when inbox has new msg?
  • 2005/8/18 6:05

  • piroman

  • Just popping in

  • Posts: 87

  • Since: 2004/9/7 2


Hi talunceford,

could you comment the code, so we can alter it to suit our needs?

Kinda FAQ for priv msg. popup :)
regs
Piroman

visit our cicihlid gallery:
gallery.ciklidi.org

6
talunceford
Added Additional Code

Quote:

talunceford wrote:
I doubt that would be too hard at all. It can be easily done with an "if" statement in your theme.html file.

<{php}> GLOBAL $xoopsUser$pm_handler =& 
                                      
xoops_gethandler('privmessage'); $uid 
                                      
$xoopsUser->getVar('uid'); $criteria = new 
                                      
CriteriaCompo(new Criteria('read_msg'0)); 
                                      
$criteria->add(new Criteria('to_userid'
                                      
$uid)); $msgcount $pm_handler->getCount($criteria); 
                                      
$GLOBALS['xoopsTpl']->assign('msgcount'
                                      
$msgcount); <{/php}>
                                      
                                       <{if 
$msgcount }>
                                      <
table><tr><td width="2" align="center" valign="middle"><img src="<{$xoops_imageurl}>images/site_top_div.gif" width="2" height="37" onload="MM_popupMsg('You have a new Private Message')" />td>tr>table>
                                      <{else}>
                                       <
table><tr><td width="2" align="center" valign="middle"><img src="<{$xoops_imageurl}>images/site_top_div.gif" width="2" height="37" />td>tr>table>
                                       <{/if}>


Here is an example of the theme.html file that I use for tswn.com

xml version="1.0" encoding="windows-1251"?>




" />
" />
" />
" />
" />
" />
" />

<{$xoops_sitename}> - <{$xoops_pagetitle}>
/favicon.ico" rel="SHORTCUT ICON" />




<{$xoops_module_header}> 
























































































 

   
    
         
          images/l1.jpg" WIDTH=100% HEIGHT=100%  bgcolor="#6D6F6D" style="background-repeat:repeat-x; background-position:top ">
        
         
          images/l2.jpg" WIDTH=100% HEIGHT=132 ALT="">
        
      
    
        flash/main.swf">
        
        flash/main.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="766" height="286"> 
      
    
         
          images/r1.jpg" WIDTH=100% HEIGHT=100%  bgcolor="#6D6F6D" style="background-repeat:repeat-x; background-position:top ">
        
         
          images/l2.jpg" WIDTH=100% HEIGHT=132 ALT="">
        
      
  
   
     images/2.jpg" WIDTH=766 HEIGHT=13 ALT="">
  
   
     
         
           
               
                images/bak1.jpg" WIDTH=68 HEIGHT=100%> 
                  images/3.jpg" WIDTH=68 HEIGHT=319 ALT="">
              
               
                 images/4.jpg" WIDTH=68 HEIGHT=59 ALT="">
              
            
           
               
                images/5t1.jpg" WIDTH=628 HEIGHT=34 ALT=""> 
                  

              
               
                images/5bak1.jpg"  WIDTH=628 HEIGHT=100% >images/5t2.jpg" WIDTH=628 HEIGHT=100% style="background-repeat:no-repeat "   border="0" cellspacing="0" cellpadding="0">
                     
                        
                          
                             
                               
                                <{if $xoops_isuser}>  
                                  
                                     
                                      images/site_top_div.gif" height="37" width="2" />
                                       
                                        Your Account
                                          images/spacer.gif" height="10" width="1" /> 
                                        



                                        
                                        
                                           
                                            images/l_top.gif" width="32" />
                                            images/top.gif" width="100%"> 
                                                NAVIGATION

                                            images/r_top.gif" />
                                          
                                           
                                            images/l_side.gif">images/l_side_lrg.gif" />
                                            images/c-bg.gif">
                                                
                                                   
                                                    

                                                      <{foreach item=block from=$xoops_lblocks}><{include 
                                                      file="tswn_gaming/theme_blockleft.html"}> 
                                                      <{/foreach}> 
                                                      
                                                      
                                                  
                                                
                                              
                                            images/r_side.gif">images/r_side_lrg.gif" />
                                          
                                           
                                            images/l_bottom.gif" />
                                            images/bottom.gif" width="100%">
                                            images/r_bottom.gif" />
                                          
                                          
                                        
                                      
                                      <{/if}>
                                    <{if $xoops_contents}> 
                                      
                                        
                                        
                                        
                                           
                                            images/l_top.gif" />
                                            images/top.gif" width="100%"> 
                                            images/r_top.gif" />
                                          
                                           
                                            images/l_side.gif">images/l_side_lrg.gif" />
                                            images/c-bg.gif">
                                                
                                                   
                                                     

<{$xoops_contents}>


                                                  
                                                
                                              
                                            images/r_side.gif">images/r_side_lrg.gif" />
                                          
                                           
                                            images/l_bottom.gif" />
                                            images/bottom.gif" width="100%">
                                            images/r_bottom.gif" />
                                          
                                          
                                        
                                      
                                      <{/if}> <{foreach 
                                      item=block from=$xoops_ccblocks}><{include 
                                      file="tswn_gaming/theme_blockcenter_c.html"}> 
                                      <{/foreach}> 
                                      
                                      
                                  
                                
                            
                          
                        

                    
                  
              
               
                 images/5t3.jpg" WIDTH=628 HEIGHT=15 ALT="">
              
            
           
               
                images/bak2.jpg" WIDTH=70 HEIGHT=100%> 
                  images/5.jpg" WIDTH=70 HEIGHT=319 ALT="">
              
               
                 images/6.jpg" WIDTH=70 HEIGHT=59 ALT="">
              
            
        
      
  
   
    images/1.jpg" WIDTH=766 HEIGHT=73 ALT=""> 
      







    >
  
   
    images/l3.jpg" width="50%" height="100%">
    images/bot.jpg" WIDTH=766 HEIGHT=100% ALT="">
    images/r3.jpg" width="50%" height="100%"> 
  




Just copy the second code group and edit it in your favorite html editor, and you will see at about line 1625 where the code goes.
Tim
http://www.tswn.com | http://www.bf2online.com | aquaria.tswn.com | http://www.bf2142online.org

7
WarDick
Re: Added Additional Code
  • 2005/8/18 12:23

  • WarDick

  • Just can't stay away

  • Posts: 890

  • Since: 2003/9/13


There is a module call pmblock that is produced by brandycoke. I have just visited his website it is no longer listed.

I have it working with both of the latest versions of xoops. I will not post a link because of the hack attacks. If you would like a copy pm me.
Urging XOOPS to be the Best It Can Be.
Richard......

8
mitsugari
Re: Added Additional Code
  • 2005/8/18 13:49

  • mitsugari

  • Just popping in

  • Posts: 22

  • Since: 2005/8/11


With talunceford's code I am getting a "member function on a non-object" type of error. Must be something with the way $xoopsUser is accessed? Can someone post corrected code that works with XOOPS 2.2.2?

9
Mithrandir
Re: Added Additional Code

$uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

10
DefJef
Re: Added Additional Code
  • 2005/8/26 3:30

  • DefJef

  • Just popping in

  • Posts: 53

  • Since: 2005/8/8 2


I use XOOPS 2.2.2

Is there any way I can insert a code snippet into a file that would popup a "You have a new Private Message" window? The format could be html or even one of those alert windows. Whatever is easiest. I feel this is an important part of a website. Also, an email alert of a new private message (something i believe there is another topic about.)

OK, Thanks!

Sincerely,
Jeff

You can reply to this topic, it is on my notificiations list

Login

Who's Online

280 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 280


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits