Follow vBSEO on Twitter
vBulletin Modifications
  • Forums
  • Add-Ons
  • Template Modifications
  • Styles
  • Graphics
  • Tutorials
  • Support Center
  • Register
  • vBulletin SEO

Member Log In

Site Navigation

  • Register
  • Members List
  • Social Groups
  • Search
  • Today's Posts
  • Mark Forums Read

Latest Modifications

  • [vB 3.8.4] THX - Hack for VB. 3.8.4
    By: bluedog
  • [vB 3.8.4] Cyb - Chatbox V.2.3
    By: bluedog
  • [vB 4.0.x] PHPKD - Advanced Quick...
    By: PHPKD
  • [vB 3.6.x] StopSpam
    By: flappi282
  • [vB 3.8.x] vBulletin Chat Addon for...
    By: 123flashchat

Latest Template Mods

  • [vB 4.0.x] Remove My Profile Link...
    By: Ak Worm
  • [vB 3.8.x] Images DownloadBox...
    By: cRs!MP
  • [vB 3.8.x] Adviertise Mod On Forum...
    By: MG4
  • [vB 3.8.4] Images PassWordBox...
    By: cRs!MP
  • [vB 3.8.4] Footer Follow Ups
    By: Ak Worm

Latest Styles

  • [vB 4.0.x] 4.0.3 - VB4STYLE-TWEETA...
    By: Belon
  • [vB 4.0.x] [4.0.3] vbdesigns.de...
    By: Belon
  • [vB 3.8.4] CompletevB - Skylight
    By: DreadKnight
  • [vB 3.8.3] [vB 3.8.4] Barcelona...
    By: hoiquantinhoc.com
  • [vB 3.8.3] Natures Walk by vBSkin...
    By: Chri5

Latest Graphics

  • [vB ] [anim.]Team Ranks
    By: cRs!MP
  • [vB ] Abstract Circles (3...
    By: cRs!MP
  • [vB ] PlayStation Rank Images
    By: cRs!MP
  • [vB 3.6.12] Heavy Stroked Button...
    By: Shelley
  • [vB ] Minature Ranks.
    By: Shelley
vBulletin Modifications » Support Center » vBulletin Support » Need to create a condition...
Reply
Page 1 of 2 1 2 >

 

  • Thread Tools
Old 08-30-2006, 10:22 AM   #1
Samantha
vB User

Activity Longevity
0/20 13/20
Today Posts
0/3 sssssss96
Samantha is on a distinguished road
Status: Offline Default Need to create a condition...
Hello guys, I was trying to edit some of my templates to make my forum unique but I am not very good in php yet. I got a question for you: I need to create a condition in which i must specify if the variable $forum[moderators] is empty or not...

Example:

Code:
if forum x has one ore more moderators then:

DO SOMETHING

else

DO NOTHING

Can someone help please?


Kindest Regards
Samantha
Reply With Quote
Old 08-30-2006, 06:53 PM   #2
Idan
Coder
Idan's Avatar

Activity Longevity
0/20 18/20
Today Posts
0/3 sssss1484
Location: Israel
Age: 29
Idan is on a distinguished road
Status: Offline Default
well, i'm not sure/recall about any "direct" moderator number info exists inside $forums[] array, but you could simply gather number of moderators, by add into related hook code like this:

PHP Code:
$res = $vbulletin->db->query_first("SELECT COUNT(moderatorid) as mod_num FROM moderator WHERE forumid='".$foruminfo[forumid]."'");
$mods_num =  $res[mod_num]; 
then inside your template:
Code:
<if condition="$mods_num">
do something
<else />
do something else, or if nothing don't use this else ;)
</if>
hope this helps.
Regards,
Idan.

* Support will only be given via forums !
* If this post solved/aided your problem, please click "mark as aid" / "mark as solution" as explained in here
Reply With Quote
Old 08-30-2006, 08:44 PM   #3
Samantha
vB User

Activity Longevity
0/20 13/20
Today Posts
0/3 sssssss96
Samantha is on a distinguished road
Status: Offline Default
Quote:
Originally Posted by Idan
PHP Code:
$res = $vbulletin->db->query_first("SELECT COUNT(moderatorid) as mod_num FROM moderator WHERE forumid='".$foruminfo[forumid]."'");
$mods_num =  $res[mod_num]; 
First of all thanks for your time, I don't have a hook code...all I am doing is editing some templates. So where am I supposed to use the quoted code?


Thank you!

Kisses
Samantha
Reply With Quote
Old 08-30-2006, 08:56 PM   #4
Idan
Coder
Idan's Avatar

Activity Longevity
0/20 18/20
Today Posts
0/3 sssss1484
Location: Israel
Age: 29
Idan is on a distinguished road
Status: Offline Default
what vbulletin version are you using ? 3.0.xx ? or 3.5.x/3.6.x ??
the answer & code mentioned to be placed @ hook system assumed you were using 3.5.x version or higher.
if answer is 3.0.xx, then just put php code into either showthread.php or forumdisplay.php (depands on where you need this modification added), it doesn't really matter exact location inside file - just needs to make sure it's declared before sending template into eval(), otherwise var won't be available.

also another correction if you're using indeed 3.0.xx, then i think array that should be used is indeed $forum[] & not $foruminfo[], like i wrote before.
Regards,
Idan.

* Support will only be given via forums !
* If this post solved/aided your problem, please click "mark as aid" / "mark as solution" as explained in here
Reply With Quote
Old 08-31-2006, 08:28 AM   #5
Samantha
vB User

Activity Longevity
0/20 13/20
Today Posts
0/3 sssssss96
Samantha is on a distinguished road
Status: Offline Default
Well thanks, I am using vB version 3.5.2 (as testboard) and vB 3.6.0 (as official forum). So I have to use the hook system, right? Pardon me but where is the hook system located?
Reply With Quote
Old 08-31-2006, 09:56 AM   #6
Nick R
vBulletin Guru

Nick R's Avatar

Activity Longevity
0/20 14/20
Today Posts
0/3 sssss4450
Location: Cyberspace, UK
Age: 30
Nick R is on a distinguished road
Send a message via MSN to Nick R Send a message via Yahoo to Nick R
Status: Offline Default
Go into your admin control panel (ACP) and then near the bottom of the navigation is Plugin And Product System click on the arrow to drop it down and then click on add new plugin. Then choose a name, a hook location and the code that Idan gave you.
Reply With Quote
Old 08-31-2006, 10:41 AM   #7
Samantha
vB User

Activity Longevity
0/20 13/20
Today Posts
0/3 sssssss96
Samantha is on a distinguished road
Status: Offline Default
Thanks rogersnm, I need to use this modification on forumdisplay so the right location for the hook would be forumdisplay_moderator, is that right? Or maybe forumdisplay_start?
Reply With Quote
Old 08-31-2006, 12:25 PM   #8
Nick R
vBulletin Guru

Nick R's Avatar

Activity Longevity
0/20 14/20
Today Posts
0/3 sssss4450
Location: Cyberspace, UK
Age: 30
Nick R is on a distinguished road
Send a message via MSN to Nick R Send a message via Yahoo to Nick R
Status: Offline Default
Not sure, try start.
Reply With Quote
Old 08-31-2006, 06:57 PM   #9
Samantha
vB User

Activity Longevity
0/20 13/20
Today Posts
0/3 sssssss96
Samantha is on a distinguished road
Status: Offline Default
Quote:
Originally Posted by rogersnm
Not sure, try start.
Will try it there then, thank you guys
Reply With Quote
Old 08-31-2006, 06:57 PM   #10
Nick R
vBulletin Guru

Nick R's Avatar

Activity Longevity
0/20 14/20
Today Posts
0/3 sssss4450
Location: Cyberspace, UK
Age: 30
Nick R is on a distinguished road
Send a message via MSN to Nick R Send a message via Yahoo to Nick R
Status: Offline Default
ps. i don't think that will work as a hook location.
Reply With Quote

Reply
Page 1 of 2 1 2 >

« I am looking for VBulletin designer | Does anyone here KNOW PHP? »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

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

Forum Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
create subdomains automatic premium vBulletin Modification Requests 1 12-29-2005 10:28 AM
if condition (forum only) Ghost Shadow vBulletin Modification Requests 2 12-07-2005 02:10 PM



All times are GMT. The time now is 06:03 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Transverse Styles
  • Top
  • Archive
  • vBSEO
  • Contact Us
LinkBack
LinkBack URL LinkBack URL
About LinkBacks About LinkBacks
Bookmark & Share
Digg this Thread! Digg this Thread!
Add Thread to del.icio.us Add Thread to del.icio.us
Bookmark in Technorati Bookmark in Technorati
Furl this Thread! Furl this Thread!