ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Conditional question for forum templates

November 30, 2008 3:26am

Subscribe [3]
  • #1 / Nov 30, 2008 3:26am

    georgec

    17 posts

    Hi:
    I’m currently running EE forums v2.0, and am trying to modify one of the default templates, specifically, Thread View->Signature:

    <fieldset class='signature'>
                        
    <legend class="signatureTitle"> {lang:signature} </legend>
    
    {if signature_image}
    <div class="itempad">{path:signature_image}</div>
    {/if}
    
    {signature}
    
    </fieldset>

    I’m looking to add some sort of conditional so signatures are only shown for members with either x number of posts, or if that’s not possible, have registered for x number of days or belong to a certain rank. A lot of users sign up and make 1 post in our forums just to spam their signature, so and I’m trying to cut back on that with some sort of restriction on sig display.

    Thanks!

  • #2 / Nov 30, 2008 10:12am

    Derek Jones

    7561 posts

    Are you comfortable with PHP?  What you’re after would be fairly simple with PHP enabled on output in your forum templates.

  • #3 / Dec 01, 2008 9:35pm

    georgec

    17 posts

    Hi Derek:
    I’m certainly no PHP coder, but I am fairly comfortable with making small changes to PHP scripts. Can you let me know the key variables or mysql queries I’d need to look up as far as member post count or days registered?

    Thanks,

  • #4 / Dec 01, 2008 10:18pm

    Derek Jones

    7561 posts

    Sure, here’s a quick example of only displaying signatures for users with over 200 posts, or having registered 30 days ago (30 days is 2,592,000 seconds):

    <?php
    global $LOC;
    if ({total_posts} > 200 OR {join_date format="U"} < ($LOC->now - 2592000)): ?>
        {signature}
    <?php endif; ?>

    PHP needs to be enabled for the forum templates, on Output mode, so that the {total_posts} variable is parsed before the PHP.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases