News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Age & Gender Board Filter Mod

Started by Eliana Tamerin, June 20, 2008, 03:25:15 AM

Previous topic - Next topic

[SiNaN]

Actually I was talking to Eliana, the author. :P
Former SMF Core Developer | My Mods | SimplePortal

Eliana Tamerin

Yeah, I thought the $context['user_see_query'] would control all that, but I guess I was wrong. I'll have to rewrite a few edits in the load file. I'll work on that for 1.3 as well.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

[SiNaN]

$context['user_see_query'] is just an index which helps in getting the list of the boards that user can see.
Former SMF Core Developer | My Mods | SimplePortal

Bulakbol

If you configure a board for unknown gender, logged-in members with gender can not access the board but guests can. With my quick solution, guests can see the board but cannot enter. This will also reject entering a restricted board by url. It is not probably the best solution but works for me.
Sources/Load.php
Code (find) Select
$username = $user_settings['memberName'];
// get logged-in member gender id
Code (add after) Select
$gender = $user_settings['gender'];
Code (find) Select
$user_settings = array();
// give guests gender id of -1
Code (add after) Select
$gender = -1;
Code (find) Select
'permissions' => array()
Code (add after) Select
,
'gender_id_num' => $gender

Code (find) Select
'email' => &$user_info['email']
Code (add after) Select
,
'gender_id' => &$user_info['gender_id_num']


Sources/MessageIndex.php
Code (find) Select
$context['description'] = $board_info['description'];
Code (add after) Select
$context['allowed_gender'] = $board_info['gender_sel'];

In default/MessageIndex.template.php
Code (find) Select
global $context, $settings, $options, $scripturl, $modSettings, $txt;
Code (add after) Select
$b_allowed = ($context['allowed_gender'] == 3 && ($context['user']['gender_id'] == 1 || $context['user']['gender_id'] == 2)) ? true : false;

if ($context['allowed_gender'] != '-1' && !$context['user']['is_admin'])
if ($b_allowed == false && ($context['allowed_gender'] != $context['user']['gender_id']))
fatal_lang_error('1', false);
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

[SiNaN]

I think we should restrict on every page which has the $board variable defined. Just a small Load.php function should be doing the trick. Or the changes you gave should be made in Display, Post, Print and Wireless too.
Former SMF Core Developer | My Mods | SimplePortal

Bulakbol

It's my quick fix and as I said it's not the best way but if you have elegant way, by all means do it.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

[SiNaN]

Yeah, I understand. Gave the idea, I'll leave the rest to author. :P
Former SMF Core Developer | My Mods | SimplePortal

Amun

This is a wonderful mod, I can't wait to use it but I'm waiting for the next version. ;D has me so excited I come back and check daily.
:D :D :D

erichamby

i tried to install this on 1.1.6 and i get an error on the ./Sources/Load.php

anyone found a solution to this?

ccbtimewiz

Quote from: erichamby on September 20, 2008, 12:52:59 AM
i tried to install this on 1.1.6 and i get an error on the ./Sources/Load.php

anyone found a solution to this?

Perhaps you have other modifications that edit that file? What mods do you have installed?

erichamby

ok i have:

1. Downloads System 1.0.4 
2. Blog Community 2.0.2 
3. Auto Embed Video/Audio Clips 3.1.2 
4. YouTube BBCode 2.3 
5. MCLegendII.2 3.0  (also having problems with this plugin)
6. Users Online Today Mod 1.4.0
7. Age and Gender Board Filter 1.2.1 (uploaded but not installed for error)

erichamby

i got the  MCLegendII.2 3.0 plugin working fine. i still need help for this one though

erichamby

can anyone help? or tell me of anything plugin i may try.

Sakae

Quote from: erichamby on September 20, 2008, 12:52:59 AM
i tried to install this on 1.1.6 and i get an error on the ./Sources/Load.php

anyone found a solution to this?

Try to install manually. I have this MOD working on 1.1.6, and I use the last file attached to this topic.
http://www.tigrelog.com.br
l: simple p: machines

bros

On SMF 1.1.7

When I click members, I get this error:
Template Parse Error!

There was a problem loading the /Themes/default/Memberlist.template.php template or language file
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in .../Themes/default/Memberlist.template.php on line 117

line 117
<td class="windowbg2">', (!$context['can_view_email'] || $member['hide_email']) ? '' ' '<a href="mailto:' . $member['email'] . '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . ' ' . $member['name'] . '" /></a>' : '', '</td>

Mods installed:
View Email Permission
PM Informer
Topic Description
This mod

[SiNaN]

This is related to View Email Permission mod by BurkeKnight.

Memberlist.template.php

Find:

? '' ' '

Replace:

? '' : '
Former SMF Core Developer | My Mods | SimplePortal

bros

Parse error: syntax error, unexpected ':', expecting ',' or ';' in .../Themes/default/Memberlist.template.php on line 117

<td class="windowbg2">', (!$context['can_view_email'] || $member['hide_email']) ? '' : '<a href="mailto:' . $member['email'] . '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . ' ' . $member['name'] . '" /></a>' : '', '</td>

[SiNaN]

Can you attach the whole file? Seems like there is another ternary operation before.
Former SMF Core Developer | My Mods | SimplePortal

bros


Bulakbol

Quote from: bros on November 12, 2008, 11:42:40 PM
Parse error: syntax error, unexpected ':', expecting ',' or ';' in .../Themes/default/Memberlist.template.php on line 117

<td class="windowbg2">', (!$context['can_view_email'] || $member['hide_email']) ? '' : '<a href="mailto:' . $member['email'] . '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . ' ' . $member['name'] . '" /></a>' : '', '</td>

I think you forgot to remove the other colon ( : '' ) at the end. The
</a>' : '', '</td>
should be
</a>', '</td>
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Advertisement: