Jump to content

  •  

  • Tutorial info Visit support topic

    • Added on: Apr 30 2009 10:54 AM
    • Views: 1024


    * * * * *
    0 Ratings

    Change user group to UPLOADERS when upload a file

    Posted by Adriano Faria on Apr 30 2009 10:54 AM
    To change automatically the user group when a user post a new file, open sources\components_public\downloads\submit.php and find:


    		//---------------------------------------------------------
    		 // We need this for the topic posting, and subscription
    		 // notifications.  Let's instantiate it here.
    		 //---------------------------------------------------------
    Add above:

    		if ( $open == 1 && $this->ipsclass->member['mgroup'] == 3 )
    		{
    			$this->ipsclass->DB->do_update( 'members', array( 'mgroup' => XX, ), 'id='.( $this->ipsclass->member['id'] ) );
    		}
    Remember to change XX to the Group ID you want to promote the member!
    Open sources\components_public\downloads\moderate.php and find:

    				$this->ipsclass->DB->build_query( array( 'select' => 'members_display_name, email, view_pop, email_pm',
    														  'from'   => 'members',
    														  'where'  => 'id='.intval($mid)
    												)		);
    				$this->ipsclass->DB->exec_query();
    				
    				$author = $this->ipsclass->DB->fetch_row();
    				
    				$to_update = array( 'file_open'	 => 1,
    									'file_approver'	=> $this->ipsclass->member['id'],
    									'file_approvedon' => time(),
    									'file_new' => 0
    								   );
    				
    				$this->ipsclass->DB->do_update( "downloads_files", $to_update, "file_id=".$id );
    Change to:

    				$this->ipsclass->DB->build_query( array( 'select' => 'members_display_name, email, view_pop, email_pm, mgroup',
    														  'from'   => 'members',
    														  'where'  => 'id='.intval($mid)
    												)		);
    				$this->ipsclass->DB->exec_query();
    				
    				$author = $this->ipsclass->DB->fetch_row();
    				
    				$to_update = array( 'file_open'	 => 1,
    									'file_approver'	=> $this->ipsclass->member['id'],
    									'file_approvedon' => time(),
    									'file_new' => 0
    								   );
    				
    				if ( $author['mgroup'] == 3 )
    				{
    					$this->ipsclass->DB->do_update( 'members', array( 'mgroup' => XX, ), 'id='.( $mid ) );
    				}
    				
    				$this->ipsclass->DB->do_update( "downloads_files", $to_update, "file_id=".$id );
    Remember to change XX to the Group ID you want to promote the member!

    Now MEMBERS will be promoted to a whatever group you choose. If file is moderated, user group will only change when file is approved.
    Powered by Tutorials 1.3.1 © 2012, by Michael McCune