Skip to content
WJunction - Webmaster Forum

[phpbb3] New PM Customizeable lightbox

Status
Not open for further replies.
This mod will create a "lightbox" New PM notification.

NOTE: This modification requires that "notify me on new private messages" be enabled in your UCP.

[slide]http://imgcentre.com/img/uploads/big/39cf905e8f.png[/slide]
1) Download RokBox STANDALONE:
Code:
[URL]http://rocketwerx.com/products/rokbox/download[/URL]
2) Upload the folder "rokbox" from the zip file to your "public_html" root folder.

3)

IN: Overall_header.html

Find and REMOVE:
Code:
    <!-- IF S_USER_PM_POPUP -->
        if ({S_NEW_PM})
        {
            var url = '{UA_POPUP_PM}';
            window.open(url.replace(/&amp;/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
        }
    <!-- ENDIF -->
Find:
Code:
</head>
Add BEFORE:
Code:
<script type="text/javascript" src="rokbox/mootools-release-1.11.js"></script>

<script type="text/javascript" src="rokbox/rokbox.js"></script>
<link href="rokbox/themes/dark/rokbox-style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="rokbox/themes/light/rokbox-config.js"></script>
Find:
Code:
<body
In-Line, add After:
Code:
onload="<!-- IF S_DISPLAY_PM -->clickElement('myclicker')<!-- ENDIF -->"
Find:
Code:
<div id="wrap">
Add Before:
Code:
<!-- IF S_DISPLAY_PM -->
<a id="myclicker" rel="rokbox[320 40][module=privmsg]" href="#" title="" accesskey="l"></a>
<!-- ENDIF -->
IN: Overall_Footer.html

Find:
Code:
</body>
Add BEFORE:
Code:
<!-- IF S_DISPLAY_PM -->
<!-- INCLUDE newPM.html -->

<script type="text/javascript">
function clickElement(elementid){
if ({S_NEW_PM})
{
var e = document.getElementById(elementid);
    if (typeof e == 'object') {
        /*if(typeof e.click != 'undefined') {
            e.click();
            alert('click');
            return false;
        }
        else */
        if(document.createEvent) {
            var evObj = document.createEvent('MouseEvents');
            evObj.initEvent('click',true,true);
            e.dispatchEvent(evObj);
            return false;
        }
        else if(document.createEventObject) {
            e.fireEvent('onclick');
            alert('createEventObject');
            return false;
        }
        else {
            e.click();
            alert('click');
            return false;
        }
    }
}
}
</script>
<!-- ENDIF -->
ok.
Create a new file in /styles/myTemplate/template called "newPM.html" and paste the following

into it, or create your own:

Code:
<style type="text/css">
#privmsg {display: none;}
</style>

<div id="privmsg">
<center>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" style="padding-left: 6px;">
You have a new message. Would you like to read it?
</td>
</tr>
</table>
<br />
<a href="ucp.php?i=pm&folder=inbox"><button type="button">Yes</button></a>
&nbsp;&nbsp;
<a href="#" onClick="javascript:rokbox.close()"><button type="button">No</button></a>
</center>
</div>
PURGE CACHE. DONE.

CUSTOMIZING:

To change the color of the lightbox, the rokbox theme path must be changed:

Dark:
Code:
<link href="rokbox/themes/dark/rokbox-style.css" rel="stylesheet" type="text/css" />
Light:
Code:
<link href="rokbox/themes/light/rokbox-style.css" rel="stylesheet" type="text/css" />
To change the layout of the alert, simply edit "/styles/myTheme/Template/newPM.html"

This modification uses MooTools. More modifications will be added by me to further use these tools.
 

6 comments

Status
Not open for further replies.

About the author

jayfella
Active Member · Joined
1,600
Messages
565
Reactions
113
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom