vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Allow access to a forum based on gender? (https://vborg.vbsupport.ru/showthread.php?t=252936)

Simon Lloyd 10-31-2010 02:54 PM

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 :)

JamesC70 10-31-2010 03:38 PM

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.

Simon Lloyd 10-31-2010 03:59 PM

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>

JamesC70 10-31-2010 05:10 PM

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?

Simon Lloyd 10-31-2010 05:35 PM

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 ;)

JamesC70 10-31-2010 05:43 PM

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.....

Simon Lloyd 10-31-2010 06:39 PM

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!

BirdOPrey5 10-31-2010 08:42 PM

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.

Simon Lloyd 11-01-2010 08:41 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2116517)
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 :)


All times are GMT. The time now is 11:47 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.01027 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete