vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   External PHP File - Display User Location in "Who's Online" (https://vborg.vbsupport.ru/showthread.php?t=293798)

kh99 01-10-2013 11:33 PM

OK, this seems to work: name your script home.php, add a call to exec_shut_down(), then in the online_location_process plugin use case 'home.php' (with no path). Then just make sure whatever string you use for $userinfo['activity'] is the same one you use in the case in the online_location_unknown plugin.

Mko 01-11-2013 01:06 AM

Quote:

Originally Posted by kh99 (Post 2396125)
OK, this seems to work: name your script home.php, add a call to exec_shut_down(), then in the online_location_process plugin use case 'home.php' (with no path). Then just make sure whatever string you use for $userinfo['activity'] is the same one you use in the case in the online_location_unknown plugin.

Still doesn't work. For the plugins I'm calling inside vB:
online_location_process:
PHP Code:

switch ($filename)
{
    case 
'home.php':
        
$userinfo['activity'] = 'homepage';
        break;


online_location_unknown:
PHP Code:

switch ($userinfo['activity'])
{
    case 
'homepage':
        
$userinfo['where'] = '<a href="home.php?'.$vbulletin->session->vars[sessionurl].'">Homepage</a>';
        
$userinfo['action'] = "Viewing Homepage";
        break;


Thanks for the continued help ^_^

kh99 01-11-2013 11:11 AM

Hmm...I don't see anything wrong with that. When you look at the session table what does it say now? If it doesn't say home.php (possibly with a path in front of it) then I think it means it's still some issue with your home.php script. If it does have home.php in it then it's something to do with one of the plugins.

Mko 01-11-2013 05:46 PM

Quote:

Originally Posted by kh99 (Post 2396205)
Hmm...I don't see anything wrong with that. When you look at the session table what does it say now? If it doesn't say home.php (possibly with a path in front of it) then I think it means it's still some issue with your home.php script. If it does have home.php in it then it's something to do with one of the plugins.

The location that's stored in the database when I view home.php is:
/

Not sure how I'd get around that :s

kh99 01-11-2013 06:11 PM

Quote:

Originally Posted by Mko (Post 2396278)
The location that's stored in the database when I view home.php is:
/

Not sure how I'd get around that :s


Yeah, I'm not sure why that is. I created a file named 'test.php' that just does a chdir to the forum directory and includes global.php, then calls exec_shut_down(), and when I browse to that file then look at the session table it says "./test4.php".

Is there anything else in your script that might access a vbulletin page?

Mko 01-11-2013 06:14 PM

Quote:

Originally Posted by kh99 (Post 2396284)
Yeah, I'm not sure why that is. I created a file named 'test.php' that just does a chdir to the forum directory and includes global.php, then calls exec_shut_down(), and when I browse to that file then look at the session table it says "./test4.php".

Is there anything else in your script that might access a vbulletin page?

Whoops, was an error on my part. Sorry :(
Now, when I go to mysite.com/home.php, the value in the `session` table is actually /home.php! So, the value's getting stored in the table. All that we need to do is to get rid of that pesky Unknown Location :c

Do you think this can still be accomplished through those two plugins, or would there need to be some other modifications done to accomplish this?

Thanks for your continued help :)

--------------- Added [DATE]1357935560[/DATE] at [TIME]1357935560[/TIME] ---------------

I've fixed it! Turns out that the plugins I had added didn't work - they were designed for vB4, not vB3 :c

My final result:
online_location_process:
PHP Code:

if ($filename == 'home.php') { 
    
$userinfo['activity'] = 'homepage'


online_location_unknown:
PHP Code:

if ($userinfo['activity'] == 'homepage') { 
    
$userinfo['action'] = "Viewing Homepage";
    
$userinfo['where'] = "<a href='google.com'>Google</a>";
    
$handled true


As always, thanks for your help! I really appreciate it :)


All times are GMT. The time now is 08:16 AM.

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.02250 seconds
  • Memory Usage 1,744KB
  • 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
  • (4)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete