Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-14-2012, 10:50 AM
Disco_Stu Disco_Stu is offline
 
Join Date: Apr 2012
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do I call up the login required prompt from java

Can someone please tell me what function I would execute to display the standard prompt to require the user to login or register? I want to call this from a javascript function in an html forum block.

The display I want to use is the message box with the normal system message:

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

You are not logged in. Fill in the form at the bottom of this page and try again.
You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.




Thanks.
Reply With Quote
  #2  
Old 05-14-2012, 10:59 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I believe that's the message that you get when you call the php function print_no_permission(); But you can't call it directly from javascript, and there is no php script that will simply call that function (although there are probably a number of them that would display that if the user was logged out). I suppose you could write one, or use a plugin in misc.php, but to be honest I'm having trouble seeing what would happen after that message was displayed (the user would log in obviously, but then where would it take you?).
Reply With Quote
  #3  
Old 05-14-2012, 11:57 AM
Disco_Stu Disco_Stu is offline
 
Join Date: Apr 2012
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hopefully back to where you were before the message was displayed
Reply With Quote
  #4  
Old 05-14-2012, 12:41 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I guess that does make sense. And if you call print_no_permission() it should display the message you want, and it then returns to the page it was called from. But I'm not sure how you'd use that because if it was part of the page that you're displaying, you'd never see it without being logged in.

I guess you're trying to make a forum block that lets you log in or something like that?
Reply With Quote
  #5  
Old 05-14-2012, 01:38 PM
Disco_Stu Disco_Stu is offline
 
Join Date: Apr 2012
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a forum block with option buttons. If the visitor tries to use one of these buttons without being signed in then I want to display the message.

Just like in these forums when you try to post and you're not logged in. You get a dialog box asking you to log in. After you do it takes you to the posting screen. That is what I'm trying to do.
Reply With Quote
  #6  
Old 05-14-2012, 01:49 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, then I think you could do something like have your javascript call the same page but add a parameter like "&forcelogin=1" or something like that. Then at the top of your script for that page (after global.php is included) put something like:

Code:
if ($_GET['forcelogin'] AND $vbulletin->userinfo['userid'] == 0)
{
    print_no_permission();
}

I guess if you're using a forumblock then you're talking about the forum.php page? Then you can probably put the above code in a plugin using hook forumhome_start.
Reply With Quote
  #7  
Old 05-14-2012, 02:16 PM
Disco_Stu Disco_Stu is offline
 
Join Date: Apr 2012
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually I just want to call the routine from java script in my forum block without a page refresh and display the "you need to log in" message, have the user log in then they can try the forum block option buttons again.

Thanks for letting me know the routine name. I should be able to plug that into my code.
Reply With Quote
  #8  
Old 05-14-2012, 02:19 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there a part of the vb code that works like you want (i.e. lets you log in without refreshing the page)? If so we can find it and figure out how it works.

You could have your js target another window and log in in a popup, but than you'd need some way for your js to know if it was successful or not.
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 09:28 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.04010 seconds
  • Memory Usage 2,224KB
  • Queries Executed 13 (?)
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
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete