vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Get User Unread PMs (https://vborg.vbsupport.ru/showthread.php?t=206332)

MorfiusX 02-23-2009 11:48 AM

Get User Unread PMs
 
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:
PHP Code:

$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, 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 [DATE]1235502001[/DATE] at [TIME]1235502001[/TIME] ---------------

I tested a separate file that includes the following code:
PHP 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

Quote:

Originally Posted by Dismounted (Post 1753998)
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

Quote:

Originally Posted by Shadab (Post 1779751)
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.


All times are GMT. The time now is 05:49 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01117 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (11)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete