The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
External PHP File - Display User Location in "Who's Online"
Hey all,
I have a question regarding external files. To start off: - I have vBulletin installed to mysite.com/forums. - I have a homepage at mysite.com/index.php (which has working login to forums) However, I've been unable to figure out what needs to be done so, if a user is viewing mysite.com/index.php, their User Location would read something like "Viewing Homepage SITENAME". Essentially, I want it so there's a custom User Location that displays when a user is viewing mysite.com/index.php, because right now, the User Location only updates if the user is browsing any file in mysite.com/forums Thanks for any and all help, Mark |
#2
|
|||
|
|||
You may be able to do it with a couple of plugins - I guess it depends on how the login on your home page is implemented. But if you look at this article https://vborg.vbsupport.ru/showthread.php?t=228112 and scroll to the bottom to the section "Instructions to Add your Page to the Who's Online List (WOL):", there's an example of the two plugins you need.
|
#3
|
||||
|
||||
Quote:
Anyways, I gave your attempt a try. The location in the `session` table on my forums updates correctly (it displays / which means I'm on my homepage). Yet, on my Current Activity, it says 'Viewing Index SITENAME' instead of what is defined through the plugins you linked me to. |
#4
|
|||
|
|||
Hmm...well, whatever you set $userinfo['activity'] to in the first plugin is the case you want to check for in the second plugin (it's 'mypage' in the example) - do you have yours that way? I think if the session table is showing '/' that must mean you used '/' and that the first plugin is working.
Edit: is your homepage called index.php? I suppose that might conflict with some of the existing cases. |
#5
|
||||
|
||||
Quote:
Would renaming it to home.php be of some use? P.S. For the Plugin online_location_process: switch ($filename) { case '../': Would '../' be correct, or would it need to be './' if I'm trying to evaluate the case of a file outside of my /forums/ directory? |
#6
|
|||
|
|||
Quote:
Code:
if (THIS_SCRIPT == 'homepage') { $filename = 'homepage'; } Then in the online_location_process plugin use case 'homepage'. Quote:
I'm not sure - I'd probably need to set up a test and then print out the value to know for sure. But if the above works, then it won't matter. |
#7
|
||||
|
||||
Quote:
My current online_location_process: Code:
switch ($filename) { case '../home.php': $userinfo['activity'] = 'homepage'; break; } Code:
switch ($userinfo['activity']) { case 'homepage': $userinfo['where'] = '<a href="test.php?'.$vbulletin->session->vars[sessionurl].'">My Page</a>'; $userinfo['action'] = "Viewing My Page"; break; } Also, for your snippet for online_location_preprocess, would I have to change the case in my online_location_process plugin to be 'homepage' instead of the filepath? |
#8
|
|||
|
|||
I think you only need the file name, so maybe try using case 'home.php': and don't put any path.
Quote:
Yes, I believe so. |
#9
|
||||
|
||||
Quote:
I've tried: /home.php, ./home.php, ../home.php, /../home.php, ./../home.php, ../../home.php, home.php, and homepage. |
#10
|
|||
|
|||
Yeah, you know, someone asked about this a while back and I made the same mistake - it doesn't work to check THIS_SCRIPT because that doesn't run until someone goes to look at the who's online info.
The idea of changing the script to home.php might work but I think maybe you need to call the function exec_shut_down() in your script or else the location never gets updated in the session table. (I think you can call it any time you're done with the vb part). And you don't need the online_location_preprocess plugin for that method. (While you're trying that I'm going to look in to it more). |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|