Can someone help me with modifying a IPB mod?

Discussion in 'PHP' started by Abhik, Jun 18, 2007.

  1. #1
    Hello all,
    I was looking for a mod which impose a restriction of number of posts needed on downloading attachments for IPB 2.3.0 (latest release).
    can someone help me getting that?
    I found a similar mod for IPB 2.1.x but that is not working with the latest version.

    I already have searched ize, ips and many other invision service sites/forums but failed to get any response.

    I can provide you the IPB 2.1.x compatible version of the mod for your reference.
    I already informed the original coder of this mod and he was readily agreed for this as he stopped coding mod for IPB.

    With Regards
    Abhik
     
    Abhik, Jun 18, 2007 IP
  2. Vbot

    Vbot Peon

    Messages:
    107
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well, I don't have the original mod that you're looking for. But I can make one that have the same effect.

    1. Open file sources/action_public/attach.php

    2. Find:
    $this->class_attach->show_attachment( $attach_id );
    PHP:
    Replace with:
    		if($this->ipsclass->member['posts'] >= $this->ipsclass->vars['posts_require_dl_attachment'])
            {
    		    $this->class_attach->show_attachment( $attach_id );
    		}
            else
            {
                $this->ipsclass->lang['posts_required'] = "You need {$this->ipsclass->vars['posts_require_dl_attachment']} posts to download this attachment";
                $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'posts_required' ) );
            }
    PHP:
    3. Saved upload.

    4. Login to your ACP -> Tools & Settings then click on Add New General Setting

    Setting title: Posts required to download Attachment.
    Setting Desc: Posts required to download Attachment.
    Setting Group?: Topics posts & polls recommended.
    Setting Type?: Text input
    Setting Key?: posts_require_dl_attachment
    Setting Current Value?: How many post do you want your member to have in order to download attachment.

    The rest leave as default.
    Save changes.

    You're done.
     
    Vbot, Jun 18, 2007 IP
    Abhik likes this.
  3. Abhik

    Abhik ..:: The ONE ::..

    Messages:
    11,337
    Likes Received:
    606
    Best Answers:
    0
    Trophy Points:
    410
    Digital Goods:
    2
    #3
    Many Thanks mate, it worked like a charm :) ..
    This is exactly what I am looking for. Some greens on your way..
     
    Abhik, Jun 18, 2007 IP