Jump to content

  •  

  • Tutorial info Visit support topic

    • Added on: Nov 22 2008 11:21 AM
    • Date Updated: Nov 22 2008 11:27 AM
    • Views: 613
     


    * * * * *
    0 Ratings

    Topic state according to file state

    Leave topic created with the same status of file

    Posted by Adriano Faria on Nov 22 2008 11:21 AM
    If you use setting Topic generation upon file submission, when you unapprove a file, the topic created remains approved. With this tutorial, the topic created will be unapproved too... and vice versa.

    Open sources\components_public\downloads\moderate.php and find:

    		if( $file['file_open'] == 0 )
    			  {
    				  $this->do_multi_approve( array( $id => $id ) );
    				  $text = $this->ipsclass->lang['moderate_approve'];
    			  }
    			  else
    			  {
    				  $to_update['file_open'] = 0;
    				  $this->ipsclass->DB->do_update( "downloads_files", $to_update, "file_id=".$id );
    				  $text = $this->ipsclass->lang['moderate_unapprove'];
    			  }
    Change to:

    		if( $file['file_open'] == 0 )
    			  {
    				  $this->do_multi_approve( array( $id => $id ) );
    				  $this->ipsclass->DB->do_update( "topics", array ( 'approved' => 1 ), "tid=".$file['file_topicid'] );
    				  $text = $this->ipsclass->lang['moderate_approve'];
    			  }
    			  else
    			  {
    				  $to_update['file_open'] = 0;
    				  
    				  $this->ipsclass->DB->do_update( "downloads_files", $to_update, "file_id=".$id );
    				  $this->ipsclass->DB->do_update( "topics", array ( 'approved' => 0 ), "tid=".$file['file_topicid'] );
    				  $text = $this->ipsclass->lang['moderate_unapprove'];
    			  }
    	 
    			 $modfunc = $this->ipsclass->load_class( ROOT_PATH.'sources/lib/func_mod.php', 'func_mod' );
    			 $modfunc->forum_recount( $this->catlib->cat_lookup[$file['file_cat']]['coptions']['opt_topicf'] );
    			 $modfunc->stats_recount();
    			 $this->ipsclass->update_forum_cache();
    Find:

    				$this->ipsclass->DB->do_update( "downloads_files", $to_update, "file_id=".$id );
    Add below:

    				$this->ipsclass->DB->do_update( "topics", array ( 'approved' => 1 ), "tid=".$file['file_topicid'] );
    Find:

    			return $num;
    			}
    		}	
    		
    		
    		/*-------------------------------------------------------------------------*/
    		// Do multi-unapprove
    		/*-------------------------------------------------------------------------*/
    Add above:

    			$modfunc = $this->ipsclass->load_class( ROOT_PATH.'sources/lib/func_mod.php', 'func_mod' );
    				$modfunc->forum_recount( $this->catlib->cat_lookup[$file['file_cat']]['coptions']['opt_topicf'] );
    				$modfunc->stats_recount();
    				$this->ipsclass->update_forum_cache();
    Find:

    				$this->ipsclass->DB->do_update( "downloads_files", array( 'file_open' => 0 ), "file_id=".$id );
    Add below:

    				$this->ipsclass->DB->do_update( "topics", array ( 'approved' => 0 ), "tid=".$file['file_topicid'] );
    Find:

    			return $num;
    			}
    		}	
    		
    		
    		/*-------------------------------------------------------------------------*/
    		// Do multi-move
    		/*-------------------------------------------------------------------------*/
    Add above:

    			$modfunc = $this->ipsclass->load_class( ROOT_PATH.'sources/lib/func_mod.php', 'func_mod' );
    				$modfunc->forum_recount( $this->catlib->cat_lookup[$file['file_cat']]['coptions']['opt_topicf'] );
    				$modfunc->stats_recount();
    				$this->ipsclass->update_forum_cache();
    Screenshot:

    Posted Image

    File unapproved on IP.Downloads and below the topic unapproved too


    Powered by Tutorials 1.4.1 © 2012, by Michael McCune