Whos Online Titles
Prerequisite: [HowTo] Add Custom Pages to WOL
If you have spent any time adding your custom scripts to show up as valid locations, you have probably wondered how to get the title of the blog entry, download, help ticket, store item, etc... For my example, I'll base it on my project I was working on which was a blog system. Assuming the user views viewblog.php?userid=1, we can access the userid value of 1 using the 'values' element of $userinfo. The values element contains all the $_GET info of the user that was viewing. PHP Code:
The next step is to retrieve those titles that we need, and to do this we use the "online_ids_titles" hook. PHP Code:
The final step is to show the data... in my plugin in the "online_location_unknown" hook, I have a switch for $userinfo['activity'] (which is defined above), so I can assign the text and newly retrieved title of the blog. PHP Code:
To make any use of this, you will have to heavily modify it to work with your table structure and vb extension, but this should give you enough of an idea how to do it to be at least somewhat successfull. |
Worked great! Thank you so much for this. I don't know how many times and on how many forums I have asked this. Thanks again :)
alright, just one question plz. How do I get a third variable available for userinfo[where]. Say we have id and title, I also want to extract url column value from database to use in the location path. I am able to do it by querying url ofcourse and creating another global variable $wol_urls. Just wanted to know if its the best way. Thanks |
All times are GMT. The time now is 07:33 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|