Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2016, 10:11 PM
michaeld42 michaeld42 is offline
 
Join Date: Jan 2010
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 01-04-2016, 11:45 PM
Replicant's Avatar
Replicant Replicant is offline
 
Join Date: Sep 2014
Location: Phoenix, Az. USA
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
Благодарность от:
MarkFL
  #3  
Old 01-05-2016, 04:18 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Благодарность от:
MarkFL
  #4  
Old 01-05-2016, 08:53 PM
michaeld42 michaeld42 is offline
 
Join Date: Jan 2010
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 01-06-2016, 05:12 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 01-06-2016, 08:51 PM
michaeld42 michaeld42 is offline
 
Join Date: Jan 2010
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


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:10 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05175 seconds
  • Memory Usage 2,210KB
  • 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
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (2)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete