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

Reply
 
Thread Tools Display Modes
  #1  
Old 10-31-2010, 02:54 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Allow access to a forum based on gender?

Hi all,
I;ve created a custom profile field required on registration (Field 5, single line radio, with options Male, Female) what i would like to do is allow or deny access to a certain form id based on whether they are male or female.

Could someone help with the If conditon? something like:
HTML Code:
<if condition="$forum[forumid] == X">
AND
<if condition="$vbulletin->userinfo['Field5'] == Male"></if>
SHOW A NO PERMISSON, i think its something like $print_no_permisson<else /> 
</if>
I know this isn't right but it's an idea and i THINK it may go in the forumdisplay template?

Hope you can help
Reply With Quote
  #2  
Old 10-31-2010, 03:38 PM
JamesC70 JamesC70 is offline
 
Join Date: Jun 2007
Posts: 219
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you considered putting your members into gender-based usergroups?

This way you could use the built-in permissions system (AdminCP -> Forums & Moderators -> Forum Permissions), and Forum Home will automatically display only those forums accessible to that particular member.

This is how most forums restrict access to a moderator area. A side benefit: the permissions system method won't be overridden by a later vBulletin upgrade, as a template update might be.
Reply With Quote
  #3  
Old 10-31-2010, 03:59 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

James thanks for the reply, how can i automatically assign them to gender based groups? the idea of the custom profile field at registration is so they cannot change it later, i have 3 forums Mixed, Guys & Girls so anyone can access mixed but only guys can access guys ....etc

Any suggestions?

--------------- Added [DATE]1288548201[/DATE] at [TIME]1288548201[/TIME] ---------------

I have tried this but no joy!
HTML Code:
<if condition="($forum[forumid] == 3) AND ($vbulletin->userinfo['Field5'] == Male)"></if>
Reply With Quote
  #4  
Old 10-31-2010, 05:10 PM
JamesC70 JamesC70 is offline
 
Join Date: Jun 2007
Posts: 219
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ack, my fault. I was thinking the promotions system could handle custom profile fields, and that you could simply tell the system to auto-promote based on field 5.

I'm toying with the idea of adding a plugin to fire when the user logs in (login_verify_success, maybe?). The basic thought would be:

Code:
if usergroup = registered users 
   {
     get field5 
     if field5 = "Female" 
         {
            move to usergroup "Female"
         }
     else
         {
            move to usergroup "Male"
         }
     write new usergroup to user record
   }
 
Code idea: https://vborg.vbsupport.ru/showpost....6&postcount=53
This idea specifically checks that the member is already in 'Registered Users', so that we don't waste processing time checking banned members, members that have already been moved, or moderators/admins (who presumably would need access regardless of gender).

This method would catch existing members as they log in, and move them appropriately. New registrants could be moved as they confirm their registration using this mod: https://vborg.vbsupport.ru/showthread.php?t=82992

What is your coding experience at adding plugins? Can you take this thought and make it work?
Reply With Quote
  #5  
Old 10-31-2010, 05:35 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't code PHP, im novice to fair on HTML, i've had my main board 2 years and customised it, made tweaks...etc
But that link you gave looks exactly like what i need, so i'll give that a go, thanks very much
Reply With Quote
  #6  
Old 10-31-2010, 05:43 PM
JamesC70 JamesC70 is offline
 
Join Date: Jun 2007
Posts: 219
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, so your experience is about the same as mine. I dabble a little in PHP, but I don't touch the database.

Maybe Lynne or another code expert will see this thread and give some other ideas.....
Reply With Quote
  #7  
Old 10-31-2010, 06:39 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I added that xml and edited it as needed but it doesn't work so its back to the drawing board, thanks for your help anyway!
Reply With Quote
  #8  
Old 10-31-2010, 08:42 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A conditional in forumdisplay would work to not display a forum based on gender but there'd be so many ways around this it wouldn't be worth even attempting...

Off hand:
"Last Post" info will still show in forumhome...
User can use "showpost" or even "showthread" manually to view threads and posts, would need to edit each one...
The "Archive" would be unaffected...

The only way to do this right is with usergroup permissions. You could make the male/female group publically joinable so you don't have to do the work manually- but then people could change their sex at any time.
Reply With Quote
  #9  
Old 11-01-2010, 08:41 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
A conditional in forumdisplay would work to not display a forum based on gender but there'd be so many ways around this it wouldn't be worth even attempting...

Off hand:
"Last Post" info will still show in forumhome...
User can use "showpost" or even "showthread" manually to view threads and posts, would need to edit each one...
The "Archive" would be unaffected...

The only way to do this right is with usergroup permissions. You could make the male/female group publically joinable so you don't have to do the work manually- but then people could change their sex at any time.
Thats the problem, i don't want them to be able to change, the custom field is there at registration only and uneditable and hidden after, so i need something like that script that doesn't work to either change them on completion of registration or even after first post because i could force first post to be in say an Introduction forum.

But whatever happens i wouldnt be able to run the site without this moving user based on gender.

BTW im using vB3.8.6

--------------- Added [DATE]1288613598[/DATE] at [TIME]1288613598[/TIME] ---------------

I was trying to re-invent the wheel - this https://vborg.vbsupport.ru/showthread.php?t=186076 works perfectly , won't be long until i launch the site now
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 12:10 PM.


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.04360 seconds
  • Memory Usage 2,255KB
  • 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
  • (2)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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