phpBBHacks.com - Fully Integrated Shoutbox - minimum posts to view help
DeveloperCube, a community for webmasters and web developers
StatsForums Home   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
FAQFAQ   SearchSearch   MemberlistMemberlist   TutorialsTutorials   ContactContact Us
Add Us:     MySpace     Facebook     StumbleUpon
Username:    Password:
Remember Me?    
Fully Integrated Shoutbox - minimum posts to view help
BlinkList
del.icio.us
Furl
linkaGoGo
reddit
Simpy
Mister Wong
Yahoo! My Web

Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2 Hack Support
 See a User Guidelines violation? Please contact us.
Author Message

Carly
New User

Joined: 10 Aug 2007
Posts: 3
Location: Melbourne, Victoria, Australia

PostPosted: May 27th 2008, 1:51 am    Post subject: Fully Integrated Shoutbox - minimum posts to view help Reply with quote

Hi Everyone,

I'm not sure if anyone can help me but if you can I would really appreciate it. I am running phpbb 2.022

I have successfully installed the Fully Integrated Shoutbox hack: http://www.phpbbhacks.com/download/1255

I would really like to make this so that only members who have posted at least 10 times have access to post in the shoutbox.

OR

Make it so that only members who have posted at least 10 times can view it.

Either option, whatever is easier would be fine.

So far I have successfully made it so that only registered users can view the shoutbox and post in it but I would love to be able to do one of the above.

Further information:

I thought I may be able to utilise the following php code that was posted elsewhere that makes it so that only members who have posted at least 10 times can access a download section:

Code:
$post_count = $userdata['user_posts'];
$who = $userdata['username'];
$limit = "10";

if($post_count < $limit)
{
message_die(GENERAL_ERROR, "Sorry ". $who .", but you need atleast ." $limit ." posts to download files from this site.", 'Error');
}


I thought I may be able to incorporate this into the shoutbox.php file etc but have tried different variations with no success. It usually copies the entire index page into the frame but with no scrolling abilities so it just shows part of my logo.

Here is a copy of the shoutbox.php file:

Code:
<?php
/***************************************************************************
 *                               shoutbox.php
 *                            -------------------
 *   begin                :  Feb, 2003
 *   author               : Niels Chr. Denmark <ncr@db9.dk> (http://mods.db9.dk)
 *
 * version 1.1.0
 *
 * History:
 *   0.9.0. - initial BETA
 *   0.9.1. - header added
 *   0.9.2. - shout can now be submitted by hitting enter
 *   0.9.3. - now support view back in time, + maximized view
 *   0.9.4. - now support preview in the maximized version
 *   0.9.5. - corrected currupted message if special combination
 *   0.9.6. - guest can't shout
 *   0.9.7. - shoutbox.php no longer support maximazed versin, instead sepperate file is offered
 *   1.0.0. - removed the DB stylesheet information, to speed up page load
 *   1.0.1. - corrected that guests username is stored correctly,when submitting a shout
 *   1.0.2. - corrected a bug regarding flood control
 *   1.0.3. - corrected displaying flood error more correctly
 *   1.1.0. - now include bbcode, in seperate js script
 *
 * a fully phpBB2 integrated shoutbox
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
define ('NUM_SHOUT', 20);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_SHOUTBOX_MAX);
init_userprefs($userdata);
//
// End session management
//

//
// Start auth check
//
switch ($userdata['user_level'])
{
   case ADMIN :
   case MOD :   $is_auth['auth_mod'] = 1;
   default:
         $is_auth['auth_read'] = 1;
         $is_auth['auth_view'] = 1;
         if ($userdata['user_id']==ANONYMOUS)
         {
            $is_auth['auth_delete'] = 0;
            $is_auth['auth_post'] = 0;
         } else
         {
            $is_auth['auth_delete'] = 1;
            $is_auth['auth_post'] = 1;
         }
}

if( !$is_auth['auth_read'] )
{
   message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);
}
//
// End auth check
//

$refresh = (isset($HTTP_POST_VARS['auto_refresh']) || isset($HTTP_POST_VARS['refresh'])) ? 1 : 0;
$submit = (isset($HTTP_POST_VARS['shout']) && isset($HTTP_POST_VARS['message'])) ? 1 : 0;
if ( !empty($HTTP_POST_VARS['mode']) || !empty($HTTP_GET_VARS['mode']) )
   {
      $mode = ( !empty($HTTP_POST_VARS['mode']) ) ? intval($HTTP_POST_VARS['mode']) : intval($HTTP_GET_VARS['mode']);
   }
   else
   {
      $mode = '';
   }

//
// Set toggles for various options
//
if ( !$board_config['allow_html'] )
{
   $html_on = 0;
}
else
{
   $html_on = ( $submit || $refresh || preview) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
}
if ( !$board_config['allow_bbcode'] )
{
   $bbcode_on = 0;
}
else
{
   $bbcode_on = ( $submit || $refresh || preview) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] );
}

if ( !$board_config['allow_smilies'] )
{
   $smilies_on = 0;
}
else
{
   $smilies_on = ( $submit || $refresh || preview) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] );
   if ($smilies_on)
   {
      include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
      generate_smilies('inline', PAGE_SHOUTBOX_MAX);
      if ($mode == 'smilies')
      {
         generate_smilies('window', PAGE_SHOUTBOX_MAX);
         exit;
      }
      
   }
}

if ($refresh)
{
   $message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';
   if (!empty($message))
   {
      $template->assign_var('MESSAGE',$message);
   }
} else
if ($submit || isset($HTTP_POST_VARS['message']))
{
   $current_time = time();
   //
   // Flood control
   //
   $where_sql = ( $userdata['user_id'] == ANONYMOUS ) ? "shout_ip = '$user_ip'" : 'shout_user_id = ' . $userdata['user_id'];
   $sql = "SELECT MAX(shout_session_time) AS last_post_time
      FROM " . SHOUTBOX_TABLE . "
      WHERE $where_sql";
   if ( $result = $db->sql_query($sql) )
   {
      if ( $row = $db->sql_fetchrow($result) )
      {
         if ( $row['last_post_time'] > 0 && ( $current_time - $row['last_post_time'] ) < $board_config['flood_interval'] )
         {
            $error = true;
            $error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Flood_Error'] : $lang['Flood_Error'];
         }
      }
   }
   // Check username
   if ( !empty($username) )
   {
      $username = htmlspecialchars(trim(strip_tags($username)));

      if ( !$userdata['session_logged_in'] || ( $userdata['session_logged_in'] && $username != $userdata['username'] ) )
      {
         include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);

         $result = validate_username($username);
         if ( $result['error'] )
         {
            $error_msg .= ( !empty($error_msg) ) ? '<br />' . $result['error_msg'] : $result['error_msg'];
         }
      }
   }
   $message = (isset($HTTP_POST_VARS['message'])) ? trim($HTTP_POST_VARS['message']) : '';
   // insert shout !
   if (!empty($message) && $is_auth['auth_post'] && !$error)
   {
      include_once($phpbb_root_path . 'includes/functions_post.'.$phpEx);
      $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
      $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
      $sql = "INSERT INTO " . SHOUTBOX_TABLE. " (shout_text, shout_session_time, shout_user_id, shout_ip, shout_username, shout_bbcode_uid,enable_bbcode,enable_html,enable_smilies)
            VALUES ('$message', '".time()."', '".$userdata['user_id']."', '$user_ip', '".$username."', '".$bbcode_uid."',$bbcode_on,$html_on,$smilies_on)";
      if (!$result = $db->sql_query($sql))
      {
         message_die(GENERAL_ERROR, 'Error inserting shout.', '', __LINE__, __FILE__, $sql);
      }
      // auto prune
      if ($board_config['prune_shouts'])
      {
         $sql = "DELETE FROM " . SHOUTBOX_TABLE. " WHERE shout_session_time<=".(time()-86400*$board_config['prune_shouts']);
         if (!$result = $db->sql_query($sql))
         {
            message_die(GENERAL_ERROR, 'Error autoprune shouts.', '', __LINE__, __FILE__, $sql);
         }
      }
   }
}

// see if we need offset
if ((isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['start'])) && !$submit)
{
   $start=(isset($HTTP_POST_VARS['start'])) ? intval($HTTP_POST_VARS['start']) : intval($HTTP_GET_VARS['start']);
} else $start=0;

   //
   // Show simple shoutbox
   //

   if ( $is_auth['auth_post'] )
   {
      $template->assign_block_vars('switch_auth_post', array());
   }   
   else
   {   
      $template->assign_block_vars('switch_auth_no_post', array());
   }

   if ($bbcode_on)
   {
      $template->assign_block_vars('switch_auth_post.switch_bbcode', array());
   }
   $template->set_filenames(array(
           'body' => 'shoutbox_body.tpl'));


$template->assign_vars(array(
   'U_SHOUTBOX' => append_sid("shoutbox.$phpEx?start=$start"),
   'U_SHOUTBOX_VIEW' => append_sid("shoutbox_view.$phpEx?start=$start"),
   'T_HEAD_STYLESHEET' => $theme['head_stylesheet'],
   'T_NAME' => $theme['template_name'],

   'L_SHOUTBOX' => $lang['Shoutbox'],
   'L_SHOUT_PREVIEW' => $lang['Preview'],
   'L_SHOUT_SUBMIT' => $lang['Go'],
   'L_SHOUT_TEXT' => $lang['Shout_text'],
   'L_SHOUT_REFRESH' => $lang['Shout_refresh'],
'L_SMILIES' => $lang['Emoticons'],
'T_URL' => "templates/".$theme['template_name'],
'S_CONTENT_ENCODING' => $lang['ENCODING'],
   'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'],

   'SHOUT_VIEW_SIZE' => ($max) ? $max : 0,
   'S_HIDDEN_FIELDS' => $s_hidden_fields
   ));
   if( $error_msg != '' )
   {
      $template->set_filenames(array(
         'reg_header' => 'error_body.tpl')
      );
      $template->assign_vars(array(
         'ERROR_MESSAGE' => $error_msg)
      );
      $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
      $message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';
      $template->assign_var('MESSAGE',$message);
   }

$template->pparse('body');

?>


Any assistance would be much appreciated.

Thanks,


Carly
_________________
Thanks


Carly
All Pet Chat
Back to top
View user's profile Send private message Visit poster's website

Indie
Not So New User

Joined: 16 Oct 2005
Posts: 25

PostPosted: July 1st 2008, 5:31 pm    Post subject: Reply with quote

Another angle you could try would be to add a template switch with a bit of code to check the user's postcount. That way whatever you put in that block won't show in the template at all, except to users you want to have access.

It'd be a bit more elegant than throwing an error, since new users (without the required postcount) simply wouldn't see it at all.
_________________
Mods/Hacks Installed, Unique Templates, Updates and Repairs... Complete phpBB Websites... Reasonable. Email, PM or IM.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2 Hack Support All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Big Message Boards - Free JavaScript - phpBB2 - phpbb styles - Suporte phpBB - phpBB.it - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - PhotoshopForums.com - DeveloperCube - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - DrGregHouse.com - Bad Boy Blog - BadBoyForums.com - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Staff - User Guidelines >

Copyright © 2001-2008. iFroggy Network, phpBBHacks.com. All Rights Reserved. Privacy Policy. We Support phpBBHacks.com (of course!).
Powered by phpBB © phpBB Group. phpBB SEO. Hosted by 100MegsWebHosting. We are in no way affiliated with the phpBB Group. phpBB is copyright to the phpBB Group.