Author Topic: Show Text To Only Certain Groups  (Read 1585 times)

0 Members and 1 Guest are viewing this topic.

« on: March 09, 2011, 03:29:10 PM »

Based on this topic HERE, I could not get your solution it to work.

I'm willing to donate $10 if you can help me with this hack. I was going to purchase your edit/view mod, but it still doesn't get me what I need. See see why below.

Anyway, I need this to be hidden from all groups except admin and group id 107.

Code: [Select]
function up_block_user_info() {
global $settings, $txt, $context;
echo '
<div id="up_user_info">
<div class="cat_bar">
<h3 class="catbg">
<span class="left"></span>
Personal Info
</h3>
</div>
<div class="windowbg creator" style="border-bottom-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px;">
<span class="topslice" style="background: none;"><span style="background: none;"></span></span>
<div class="content">';
echo'
<dl>';
echo '
<dt><strong>', $txt['age'], ':</strong></dt>
<dd>', $context['member']['age'] . ($context['member']['today_is_birthday'] ? ' &nbsp; <img src="' . $settings['images_url'] . '/bdaycake.gif" width="40" alt="" />' : ''), '</dd>';
if (!isset($context['disabled_fields']['location']) && !empty($context['member']['location']))
echo '
<dt><strong>', $txt['location'], ':</strong></dt>
<dd>', $context['member']['location'], '</dd>';
               echo '
</dl>';
// Any custom fields for standard placement?
if (!empty($context['custom_fields']))
{
$shown = false;
foreach ($context['custom_fields'] as $field)
{
if ($field['placement'] != 0 || empty($field['output_html']))
continue;
if (empty($shown))
{
echo '
<dl>';
$shown = true;
}
echo '
<dt><strong>', $field['name'], ':</strong></dt>
<dd>', $field['output_html'], '</dd>';
}
if (!empty($shown))
echo '
</dl>';
}
echo '
</div>
<span class="botslice" style="background: none;"><span style="background: none;"></span></span>
</div>
</div>';
return true;
}

Otherwise, I need it to show:

Code: [Select]
<div class="cat_bar">
<h3 class="catbg">
<span class="left"></span>
Personal Info
</h3>
</div>
<div class="windowbg creator" style="border-bottom-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px;">
<span class="topslice" style="background: none;"><span style="background: none;"></span></span>
<div class="content">You Need To <a href="" >Subscribe</a> To Personals View This!</div>
<span class="botslice" style="background: none;"><span style="background: none;"></span></span>
</div>

Or something to that effect.

You can reply here or PM me if you want to keep it private, it doesn't matter to me. Also, if I'm bugging you and or you don't have the time to help out, that's ok too. Just let me know, I won't take it personal...  :P

Thanks Live...


« Reply #1 on: March 09, 2011, 04:01:07 PM »

Ah, admins AND group 107[1]

So it looks like we need to modify my originally posted code a bit...

Code: [Select]
<?php
if (!in_array(107$user_info['groups']) && !allowedTo('admin_forum'))
{
echo 'You\'re not in the right group.';
return;
}
?>

Not sure if you still have my paypal so if you dont let me know and I'll PM it to ya. Gotta dash for awhile...

(The above code also checks if a user can administrate the forum. If you need it to check for group1 (absolute admin) let me know and I'll change it)

 1.  Admin is group 1

« Reply #2 on: March 09, 2011, 04:47:29 PM »

I think there is some miscommunication here  :P

I reckon it doesn't really matter if the admin is allowed or not, I can always just apply the group to anyone who is an admin(but no one but me will be :P).

I need:

Group 107 see this:

"blah"

everyone else see's this:

"blah blah"

I'm having trouble adding the script to the UltimateProfile.template.php (attached). For two reasons, if I put the script outside the function, then it doesn't know where to put the "blah blah" because of the "column_layout array", and it appears at the top of the forum breaking the layout. I cannot put it inside the "function up_block_user_info()" function, as there are too many echo's, and it just doesn't work.

What I need to do is hide all the custom profiles inside the block, and show "You Need To <a href="" >Subscribe</a> To Personals View This!" for everyone who is NOT in group 107. Otherwise, all those in group 107 see the custom profile fields.

I'll attach the file so you can take a quick look. The contents of the "function up_block_user_info()" is what I want to hide from NON-107 members, and show "You Need To <a href="" >Subscribe</a> To Personals View This!" for everyone else.

You can see the unmodified layout here: http://inspireromance.com/SMF/index.php?action=profile;area=summary;u=1


« Reply #3 on: March 09, 2011, 11:17:48 PM »

Hopefully this does it for you...?


« Reply #4 on: March 10, 2011, 01:08:17 AM »

Hopefully this does it for you...?

That did the trick, thanks Live.

Off to paypal ;)