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

Reply
 
Thread Tools Display Modes
  #11  
Old 02-10-2012, 02:14 PM
steveneff steveneff is offline
 
Join Date: Sep 2007
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes it does.

I've tried it without show guest but still the same.

PHP Code:
<vb:if condition="!in_array($GLOBALS['mygig'],$GLOBALS['mycountry'], true)">
<
vb:if condition="$show['guest']"><div class="padtop">
stuff to go in here
</div></vb:if></vb:if> 
Reply With Quote
  #12  
Old 02-10-2012, 02:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, what happens if you try this:

Code:
<vb:if condition="!in_array('XX', array('AL', 'AZ'), true)">
<vb:if condition="$show['guest']"><div class="padtop">
stuff to go in here
</div></vb:if></vb:if>

or this:

Code:
<vb:if condition="!in_array('AL', array('AL', 'AZ'), true)">
<vb:if condition="$show['guest']"><div class="padtop">
stuff to go in here
</div></vb:if></vb:if>
Reply With Quote
  #13  
Old 02-10-2012, 02:29 PM
steveneff steveneff is offline
 
Join Date: Sep 2007
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

They both parse, the second one does it's job ok
Reply With Quote
  #14  
Old 02-10-2012, 02:34 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK - if you still have the preRegister() call in there, what does this do:

Code:
<vb:if condition="!in_array($mygig, array('AL', 'AZ'), true)">
<vb:if condition="$show['guest']"><div class="padtop">
stuff to go in here
</div></vb:if></vb:if>

(I guess it will depend on if your country is one of AL or AZ - if it isn't, you could hard-code it in index.php).
Reply With Quote
  #15  
Old 02-10-2012, 02:39 PM
steveneff steveneff is offline
 
Join Date: Sep 2007
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

parse OK but doesn't work, I changed AZ to GB so I can see if it works.
Reply With Quote
  #16  
Old 02-10-2012, 02:47 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, OK, I don't know. Seems like maybe it's not seeing the variables for some reason.

If you only want to use that ip check in the forumdisplay template, maybe try moving your code to a plugin using hook forumdisplay_complete.
Reply With Quote
  #17  
Old 02-10-2012, 03:06 PM
steveneff steveneff is offline
 
Join Date: Sep 2007
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You mean this code

PHP Code:
$efvip $_SERVER['REMOTE_ADDR'];include('/home/myaccount/public_html/geo/geoip.inc');$gi geoip_open('/home/myaccount/public_html/geo/ip/GeoIP.dat',GEOIP_STANDARD);$mygig geoip_country_code_by_addr($gi$efvip);$mycountry = array('AL','AZ','BA','BD','BG','BW','CD','EE','EG','ET','FI','KW','KE','KP','KR','LB','LC','LR','LV','MA','MT','MU','NG','NP','PH','RS','SK','SL','TN','UY','VG','ZM','ZW'); 
Still no go, what a pig
Reply With Quote
  #18  
Old 02-10-2012, 03:13 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe this (assuming you don't use the country code elsewhere in the template): In a plugin using hook forumdisplay_complete:

PHP Code:
$efvip $_SERVER['REMOTE_ADDR'];
include(
'/home/myaccount/public_html/geo/geoip.inc');
$gi geoip_open('/home/myaccount/public_html/geo/ip/GeoIP.dat',GEOIP_STANDARD);
$mygig geoip_country_code_by_addr($gi$efvip);
$mycountry = array('AL','AZ','BA','BD','BG','BW','CD','EE','EG','ET','FI','KW','KE','KP','KR','LB','LC','LR','LV','MA','MT','MU','NG','NP','PH','RS','SK','SL','TN','UY','VG','ZM','ZW');  

$show['in_country'] = $show['guest'] AND in_array($mygig$mycountry); 

then in the template:

Code:
<vb:if condition="$show[in_country]"><div class="padtop">
stuff to go in here
</div></vb:if>
Reply With Quote
  #19  
Old 02-10-2012, 03:34 PM
steveneff steveneff is offline
 
Join Date: Sep 2007
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No still nothing
Reply With Quote
  #20  
Old 02-10-2012, 04:25 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, OK...maybe I was wrong - maybe the code you're getting back from geoip_country_code_by_addr() isn't what you expect? What happens if you set $mygig to a country code? Also, you could put

Code:
{vb:raw GLOBALS.mygig}

in the template somewhere (not inside the if).
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 05:45 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.04274 seconds
  • Memory Usage 2,268KB
  • 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
  • (5)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete