Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2009, 11:48 AM
MorfiusX MorfiusX is offline
 
Join Date: Nov 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 02-23-2009, 04:22 PM
mmoore5553 mmoore5553 is offline
 
Join Date: Aug 2008
Posts: 530
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what CMS are you using ? do you have screenshot where it is pulling from now ? and where you want it ?
Reply With Quote
  #3  
Old 02-23-2009, 06:51 PM
MorfiusX MorfiusX is offline
 
Join Date: Nov 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 02-23-2009, 07:52 PM
mmoore5553 mmoore5553 is offline
 
Join Date: Aug 2008
Posts: 530
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 .
Reply With Quote
  #5  
Old 02-24-2009, 04:27 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The number is contained inside a variable:
PHP Code:
$vbulletin->userinfo['pmunread'
Reply With Quote
  #6  
Old 02-24-2009, 10:47 AM
MorfiusX MorfiusX is offline
 
Join Date: Nov 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #7  
Old 02-24-2009, 10:56 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If a user is logged in, his information is already available in $userinfo.
Reply With Quote
  #8  
Old 02-24-2009, 11:01 AM
MorfiusX MorfiusX is offline
 
Join Date: Nov 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #9  
Old 02-25-2009, 06:51 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you try to do that inside of a function?
Reply With Quote
  #10  
Old 03-29-2009, 04:03 PM
Shadab's Avatar
Shadab Shadab is offline
 
Join Date: Apr 2007
Location: Bhopal
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:07 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.04191 seconds
  • Memory Usage 2,248KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete