Jump to content
InvisionCommunity.de - Der Deutsche Invision Community Support
Sign in to follow this  
craxelburger

Post to View Forum --> Language to View Forum?

Recommended Posts

Ist es möglich, diesen Mod hier umzubauen?

Im Moment blendet er die Foren abhängig von der Posting-Zahl aus.

Ich benötige aber sprachabhängige Foren. Das heisst, englische User sollen die deutschen Foren nicht sehen können und umgekehrt. Genauso auch bei anderen Sprachen.

Vielen Dank schonmal für die Hilfe.

ALTER TABLE ibf_forums ADD post_to_view INT(11) DEFAULT '0' NOT NULL;

ALTER TABLE ibf_groups ADD g_avoid_posts TINYINT(1) DEFAULT '0' NOT NULL;
/*------------------------*\

| Posts To View Forum V2.0 |

\*------------------------*/



This is a update of the 1.2 version i made, bugs like searching have been fixed so if they do not have permission to view a topic or post they should not see it.


Files Effected:


./sources/Post.php

./sources/Topics.php

./sources/Boards.php

./sources/Online.php

./sources/functions.php

./sources/Search.php

./sources/Admin/ad_forums.php

./sources/Admin/ad_groups.php




//----------------------------------

Open ./sources/Post.php

//----------------------------------


----------------------------

Find:

----------------------------


        if ( $std->check_perms($this->forum['read_perms']) != TRUE)

        {

  	$std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );

        }



---------------------------

Replace With:

---------------------------


        if ( $std->check_perms($this->forum['read_perms']) != TRUE || $std->check_postsforum($this->forum['post_to_view']) != TRUE)

        {

  	$std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );

        }



//----------------------------------

Save and Open ./sources/Topics.php

//----------------------------------



--------------------------

Find:

--------------------------


  if ( $std->check_perms($this->forum['read_perms']) == TRUE )

  {

  	$return = 0;

  }



--------------------------

Add Below:

--------------------------


  

  if ( $std->check_perms($this->forum['read_perms']) == TRUE || $std->check_postsforum($this->forum['post_to_view']) == TRUE)

  {

  	$return = 0;

  }



//--------------------------------

Save and Open ./sources/Boards.php

//--------------------------------




--------------------------

Find:

--------------------------


        if ( $std->check_perms($forum_data['read_perms']) )

    	{

      $forum_data['fid'] = $forum_data['id'];

      $newest = $forum_data;

      $can_see_root = TRUE;



--------------------------

Replace With:

--------------------------



        if ( $std->check_perms($forum_data['read_perms']) && $std->check_postsforum($forum_data['post_to_view']))

    	{

      $forum_data['fid'] = $forum_data['id'];

      $newest = $forum_data;

      $can_see_root = TRUE;

      


--------------------------

Find:

--------------------------


      	if ( $std->check_perms($data['read_perms']) != TRUE )

    	{

      continue;

    	}


--------------------------

Replace With:

--------------------------


    	if ( $std->check_perms($data['read_perms']) != TRUE && $std->check_postsforum($data['post_to_view']) != TRUE)

    	{

      continue;

    	}





--------------------------

Find:

--------------------------


  	if ( $std->check_perms($forum_data['read_perms']) != TRUE )

  	{

    return "";

  	}


--------------------------

Replace With:

--------------------------


  	if ( $std->check_perms($forum_data['read_perms']) != TRUE && $std->check_postsforum($forum_data['post_to_view']) != TRUE)

  	{

    return "";

  	}



-------------------------

Find:

-------------------------


    if ( ($printed_children < 1) && ($can_see_root != TRUE) )

    {

    	// If we don't have permission to view any forums

    	// and we can't post in this root forum

    	// then simply return and the row won't be printed

    	// 

    	

    	return "";

    	

    }



-------------------------

Add Below:

-------------------------



    if($std->check_postsforum($forum_data['post_to_view']) != TRUE) {

    	return "";

    }







//-----------------------------------

Save and open ./sources/Online.php

//-----------------------------------


------------------------

Find:

------------------------



    	if ( $std->check_perms($this->forums[ $fid ]['read_perms']) == TRUE)

    	{

      $pass = 1;

    	}


------------------------

Replace With:

------------------------



    	if ( $std->check_perms($this->forums[ $fid ]['read_perms']) == TRUE || $std->check_postsforum($this->forums[$fid]['post_to_view']) == TRUE)

    	{

      $pass = 1;

    	}



//------------------------------------

Save and Open ./sources/functions.php

//------------------------------------


------------------------

Find:

------------------------


	/*-------------------------------------------------------------------------*/

	//

	// check_perms() : Nice little sub to check perms

	// Returns TRUE if access is allowed, FALSE if not.

	//

	/*-------------------------------------------------------------------------*/



------------------------

Add Above:

------------------------



	/*-------------------------------------------------------------------------*/

	//

	// check_postsforum() : Nice little sub to check posts

	// If we have enought posts to view forum or can avoid the post amount we 

	// return TRUE, if we do not we return FALSE

	//

	/*-------------------------------------------------------------------------*/


	function check_postsforum($posts) {

  global $ibforums;

  if($posts <= 0) return TRUE;

  if($ibforums->member['g_avoid_posts']) return TRUE;

  if($ibforums->member['posts'] > $posts) return TRUE;

  

  return FALSE;

	}



//----------------------------------

Save and open ./sources/Search.php

//----------------------------------



--------------------------

Find:

--------------------------



f.sub_can_post, f.name as forum_name, f.position, f.read_perms,


--------------------------

Add After:

--------------------------


f.post_to_view,




--------------------------

Find:

--------------------------




  	if ($ibforums->input['f'] and $ibforums->input['f'] == $i['forum_id'])

  	{

    $selected = ' selected="selected"';

  	}



--------------------------

Add Above:

--------------------------


  	if ($ibforums->input['f'] and $ibforums->input['f'] == $i['forum_id'])

  	{

    $selected = ' selected="selected"';

  	}


--------------------------

Find:

--------------------------



$sql_query = "SELECT c.state, f.id, f.read_perms,


--------------------------

Add After:

--------------------------


f.post_to_view,


--------------------------

Find:

--------------------------



$sql_query = "SELECT id, read_perms, password, 


--------------------------

Add After:

--------------------------


 post_to_view,


--------------------------

Find:

--------------------------


$sql_query = "SELECT id, read_perms, password, 


--------------------------

Add After:

--------------------------


 post_to_view,



--------------------------

Find:

--------------------------


    $DB->query("SELECT c.state, f.id, f.read_perms,


--------------------------

Add After:

--------------------------


f.post_to_view,


--------------------------

Find:

--------------------------


if ($c)

      {

      	$DB->query("SELECT id, read_perms,


--------------------------

Add After:

--------------------------


f.post_to_view,



--------------------------

Find:

--------------------------


$DB->query("SELECT id, read_perms, password,



--------------------------

Add After:

--------------------------


post_to_view,


--------------------------

Find:

--------------------------


  if ($can_read == TRUE)

  {

  	if ( $std->check_perms($i['read_perms']) == TRUE)

  	{

    $can_read = TRUE;

  	}


--------------------------

Add Above:

--------------------------


  if($std->check_postsforum($i['post_to_view']) == FALSE) {

  	return FALSE;

  }  



//----------------------------------

Save and Open ./sources/Admin/ad_forums.php

//----------------------------------



----------------------------

Find:

----------------------------



  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Email addresses to send new topic awaiting approval notification?</b><br>(Leave this box empty if you do not require this)<br />Separate many with a comma (add@ress1.com,add@ress2.com)" ,

              $SKIN->form_input("notify_modq_emails", $forum['notify_modq_emails'])

              )      );

              

  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Require password access?<br>Enter the password here</b><br>(Leave this box empty if you do not require this)" ,

              $SKIN->form_input("FORUM_PROTECT")

              )      );

  


----------------------------

Add Below:

----------------------------


  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Amount of Posts to view Forum?</b><br>Enter the amount of posts a user needs to view this forum.<br />(Leave this box empty if you do not want to use this)" ,

              $SKIN->form_input("post_to_view")

              )      );

            


----------------------------

Find:

----------------------------


              	'redirect_url'      => $IN['redirect_url'],

              	'redirect_loc'  => $IN['redirect_loc'],

              	'notify_modq_emails'=> $IN['notify_modq_emails'],


---------------------------

Add Below:

---------------------------



'post_to_view'  => $IN['post_to_view'],  





---------------------------

Find:

---------------------------



  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Email addresses to send new topic awaiting approval notification?</b><br>(Leave this box empty if you do not require this)<br />Separate many with a comma (add@ress1.com,add@ress2.com)" ,

              $SKIN->form_input("notify_modq_emails", $forum['notify_modq_emails'])

              )      );

              

  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Require password access?<br>Enter the password here</b><br>(Leave this box empty if you do not require this)" ,

              $SKIN->form_input("FORUM_PROTECT", $forum['password'])

              )      );




--------------------------

Add Below:

--------------------------




  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Amount of Posts to view Forum?</b><br>Enter the amount of posts a user needs to view this forum.<br />(Leave this box empty if you do not want to use this)" ,

              $SKIN->form_input("post_to_view",$forum['post_to_view'])

              )      );







--------------------------

Find:

--------------------------


              	'redirect_url'      => $IN['redirect_url'],

              	'redirect_loc'  => $IN['redirect_loc'],

              	'notify_modq_emails'=> $IN['notify_modq_emails'],




---------------------------

Add Below:

---------------------------



'post_to_view'  => $IN['post_to_view'],	



---------------------------

Find:

---------------------------



  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Email addresses to send new topic awaiting approval notification?</b><br>(Leave this box empty if you do not require this)<br />Separate many with a comma (add@ress1.com,add@ress2.com)" ,

              $SKIN->form_input("notify_modq_emails", $forum['notify_modq_emails'])

              )      );

              

  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Require password access?<br>Enter the password here</b><br>(Leave this box empty if you do not require this)" ,

              $SKIN->form_input("FORUM_PROTECT", $forum['password'])

              )      );




---------------------------

Add Below:

---------------------------


  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Amount of Posts to view Forum?</b><br>Enter the amount of posts a user needs to view this forum.<br />(Leave this box empty if you do not want to use this)" ,

              $SKIN->form_input("post_to_view",$forum['post_to_view'])

              )      );


  

---------------------------

Find:

---------------------------


              	'redirect_url'      => $IN['redirect_url'],

              	'redirect_loc'  => $IN['redirect_loc'],

              	'notify_modq_emails'=> $IN['notify_modq_emails'],




---------------------------

Add Below:

---------------------------



'post_to_view'  => $IN['post_to_view'],	


        

//-------------------------------------------

Save and Open ./sources/Admin/ad_groups.php

//-------------------------------------------      


      	

--------------------------

Find:

--------------------------



  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Allow user group to post in 'closed' topics?" ,

              $SKIN->form_yes_no("g_post_closed", $group['g_post_closed'] )

              )      );


--------------------------

Add Below:

--------------------------



  $ADMIN->html .= $SKIN->add_td_row( array( "<b>Can view forums with more posts then they have?" ,

              $SKIN->form_yes_no("g_avoid_posts", $group['g_avoid_posts'] )

              )      );

            

-------------------------

Find:

--------------------------


 'g_email_limit'  => intval($IN['join_limit']).':'.intval($IN['join_flood']),


--------------------------

Add Below:

--------------------------


 'g_avoid_posts'  => $IN['g_avoid_posts'],


Save and upload all the files back from where you got them.



You will then have a option in the Forums editing/adding asking how many posts is needed to view.


Their will be option in Groups saying wether to let them avoid the post amount and see the forum regardless if they can see it or not.

Edited by craxelburger

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×