PDA

View Full Version : vBMS Module?


thejaxx
12-06-2004, 11:44 AM
Has anyone used this? vBMS (http://www.webdesignforums.net/vbms/)?

I just got it installed on my system and have been trying to figure out how to add a module that will show how many messages, including new mail, the member has when they log in or come to the site.

Thanks.

Zachery
12-06-2004, 11:59 AM
Well I've not seen the code, I don't think Brian has either, I will see about getting a copy from Filburt for testing purpuses soley :)

Our Sponsors
 

thejaxx
12-06-2004, 12:12 PM
Great. :)

Thanks again

Brian
12-06-2004, 12:14 PM
Nope, haven't seen the code. I'll be glad to take a look when I have some free time if Filburt doesn't mind though. :)

Our Sponsors
 

thejaxx
12-06-2004, 11:47 PM
Ok, Got the following response from Filburt today and messed around with it. Finally have become a little flustered, was able to get nothing but errors when I tried. Might be the flu meds i'm on and lack of sleep though.

He said I could share the following info:


To get the total number of messages:

$result = $DB_site->query_first("SELECT COUNT(messageid) AS messagecount FROM " . TABLE_PREFIX . "vbms_message WHERE userid = " . $bbuserinfo['userid']);
$messagecount = $result['messagecount'];

If you want to get just the unread count, look in the header template.


The header template is the following currently:

<!-- vBMS new mail notification -->
<if condition="$vboptions['vbms_enabled'] and $vboptions['vbms_headernotification'] and $vbms_newmessages['newcount'] > 0">
<br />
<table cellpadding="$stylevar[outerborderwidth]" cellspacing="0" border="0" class="tborder" width="$stylevar[tablewidth]" align="center">
<tr>
<td>

<table cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<tr>
<td class="thead" colspan="2"><span style="float:right; font-weight:normal">$vbphrase[vbms_powered_by_vbms]</span><b>$vbphrase[vbms_you_have_new_email]</b>
</td>
</tr>

<tr>

<td class="alt2" style="width:30px; text-align:center; overflow:hidden; padding:1px; vertical-align:middle">
<span style="font-family:'Trebuchet MS', Verdana, Tahoma, Arial, sans-serif; font-weight:bold; font-size:xx-large">!</span>
</td>

<td valign="top" class="alt1">
<b>

<if condition="$vbms_newmessages['newcount'] == 1">
$vbphrase[vbms_one_unread_message]
<else />
<phrase 1="$vbms_newmessages[newcount]">$vbphrase[vbms_x_unread_messages]</phrase>
</if>
</b><br />

<span class="smallfont"><phrase 1="vbms.php?$session[sessionurl]">$vbphrase[vbms_to_read_your_email]</phrase>
</span>

</td>
</tr>
</table>
</td>
</tr>
</table>
</if>
<!-- / vBMS new mail notification -->

thejaxx
12-08-2004, 10:09 AM
Ok, i've basically pulled out what little hair I have left and the lady is getting upset with that. But I'm a rock, I have not been successful at getting this to work. I KNOW i'm missing something.

I'm able to get it to show total # of messages, but not how many new.

Brian
12-08-2004, 11:43 AM
You would need to find out what column determines if the message is new, and then add a seperate query to count those.

phlogiston
12-08-2004, 12:25 PM
try putting
<if condition="$vbms_newmessages['newcount'] == 1">
$vbphrase[vbms_one_unread_message]
<else />
<phrase 1="$vbms_newmessages[newcount]">$vbphrase[vbms_x_unread_messages]</phrase>
</if>

into the template you're using to display the template, the variables should all be available without extra queries for these ones

thejaxx
12-08-2004, 12:57 PM
I've tried that but all I ever get is:

You have messages that have not been read.

Even if the mailbox is emtpy.

phlogiston
12-08-2004, 01:11 PM
hrmm, works for me - do you have Enable header notification? set to yes in the vbms options?

thejaxx
12-08-2004, 01:27 PM
Yes it is. I even cleared out the catch-all from the spam, just in case.

If you don't mind IM'ing me, I would appreciate the help.

Aim: Talalden
yahoo: lvjaxx

phlogiston
12-08-2004, 02:37 PM
sorry - no IM things here :(

$vbms_newmessages[newcount] should be set and available for any template as far as I can tell but seems to be empty going by your You have messages that have not been read.

A site I admin has just ported over to the vba gallery so I don't really have time to look any deeper, consider me beaten!
But if the variable is not set then maybe Filburt would be the best to ask :S

Brian
12-08-2004, 02:53 PM
$vbms_newmessages[newcount] should be set and available for any template as far as I can tell but seems to be empty going by your [i]You have messages that have not been read.
The query he's using is different though. If you have a sec and can post the query you have that may help. :)

phlogiston
12-08-2004, 03:27 PM
Okay this is what I have done & what I got:



(clean install of vBMS)
Create new vba CMPS module ("vbms")
vbms module includes no extra file just a template (again vbms)


Edit php_include_start template to contain:
require_once("./includes/vbms_frontend_init.php");

$result = $DB_site->query_first("SELECT COUNT(messageid) AS messagecount FROM " . TABLE_PREFIX . "vbms_message WHERE userid = " . $bbuserinfo['userid']);
$messagecount = $result['messagecount'];

The require_once statement was added by the vbms install, the rest is simply the query posted above originally from Filburt.


New Template called adv_portal_vbms containing:
<!-- vbms module -->

<if condition="$vboptions['vbms_enabled']">
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
<tr>
<td class="tcat"><span class="smallfont"><strong>$vba_options[portal_blockbullet] <a href="$vboptions[bburl]/vbms.php?$session[sessionurl]">vBulletin Mail System</a></strong></span>
</td>
</tr>
</thead>
<tr>
<td class="$getbgrow" width="100%">
<b>
<if condition="$vbms_newmessages['newcount'] == 1">
$vbphrase[vbms_one_unread_message]
<else />
<phrase 1="$vbms_newmessages[newcount]">$vbphrase[vbms_x_unread_messages]</phrase>
</if>
</b><br /><br />
You have $messagecount emails stored in total .<br /><br />
<span class="smallfont"><phrase 1="vbms.php?$session[sessionurl]">$vbphrase[vbms_to_read_your_email]</phrase></span>
</td>
</tr>
</table>
<br />
</if>

<!-- End vbms module -->

It's not very tidy or pretty but it's a start :)

Screenshot of the module as I see it is attached to this post

thejaxx
12-08-2004, 03:30 PM
Ah ha!

I see what i did wrong.

Thank you VERY much. :) Now maybe my members will stop hounding me as to what the heck i'm doing to cause parse erros on the page. LOL

phlogiston
12-08-2004, 03:36 PM
Looking at this again the query Filburt posted to get total messages would probably be best placed in the vbms frontend init file where you could expand it to get other info most likely - such as folders & subject previews and the like. But that's vBMS file editting so not for posting here!

If you have a secwho told you that was all it took to distract me from what I'm meant to be doing! :rolleyes: :D

phlogiston
12-08-2004, 03:38 PM
Ah ha!

I see what i did wrong. cool :)

(I bet it was a rogue missing semi-colon, that's what always out-foxes me! ;))