News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Good Post/Bad Post Mod

Started by OutofOrder, June 17, 2009, 10:08:41 AM

Previous topic - Next topic

Snogmarr

'fancyach_smf.messages'

error creating table,,,, this issue is still here and still the same as before/.

BxK

ok i will fix that i just noticed that.

IdanC

 :D

make sure you put a link to donate some to show our appreciation

OutofOrder

#163
First of all, I deeply apologize for having created such expectations. I've been busy and then needed a break of coding.
But I'm back now, so I'll just resume the long-delayed mod update for SMF 2 RC2. ;) Expect an update soon.

Quote from: Stigmartyr on February 04, 2010, 04:51:56 AM


RC2 or the bear get's it..
Please don't  :-\

IdanC

Quote from: OutofOrder on February 18, 2010, 10:09:40 PM
First of all, I deeply apologize for having created such expectations. I've been busy and then needed a break of coding.
But I'm back now, so I'll just resume the long-delayed mod update for SMF 2 RC2. ;) Expect an update soon.

may god give you good crops  :)


OutofOrder

#165
Unless someone comes with a good reason why I shouldn't, I'm going to change the way images are installed by this mod.
As of the current version, the mod installs images in the default template directory and uses them all over the forum. But this is going to change to a per-theme basis, allowing admins to customize button images to better work with their custom themes without breaking the visual style in other themes.
This also means that custom theme installs will take an additional step for forum admins: for each theme they use they will need to create a copy of the mod's images in their theme's /images folder.

Edit: If you excuse me, I will also drop mod support for SMF 2 RC1.x :(
Given the immense code overhaul that happened between RC1 and RC2 (plus the benefits of hundreds of bugfixes and new features), maintaining GPBP support for the older version is a really bad idea and possibly a waste of effort.
I don't intend to tell forum admins what to do, but there shouldn't be enough reason not to have updated to the most recent SMF 2 version.
I'll also test upgrading from SMF RC1.2 to SMF 2 with GPBP mod installed, and see if a special upgrading script is needed, for those that got caught in the process.

diablo3x.dk

#166
Welcome back OutofOrder! Looking very much forward to your mod for RC2 :)
Have been checking this topic several times in hope of your arrival ;)

OutofOrder

The mod was updated to 1.1.3, and now provides SMF 2 RC2 and SMF 1.1.11 compatibility. Please check the first post for more information.


For those using SMF 2 RC2 and the Core theme, here's a guide on the modifications needed for this theme.

FILE: Display.template.php
Search:
$ignoring = false;
Add after:

// If this post is a Bad Post take actions according to the theme settings.
$gpbp_badPost = false;
$gpbp_action = 'none';
if ($context['gpbp_enabled'])
{
$gpbp_badPost = $message['gpbp_score'] <= $modSettings['gpbp_hide_threshold'];
if ($gpbp_badPost)
{
/* The 'gpbp_hide_action' option may have one out of three values:
0: by default hide post contents,
1: display greyed-out post contents,
2: display post contents regardless.
Remember to force post display for certain Bad posts: own or chosen.
*/
if (($message['member']['id'] == $context['user']['id'] && !$message['member']['is_guest']) || $message['id'] == $context['gpbp_revealed'])
$gpbp_action = 'grey';
else
$gpbp_action = !empty($options['gpbp_hide_action']) ? ($options['gpbp_hide_action'] == 1 ? 'grey' : 'none') : 'hide';
}
}


Search:
<div class="bordercolor">';
Replace with:
<div class="bordercolor"', $gpbp_action == 'hide' ? ' id="gpbp_hidden_' . $message['id'] . '"' : '' ,'>';

Search:
($message['alternate'] == 0 ? 'windowbg' : 'windowbg2')
Replace with:
($gpbp_action == 'hide' ? 'gpbp_hider ' : '') . ($gpbp_badPost && $gpbp_action != 'none' ? 'gpbp_greyed' : ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2'))

Search:
// Any custom fields to show as icons?
Add before it
// Show their amount of Respect.
if ($context['gpbp_enabled'] && !empty($modSettings['gpbp_display_respect']))
echo '
<li class="margintop">', $txt['gpbp_respect'], ': <span class="gpbp_respect_count_', $message['member']['id'], '">', $message['member']['gpbp_respect'] > 0 ? '+' : '', $message['member']['gpbp_respect'], '</span></li>';



Search:
echo '
</div>';

// Ignoring this user? Hide the post.

Add before it:
// Good Post/Bad Post score and voting.
if ($context['gpbp_enabled'])
{
$message['gpbp_score'] = ( $message['gpbp_score'] > 0 ? '+' : '' ) . $message['gpbp_score'];
echo '
<div class="gpbp_vote">
<span id="gpbp_score_', $message['id'], '" class="help" title="', $txt['gpbp_post_score'], '">', $message['gpbp_score'], '</span>';

if ($context['can_vote_gpbp'] && !$ignoring && $message['member']['id'] != $context['user']['id'])
{
echo '
<a onclick="oVotePost.vote(\'down\', \'', $message['id'], '\', \'', $context['session_id'], '\'); return false" href="', $scripturl, '?action=gpbp;sa=down;msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], ';board=', $context['this_board'], ';topic=', $context['current_topic'], '"><img class="gpbp_vote_img" id="gpbp_vote_down_', $message['id'], '" src="', $settings['images_url'], '/gpbp_arrow_down', $message['gpbp_img']['down']['lit_suffix'], '.gif" alt="', $txt[ $message['gpbp_img']['down']['alt'] ], '" title="', $txt[ $message['gpbp_img']['down']['title'] ], '" /></a>
<a onclick="oVotePost.vote(\'up\', \'', $message['id'], '\', \'', $context['session_id'], '\'); return false" href="', $scripturl, '?action=gpbp;sa=up;msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], ';board=', $context['this_board'], ';topic=', $context['current_topic'], '"><img class="gpbp_vote_img" id="gpbp_vote_up_', $message['id'], '" src="', $settings['images_url'], '/gpbp_arrow_up', $message['gpbp_img']['up']['lit_suffix'], '.gif" alt="', $txt[ $message['gpbp_img']['up']['alt'] ], '" title="', $txt[ $message['gpbp_img']['up']['title'] ], '" /></a>';
}

echo  '
</div>';
}



Search:
$message['body']
Replace with:
$gpbp_badPost && !$context['reveal_bad_post'] ? '' : $message['body']

Search:
echo '
</div>
<div class="moderatorbar">

Add before it:
// If a Bad Post must be hidden, only display its date and a "Show" link... nothing else.
if ($gpbp_badPost && $gpbp_action == 'hide')
echo '
</div>
<div class="postarea gpbp_do_show">
<div class="middletext">
', $message['time'], ' - <em>', $txt['gpbp_hidden'], '</em>', $context['reveal_bad_post'] ? ' <a class="gpbp_show" onclick="gpbp_show_post(\'' . $message['id'] . '\'); return false" href="' . $message['href_gpbp_show'] . '">' . $txt['gpbp_show'] . '</a>' : '', '
</div>';



Search:
echo '
// ]]></script>';

Add before it:
if ($context['gpbp_enabled'])
echo '
var oVotePost = new PostVoting({
sSessionVar: "', $context['session_var'], '",
iBoard: ', $context['this_board'], ',
iTopic: ', $context['current_topic'], ',
sVoteDownAlt: "', $txt['gpbp_vote_down'], '",
sVoteUpAlt: "', $txt['gpbp_vote_up'], '",
sVotedDownAlt: "', $txt['gpbp_voted_down_alt'], '",
sVotedUpAlt: "', $txt['gpbp_voted_up_alt'], '",
sVotedDown: "', $txt['gpbp_voted_down'], '",
sToVoteDown: "', $txt['gpbp_to_vote_down'], '",
sVotedUp: "', $txt['gpbp_voted_up'], '",
sToVoteUp: "', $txt['gpbp_to_vote_up'], '",
sScriptUrl: "', $scripturl, '",
sImagesUrl: "', $settings['images_url'], '"
});';




FILE: Stats.template.php
Search:
<td width="20%" align="right" valign="top" nowrap="nowrap">', $poster['time_online'], '</td>
</tr>';

Add after:

if (!empty($modSettings['gpbp_display_stats']))
{
echo '
</table>
</td>
</tr><tr>
<td class="catbg" colspan="2" width="50%"><b>', $txt['gpbp_top_voters'], '</b></td>
<td class="catbg" colspan="2" width="50%"><b>', $txt['gpbp_most_respected'], '</b></td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_posters.gif" width="20" height="20" alt="" /></td>
<td class="windowbg2" width="50%" valign="top">
<table border="0" cellpadding="1" cellspacing="0" width="100%">';
foreach ($context['gpbp_top_voters'] as $poster)
echo '
<tr>
<td width="60%" valign="top">', $poster['link'], '</td>
<td width="20%" align="left" valign="top">', $poster['votes'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $poster['votes_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
<td width="20%" align="right" valign="top">', $poster['votes'], '</td>
</tr>';
echo '
</table>
</td>
<td class="windowbg" width="20" valign="middle" align="center" nowrap="nowrap"><img src="', $settings['images_url'], '/stats_posters.gif" width="20" height="20" alt="" /></td>
<td class="windowbg2" width="50%" valign="top">
<table border="0" cellpadding="1" cellspacing="0" width="100%">';
foreach ($context['gpbp_most_respected'] as $poster)
echo '
<tr>
<td width="60%" valign="top">', $poster['link'], '</td>
<td width="20%" align="left" valign="top">', $poster['respect'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $poster['respect_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
<td width="20%" align="right" valign="top" nowrap="nowrap">', $poster['respect'], '</td>
</tr>';
}



FILE: Settings.template.php
Search:
2 => $txt['display_quick_mod_image'],
),
'default' => true,
),

Add after:
array(
'id' => 'gpbp_hide_action',
'label' => $txt['gpbp_hide_action'],
'options' => array(
0 => $txt['gpbp_hide_action_hide'],
1 => $txt['gpbp_hide_action_grey'],
2 => $txt['gpbp_hide_action_none'],
),
'default' => true,
),


Finally, download, unpack and upload the files from the attached zip file into the Core theme folder. That's it, you should get it up and running!

smldmr

Wow. Thank You for the update. I installed it immediately on my board.

diablo3x.dk

So, what if I want this to work with custom theme? :)

smldmr

Hello, now, after i installed this mod, my server have more than 1400 connections at the same time. All of the connection request are comming from the index.php.

OutofOrder

I've updated the instructions to install this mod in custom themes.
Click here to download them ;)


Quote from: smldmr on February 20, 2010, 09:29:03 AM
Hello, now, after i installed this mod, my server have more than 1400 connections at the same time. All of the connection request are comming from the index.php.
Hi. I don't know how active your forums are, but is that too much for your normal activity? In that case, this may mean that you have bots registered in your forum and they're crawling the voting links in your threads.

Snogmarr

I appear to be having a problem,
I can see the hide grey out and do nothing option but nothing else,  I have looked in admin, mods, features options,, modify boards, and posts and topics and there is nothing? Running default theme in 2 rc2
Any advise please ?

diablo3x.dk

QuoteNote: If your custom theme doesn't include a Display.template.php file, it means there's nothing to edit for the
mod to properly work.

I use this theme: http://custom.simplemachines.org/themes/index.php?lemma=2049
No display.tamplate.php file as far as I'm concerned. Does this mean I can't use the mod?  :-[ Or is it just that I don't need to concern that part of the manual instructions?

OutofOrder

Quote from: xnathansxdadx on February 20, 2010, 11:05:21 AM
I can see the hide grey out and do nothing option but nothing else,  I have looked in admin, mods, features options,, modify boards, and posts and topics and there is nothing? Running default theme in 2 rc2
Any advise please ?
I don't understand what your problem is. You don't see the voting buttons? Did the mod install without problems?

Quote from: diablo3x.dk on February 20, 2010, 12:45:52 PM
No display.tamplate.php file as far as I'm concerned.
Then it should be using the Display.template.php file from the Curve theme, which means you don't have to worry about that file :)

smldmr

Quote from: OutofOrder on February 20, 2010, 10:25:06 AM
Hi. I don't know how active your forums are, but is that too much for your normal activity? In that case, this may mean that you have bots registered in your forum and they're crawling the voting links in your threads.


Normally, my all server has about 400 connections (ther are 4 webcams, their connections are the most of them). How can i forbit it to the bots?

diablo3x.dk

QuoteThen it should be using the Display.template.php file from the Curve theme, which means you don't have to worry about that file :)

Cool. Will try it out. Thanks :)

Snogmarr

Quotedon't understand what your problem is. You don't see the voting buttons? Did the mod install without problems?

Yes it did but I then looked in the error log and received this


-http://-------------- Forums/index.php?/topic,18.0.html

8: Undefined index: gpbp_enabled

File: -------------------Member-Forums/Sources/Display.php
Line: 1492

Which shows this

1488:
   
// Good Post Bad Post mod 1489:
   
$context['this_board'] = $board; 1490:
   
$context['gpbp_votes'] = array(); 1491:
   
// Not a mistake! That's a single equals. ==>1492:
   
if ($context['gpbp_enabled'] = $board_info['gpbp_enabled']) 1493:
   
{

OutofOrder

There's probably a bad edit in your Load.php file.
Please go to the mod page, open the mod installation instructions for your smf version and check that the 5 edits are in place, comparing to your own Load.php file.

diablo3x.dk

Got it working on my test page. Will install on main first thing tomorrow.

Advertisement: