PDA

View Full Version : Get User Unread PMs


MorfiusX
02-23-2009, 11:48 AM
I am integrating vBulletin into my CMS. I need to retrieve the current user's unread PM count. This is done on a page outside of VB, but on the same server so I have access to the global.php. Cookies are already set at the point when I need to retrieve the count. Any suggestions?

TIA.

mmoore5553
02-23-2009, 04:22 PM
what CMS are you using ? do you have screenshot where it is pulling from now ? and where you want it ?

MorfiusX
02-23-2009, 06:51 PM
I am using Joomla as a CMS. I am using JFusion to authenticate Joomla users against vBulletin. JFusions has a module for Joomla that does pull the info needed, but it doesn't fit well into the site I'm working on.

The site is DaytonSoftball.net. Here is a screenshot:
http://img209.imageshack.us/img209/7672/temp.jpg

I want the unread message count in the top right corner link. So, it would say "Messages (X New)" or similar. The module mentioned is on the left.

The VB site and Joomla site respond to separate host names, however they are using the same instance of Apache and are on the same server. (They are different virtual hosts).

When a user logs in via JFusion, it sets the cookie for both Joomla and VB. So I need to query the current user's message count.

Thanks.

mmoore5553
02-23-2009, 07:52 PM
add me to msn and we can discuss i think i can do this but not really sure ..i have experience in joomla and vb ... i sent my msn to your PM .

Dismounted
02-24-2009, 04:27 AM
The number is contained inside a variable:
$vbulletin->userinfo['pmunread']

MorfiusX
02-24-2009, 10:47 AM
The JFusion logon module sets cookies for both Joomla and VB. So, I copied it and modified the layout to fit my site.

I would like to not rely on a third party plugin, so I will continue pursuing the original topic.

After loading the global.php as mentioned here (https://vborg.vbsupport.ru/showthread.php?t=187388), how to I pass it a current user value or id? When I try to query a value from $vbulletin->userinfo, I get nothing returned. I'm assuming it's because no user has been specified?

Marco van Herwaarden
02-24-2009, 10:56 AM
If a user is logged in, his information is already available in $userinfo.

MorfiusX
02-24-2009, 11:01 AM
I'll check my cookies. I think I had the cookie domain set just for the forum and not the whole domain. (I didn't have it set to .daytonsoftball.net).

--------------- Added 1235502001 at 1235502001 ---------------

I tested a separate file that includes the following code:
// vBulletin
$curdir = getcwd();
chdir('/var/www/forum.daytonsoftball/');
include('./global.php');
chdir($curdir);
Everything works properly and I can call variables as documented.

When I insert the code into my Joomla template file, I get the following error:
Fatal error: Call to a member function query_read_slave() on a non-object in /var/www/forum.daytonsoftball/includes/functions.php on line 3189

The only thing I can figure on looking through the functions.php is that it is error on the SQL statement in the file. This may be due to a quoting issue, but I'm not exactly sure. Any suggestions?

Dismounted
02-25-2009, 06:51 AM
Did you try to do that inside of a function?

Shadab
03-29-2009, 04:03 PM
Did you try to do that inside of a function?
I'm trying to do something similar.
What extra to we need to do when starting vBulletin from inside a Function ?

I remember there was a thread here, or at vb-com that discussed exactly the same issue;
just that I can't seem to find it now. :confused:

MorfiusX
03-29-2009, 05:41 PM
I'm trying to do something similar.
What extra to we need to do when starting vBulletin from inside a Function ?

I remember there was a thread here, or at vb-com that discussed exactly the same issue;
just that I can't seem to find it now. :confused:

Being that I was trying to execute code from a template from within Joomla, this is probably generated from within a function. For whatever reason, the code posted on several would not work inside the Joomla template, but work fine in a static html page. I use JFusion to authenticate Joomla users agains vBulletin which includes a module to login users. I modified this module to do what I needed.