The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Custom vB5 page?
Some years ago I used Lynne's excellent article "[HOW TO - vB4] Create your own vBulletin page" (https://vborg.vbsupport.ru/showthread.php?t=228112) to make a vB4 page outside the vB4 forum that used vBulletin variables and member info to build a Google Maps page that could store member's map data such as points of interest, routes, etc. (One such page is at http://www.roadtripamerica.com/maps/mapwizard.php)
Is this possible to do in vB5, and keep the same URL without using a redirect? It seems that the customizable pages in vB5, able to access user info, are only forum subdirectories. Right now I don't see how to access vB variables and user data from a page outside the forum. I would love to see something like Lynne's article for vB5. Thanks, Michael H. Dickman |
#2
|
||||
|
||||
I use ajax to get logged in user info when needed via javascript.
http://yoursite.com/[forum root]/ajax/api/user/fetchCurrentUserinfo This will yield a plethora of useful and useless information in a JSON object that you can use in your custom page. The following example will report back the username of the logged in user or alert to login. Example, edit the url in the code.: Code:
<html> <body> <h1 class="username"></h1> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script> $.ajax({ url: 'http://yoursite.com/[forum root]/ajax/api/user/fetchCurrentUserinfo', type: "POST", dataType: 'json', success: function(response) { if (response && !response['errors'] && response['userid'] !=0) { $( ".username" ).append( response['username'] ); } else { alert('You must login!'); } } }); </script> </body> </html> |
Благодарность от: | ||
MarkFL |
#3
|
||||
|
||||
You don't want to just go to Site Builder > New Page and then just add an HTML or PHP Module onto the page? That will create a 'custom' page within vB5.
vB5_User::get('userid') is the variable you would use in a PHP module to get the userid. And vB5_User::get('username') is the username. |
Благодарность от: | ||
MarkFL |
#4
|
|||
|
|||
I didn't see a way to use Site Builder that wouldn't generate a file in a subdirectory of the Forum. Is there one? Maybe I just overlooked it.
|
#5
|
||||
|
||||
So you want to create a page that does not have the same main URL of your forum? You would need to create it totally separate from vbulletin if that is the case.
|
#6
|
|||
|
|||
Yes, the issue is that the original page e.g., www.roadtripamerica.com/maps/mapwizard.php, is not a forum subdirectory, and using a redirect would affect SEO. So when upgrading from vB4 to vB5 ideally we want to keep the same URL without a redirect. But if there's no way to generate a page outside the forum subdirectory using Site Builder then I need some other way to access the vB member variables so the correct info can be displayed. Using Ajax seems doable, even if it's a bit of a sledgehammer approach.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|