vBulletin SEO Forums

SEO

vBulletin Search Engine Optimization

Buy vBSEO Now! HACKER SAFE certified sites prevent over 99.9% of hacker crime.
ne nw
vBSEO Total Support Team Launches DeskPro New vBSEO Discount Level for Network Builders vBSEO 3.2.0 GOLD Has Landed Success with vBSEO = 600ore Web Visitors + $1400 in a Day! Crawlability Inc. Files for SEO Technology Patent
se sw

if condition help

This is a discussion on if condition help within the Link Building forums, part of the vBulletin SEO Discussion category; I hope it's not against terms to ask for help with basic coding, but it does pertain to links If ...

Go Back   vBulletin SEO Forums > vBulletin SEO Discussion > Link Building

Enhancing 80 million pages.

Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read
  #1  
Old 10-10-2008, 08:22 PM
Member
 
Real Name: Karl
Join Date: Aug 2008
Location: England
Posts: 74
Blog Entries: 1
if condition help

I hope it's not against terms to ask for help with basic coding, but it does pertain to links

If it's not, feel welcome to delete it....


Just need a quick hand with a condition statement...

I'm trying to use two different ad codes depending on if the member is male or female.

I created a profile field for Man / Woman.

I currently have:
Code:
<if condition="$post['field7'] == 'Man'">
<--code here for male members-->
</if>

<if condition="$post['field7'] == 'Woman'">
<--code here for female members-->

</if>
I know the problem is with the condition code, and I also know I can't use (or at least, I don't know how to if I can?) is_member_of as that is for member groups, not profile fields.

Any help, muchly appreciated.

ETA: I mean, I know the above code works on the postbit and checks whether the member who posted is male or female... what I need it to do though, is check the reader's membership to field7 - whether they are male or female, and display ads according to the sex of the view - not the poster.

In addition, I will be adding a condition based on the forumID. So for example, a man viewing a thread under the 'fathers forum' (say, ID=10) will see ads for (e.g.) "dads rights, thinning hair help, muscle building" while a woman would see ads similar, but based more towards their sex (e.g.) "safe sex, moms clubs, etc." - however, if a man viewed a different forum, e.g. 'health' , he'd see items relating to mens health - while women viewing the health forum would see ads directed towards women's health... long winded, but you get the idea I hope.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #2  
Old 10-10-2008, 08:31 PM
Michael Biddle's Avatar
vBSEO Staff
vBSEO Total Customer Support
 
Real Name: Michael Biddle
Join Date: Jan 2007
Location: Southern California
Posts: 3,016
Blog Entries: 5
What page is that for? That should work on the postbit template, and probably the showthread page, other then that, you would need a new query.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #3  
Old 10-10-2008, 08:44 PM
Senior Member
 
Real Name: Arkidas
Join Date: Feb 2008
Posts: 200
I think you can use

Code:
<if condition="$vbulletin->userinfo['field7'] == 'Man'">
<--code here for male members-->
</if>


<if condition="$vbulletin->userinfo['field7'] == 'Woman'">
<--code here for female members-->
</if>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #4  
Old 10-10-2008, 09:29 PM
Member
 
Real Name: Karl
Join Date: Aug 2008
Location: England
Posts: 74
Blog Entries: 1
Michael, I'm trying to figure that code to work as a seperate template - so it can be used in other locations, such as showthread or even FAQ. It'll be wrapped into pages using vbadvanced.
Arkidas, that worked a treat (at least the minor test I've done works) thank you!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #5  
Old 10-10-2008, 09:33 PM
Michael Biddle's Avatar
vBSEO Staff
vBSEO Total Customer Support
 
Real Name: Michael Biddle
Join Date: Jan 2007
Location: Southern California
Posts: 3,016
Blog Entries: 5
If you want it to be global, then use what Arkidas suggested.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #6  
Old 10-10-2008, 09:34 PM
Member
 
Real Name: Karl
Join Date: Aug 2008
Location: England
Posts: 74
Blog Entries: 1
Nice one, thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #7  
Old 10-12-2008, 12:09 PM
Chris-777's Avatar
Senior Member
Big Board Administrator
 
Real Name: Chris
Join Date: May 2007
Location: Boston, MA
Posts: 109
I do it this way for my sidebar:

Quote:
<if condition="(in_array($bbuserinfo['usergroupid'], array(5, 6, 9, 11, 12, 13)) AND $vbulletin->userinfo[field18] <> 'No') OR !in_array($bbuserinfo['usergroupid'], array(5, 6, 9, 11, 12, 13))">
Note that there are no ticks around [field18].
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #8  
Old 10-12-2008, 08:25 PM
Member
 
Real Name: Karl
Join Date: Aug 2008
Location: England
Posts: 74
Blog Entries: 1
Chris, thanks for the tip - but it's wayyyyy over my head!?!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #9  
Old 10-12-2008, 08:31 PM
Michael Biddle's Avatar
vBSEO Staff
vBSEO Total Customer Support
 
Real Name: Michael Biddle
Join Date: Jan 2007
Location: Southern California
Posts: 3,016
Blog Entries: 5
It says, if the user viewing is in usergroups 5, 6, 9, 11, 12, 13, and their option for field18 does not equal no, OR if they are not in 5, 6, 9, 11, 12, 13, it will show it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #10  
Old 10-12-2008, 08:38 PM
Member
 
Real Name: Karl
Join Date: Aug 2008
Location: England
Posts: 74
Blog Entries: 1
So the layman's translation is:
It shows to everyone, except usergroups 5, 6, 9, 11, 12, 13 who have selected anything other than 'No'?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #11  
Old 10-12-2008, 08:41 PM
Michael Biddle's Avatar
vBSEO Staff
vBSEO Total Customer Support
 
Real Name: Michael Biddle
Join Date: Jan 2007
Location: Southern California
Posts: 3,016
Blog Entries: 5
Yes, exactly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #12  
Old 10-12-2008, 08:44 PM
Member
 
Real Name: Karl
Join Date: Aug 2008
Location: England
Posts: 74
Blog Entries: 1
Super. I have a very (very, very) basic understanding of this, but it's rather like a child's matchstick drawing of a 'sunny day at the park with daddy' vs michelangelo art exhibit.

To be honest, it was more the 'in_array' that knocked my senses more then gist of the conditions themselves.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
  #13  
Old 10-12-2008, 08:49 PM
Michael Biddle's Avatar
vBSEO Staff
vBSEO Total Customer Support
 
Real Name: Michael Biddle
Join Date: Jan 2007
Location: Southern California
Posts: 3,016
Blog Entries: 5
Personally I would rather use is_member_of then the $bbuserinfo, as it includes the secondary usergroups as well.

Code:
<if condition="(is_member_of($vbulletin->userinfo, 5, 6, 9, 11, 12, 13) AND $vbulletin->userinfo[field18] <> 'No') OR !is_member_of($vbulletin->userinfo, 5, 6, 9, 11, 12, 13)">
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on Facebook!
Reply With Quote
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
More if condition help - search and searchid jbartle Template Modifications 2 08-11-2007 06:50 PM
IF condition for certain pages? jbartle Off-Topic & Chit Chat 9 01-03-2007 01:02 AM
if condition for admins and mods only jbartle Off-Topic & Chit Chat 6 10-15-2006 12:56 AM


All times are GMT -4. The time now is 11:59 PM.


Powered by vBulletin Version 3.8.0 Beta 4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.5 ©2008, Crawlability, Inc.