TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 468
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 67
  • Total: 67

Changing a condition based on sex...

Started by technodragon73, March 26, 2006, 09:40:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

technodragon73

Any know how I can take this code and change it so that if the member is female it will be a different image/wav file?  then if they are not female, it would be the image already listed.  I pretty sure it would be an if/else statement, but I do not know how to write it.

                   if($context['user']['unread_messages']>0)
                        echo '<br />'.$bullet.'<a style="font-weight: bold; " href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , ' <img src="' . $settings['images_url'] . '/msg.gif" border="0"><bgsound src="' . $settings['images_url'] . '/Mail01.wav" border="0"></a>';

scope

I was wondering the same, because the code you are asking for might make it possible to add viewable blocks based on gender or even age.  I need the reference in a script for the gender you are asking and in the same I would want to use age as the check against statement.  IF that made sense.

technodragon73

Quote from: scope on March 28, 2006, 05:23:09 AM
I was wondering the same, because the code you are asking for might make it possible to add viewable blocks based on gender or even age.  I need the reference in a script for the gender you are asking and in the same I would want to use age as the check against statement.  IF that made sense.

Well, over at SMF they started helping, but the code they posted did not work....

This was the first suggestion, but it did not work.
if(($context['user']['unread_messages']>0) && ($context['member']['gender']['name'] == 'f')
                       echo '<br />'.$bullet.'<a style="font-weight: bold; " href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , ' <img src="' . $settings['images_url'] . '/msg.gif" border="0"><bgsound src="' . $settings['images_url'] . '/Mail01.wav" border="0"></a>';



these next two were suggested, but could not get them to work either:
elseif(($context['user']['unread_messages']>0) && ($context['member']['gender']['name'] == 'm'))
{
echo '<br />'.$bullet.'<a style="font-weight: bold; " href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , ' <img src="' . $settings['images_url'] . '/msg.gif" border="0"><bgsound src="' . $settings['images_url'] . '/Mail01.wav" border="0"></a>';
}
elseif(($context['user']['unread_messages']>0) && ($context['member']['gender']['name'] == ''))
{
echo '<br />'.$bullet.'<a style="font-weight: bold; " href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , ' <img src="' . $settings['images_url'] . '/msg.gif" border="0"><bgsound src="' . $settings['images_url'] . '/Mail01.wav" border="0"></a>';
}


elseif(($context['user']['unread_messages']>0) && (!$context['member']['gender']['name'] == 'f'))
{
echo '<br />'.$bullet.'<a style="font-weight: bold; " href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , ' <img src="' . $settings['images_url'] . '/msg.gif" border="0"><bgsound src="' . $settings['images_url'] . '/Mail01.wav" border="0"></a>';
}


So...if anyone reads this can you please help?

IchBin

if(($context['user']['unread_messages']>0) && ($context['member']['gender']['name'] == 'f')

If you're checking for PM info, why are you asking about Gender?
The above line is checking if the user has unread messages AND has a gender of Female. Take out the first check and try this:
if($context['member']['gender']['name'] == 'f')
echo 'your_stuff_here';

technodragon73

Quote from: IchBinÃ,â,,¢ on March 28, 2006, 06:59:14 AM
if(($context['user']['unread_messages']>0) && ($context['member']['gender']['name'] == 'f')

If you're checking for PM info, why are you asking about Gender?
The above line is checking if the user has unread messages AND has a gender of Female. Take out the first check and try this:
if($context['member']['gender']['name'] == 'f')
echo 'your_stuff_here';


The reason why is because it is an unread PM code...I was trying to see if it can check for unread PMs AND check for gender to sort of personalize the notification based on whether the member is female or not.

IchBin

That fine. But, if both conditions aren't met as "true" then your result will not be echo'd. In other words, if the person doesn't have any PM's (zero) then their will be no result. Same case if gender is empty, but you already checked that. :) I'm not sure exactly how to write it, but I'm going to fiddle around with it.

technodragon73

Quote from: IchBinÃ,â,,¢ on March 28, 2006, 04:31:24 PM
That fine. But, if both conditions aren't met as "true" then your result will not be echo'd. In other words, if the person doesn't have any PM's (zero) then their will be no result. Same case if gender is empty, but you already checked that. :) I'm not sure exactly how to write it, but I'm going to fiddle around with it.

If it helps, the purpose of wanting this change is so that not only is there a visual and audio announcement when a user has a new PM, but also a different one based on gender...

scope

not sure if I should start a new thread, if so let me know.  I was wondering the same thing but mine is to be used for 18+ content.  Is there a piece I could add to a user profile to be checked by an admin that says 18+ and then how would I use that as a chekc to display one php code compared to another?

right now i have code for coppermine to display only public made images(so no adult images would be shown), but on a member with the 18+ option selected they would have random images that could include adult.  I would of course remove the option if they didn't desire or want it.  I have adult comics(not sex related but adult funny topics that may not be deemed appropriate for youth and I don't want a parent mad at me)

Any thoughts would be greatfull, let me know if the request doesn't make sense either.  I am looking for the same code as techno, but would like to add a reference in the profile(in this case 18+) instead of gender. 

This website is proudly hosted on Crocweb Cloud Website Hosting.