1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHPBB3 Help

Discussion in 'PHP' started by killer12345, Apr 11, 2010.

  1. #1
    Hi, I need someone to make this code only apply in certain forums and only when a user is making a new topic.

            // Word needed to post / 4seven / 2010
            if(strpos(utf8_normalize_nfc(request_var('message', '', true)), 'MY-MAGIC-WORD') !== false){    
            $submit = true;}
            else{
            $submit = false;}
            // Word needed to post / 4seven / 2010      
    Code (markup):
    The code goes in posting.php after:

            // Store message, sync counters
            if (!sizeof($error) && $submit)
            { 
    Code (markup):
    If someone can do this I will be very greatful.
    Thanks.
     
    killer12345, Apr 11, 2010 IP
  2. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #2
            // Word needed to post / 4seven / 2010
            if($mode != 'post' || !in_array($forum_id, array(1, 2, 3)) || strpos(utf8_normalize_nfc(request_var('message', '', true)), 'MY-MAGIC-WORD') !== false){    
            $submit = true;}
            else{
            $submit = false;}
            // Word needed to post / 4seven / 2010
    PHP:
    Replace "array(1, 2, 3)" with an array of ids for the forums you want this to apply to.
     
    joebert, Apr 13, 2010 IP
  3. killer12345

    killer12345 Peon

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    OMG. Thank you so much!!!!!!!!!. Is there anyway of making it only apply for the first post (Starting a topic)?
     
    killer12345, Apr 13, 2010 IP
  4. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #4
    I've got two ideas what you might mean when you say you want "it" to apply when starting a thread. The first being that you want the whole functionality to apply only when starting a new thread which appears not to be the case and the other being maybe you only want the exclusion to apply when it's starting a new thread.

    Try replacing this

    $mode != 'post' || !in_array($forum_id, array(1, 2, 3))
    Code (markup):
    with this

    ($mode == 'post' && !in_array($forum_id, array(1, 2, 3)))
    Code (markup):
     
    joebert, Apr 14, 2010 IP
  5. killer12345

    killer12345 Peon

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Don't worry. It work before without add or editing anything. If I have another problem or request, I'll post it here.
    Thanks for all the help Joebert.
     
    killer12345, Apr 14, 2010 IP