Advertisement:

Author Topic: Good Post/Bad Post Mod  (Read 149562 times)

Offline Ihmeliö

  • Jr. Member
  • **
  • Posts: 133
Re: Good Post/Bad Post Mod
« Reply #400 on: September 09, 2011, 03:45:03 PM »
Any hope of a feature listing all posts that have received at least *** upvotes?

Or at least "top 100 (or whatever) posts of all time"?

More statistics = always good.

(does someone know if there's still going to be updates for this mod?)

Offline JohnWayne999

  • Semi-Newbie
  • *
  • Posts: 88
    • AutoAward
Re: Good Post/Bad Post Mod
« Reply #401 on: October 09, 2011, 01:44:16 AM »
Hi guys, hope what I'm going to say is useful to some people. I am running SMF 1.1.15 and successfully installed GoodPostBadPost1.1.3a.zip using the package manager. However I made some minor changes described as follows:

When I asked package manger to take on the original GoodPostBadPost1.1.3a.zip, the manager told me something like "version incompatible" or "may be corrupt".  So I unzipped the file and took a quick look myself.

I first looked at gpbp_1.1.x_install.php which looked like it's creating database/tables. Nothing interesting so I closed it.
Next I looked at install_1.1.x.xml. Looked like it's a mega find and insert machine. More like a patcher. Nothing interesting. Close it too.

Before I decided to giveup, I had a quick look in package-info.xml, and it contained version information. So what I tried was nothing tricky, I just changed all instances of 1.1.3 to 1.1.15. For example:  <install for="1.1-1.1.3"> became    <install for="1.1-1.1.15">.
Then I zipped up the whole thing (I called it GoodPostBadPost1.1.15.zip, attached to this post).

I was happy to guess that's the information the package manager used to check against SMF version. Apparently it must have taken the range 1.1-1.1.3 and compared against my SMF's 1.1.15 and then decided not to proceed. So after what I changed, hopefully the manager will now be fooled to go ahead with the rest of the installation. And I was right. I fed the package manager my modified zip and this time there was no complaint about version incompatibility.  However upon doing a simulation run on the package, the simulation complained of one failed test namely "Execute Modification --- ./Sources/ManagePermissions.php   --- Test failed". Didn't really care about it. Worse comes the worst I can just tweek that file manually myself. Anyway cut long story short, I just ignored the warning and proceeded to install the mod. Installed fine and the good feedback / bad feedback function worked smoothly for user logged in as admin.

But hang on. When I test logged in as a newbie, I couldn't leave good/bad feedbacks. I tried to set permissions to allow newbies to leave feedbacks but there's nothing for me to choose from in the permissions menu. It occurred to me, must be the Sources/ManagePermissions.php that's screwing around with me. So back I went to check install_1.1.x.xml inside which is this section about how to modify Sources/ManagePermissions.php:

Code: [Select]
<file name="$sourcedir/ManagePermissions.php">
<operation>
<search position="before"><![CDATA['edit_news' => false,]]></search>
<add><![CDATA[
'gpbp_manage' => false,]]></add>
</operation>

<operation>
<search position="after"><![CDATA[ )
),
'board' => array(]]></search>
<add><![CDATA[ ),
'gpbp' => array(
'gpbp_vote' => false,
'gpbp_reveal' => false,
]]></add>
</operation>

<operation>
<search position="before"><![CDATA['send_mail',]]></search>
<add><![CDATA[
'gpbp_manage',
'gpbp_vote',]]></add>
</operation>
</file>

I checked with the copy of ManagePermission.php on the server and only two spots were modified, not the required three.
This part is missing:
Code: [Select]
'gpbp' => array(
'gpbp_vote' => false,
'gpbp_reveal' => false,
                                )

So I manually added it in. Cut long story short, you should replace this
Code: [Select]
'chat' => array(
'chat_access' => false,
'chat_mod' => false,
'shout_view' => false,
'shout_access' => false,
'shout_mod' => false,
)

with this
Code: [Select]
'chat' => array(
'chat_access' => false,
'chat_mod' => false,
'shout_view' => false,
'shout_access' => false,
'shout_mod' => false,
),
                        'gpbp' => array(
'gpbp_vote' => false,
'gpbp_reveal' => false,
                        )

This time everything worked fine. First time around you need to log in as admin -> ADMIN -> Members -> Permission -> Once in, set normal users to be allowed to "Vote on posts (up or down)" and be allowed to "Reveal bad posts" -> Then confirm by clicking on "Set permissions" button. Now you are really done. Everything should work now. Admin and normal users can both leave positive or negative feedbacks.

Most people are probably fine with installing GoodPostBadPost to their SMF. Just in case you are like me using 1.1.15 and have no idea how to get past the Package Manager first time, I've attached to this post my modified and rezipped version. I called it GoodPostBadPost1.1.15.zip. See if works for you. Note you still need to do that last bit of modification to the ManagePermissions.php as described above, because I am too lazy to incoporate that into the zip. Also don't forget to backup everything beforehand as always.

So in a nutshell I just changed the version check information in the package, and I manually added a bit of detail into Sources/ManagePermissions.php that's all and the rest flowed on normally.

(By the way, people might want to consider FacebookLike MOD also. It's basically the same thing but each post can accumulate likes and no thumbs downs. http://custom.simplemachines.org/mods/index.php?mod=3105 )
« Last Edit: October 09, 2011, 07:46:52 PM by JohnWayne999 »

Offline girlfloyd

  • Newbie
  • *
  • Posts: 2
Re: Good Post/Bad Post Mod
« Reply #402 on: October 10, 2011, 10:52:18 AM »
I made this install in 2.0.1 by modifying the versions in the package-info.xml as JohnWayne999 said. However, there were no issues with the ./Sources/ManagePermissions.php file for me. The problem was with ./Sources/Display.php.

Find this:

Code: [Select]
m.id_msg_modified < {int:new_from} AS is_read, k.message AS is_repped
Replace with:

Code: [Select]
m.id_msg_modified < {int:new_from} AS is_read, gpbp_score, k.message AS is_repped
That should fix it so that it saves the ratings in 2.0.1.

Now I need to figure out how to make the ratings show in the topic titles listed in the forum...  Let me know if anyone can help with this! :P

Offline Guillelmus

  • Semi-Newbie
  • *
  • Posts: 92
    • Usko ja elämä -forum (in Finnish)
Re: Good Post/Bad Post Mod
« Reply #403 on: October 18, 2011, 02:26:17 PM »
Installs fine on 2.0.1 just can't see the list of voters.  ??? Any ideas?

Offline Guillelmus

  • Semi-Newbie
  • *
  • Posts: 92
    • Usko ja elämä -forum (in Finnish)
Re: Good Post/Bad Post Mod
« Reply #404 on: October 18, 2011, 02:55:07 PM »
Also code for hiding the number if zero would be nice. Let's see if I can figure it out myself...

Offline Guillelmus

  • Semi-Newbie
  • *
  • Posts: 92
    • Usko ja elämä -forum (in Finnish)
Re: Good Post/Bad Post Mod
« Reply #405 on: October 18, 2011, 03:13:32 PM »
Also code for hiding the number if zero would be nice. Let's see if I can figure it out myself...
Ok.

In Display.template.php
Replace
Code: [Select]
echo '
<span id="gpbp_score_', $message['id'], '" class="help" title="', $txt['gpbp_post_score'], '">', $message['gpbp_score'], '</span>';

with

         
Code: [Select]
if (!empty($message['gpbp_score']))  echo '
<span id="gpbp_score_', $message['id'], '" class="help" title="', $txt['gpbp_post_score'], '">', $message['gpbp_score'], '</span>';

Offline Guillelmus

  • Semi-Newbie
  • *
  • Posts: 92
    • Usko ja elämä -forum (in Finnish)
Re: Good Post/Bad Post Mod
« Reply #406 on: October 19, 2011, 06:46:03 AM »
Installs fine on 2.0.1 just can't see the list of voters.  ??? Any ideas?
Oh, it was disabled in the options. Admin -> Forum/Good Post Bad Post -> Advanced configuration -> Amount of members to display in post voters list: must be greater than zero.

I'd like to see the names on mouse hover on though. :-)

Offline Guillelmus

  • Semi-Newbie
  • *
  • Posts: 92
    • Usko ja elämä -forum (in Finnish)
Re: Good Post/Bad Post Mod
« Reply #407 on: October 19, 2011, 06:51:34 AM »
For hiding voters list if no-one has voted:

In Display.template.php
Find:
Code: [Select]
if ($context['reveal_voterslist'])Replace with:
Code: [Select]
if (($context['reveal_voterslist'])&&(!empty($message['gpbp_score'])))

Offline Guillelmus

  • Semi-Newbie
  • *
  • Posts: 92
    • Usko ja elämä -forum (in Finnish)
Re: Good Post/Bad Post Mod
« Reply #408 on: October 19, 2011, 07:21:37 AM »
I'd like to see the names on mouse hover on though. :-)
Quick and not very smart fix to this is to change onclick value to onmouseover

In Display.template.php

Find:
Code: [Select]
<a class="gpbp_voterslist" id="gpbp_voterslist_', $message['id'], '" onclick="oVotePost.voterslist(\'', $message['id'], '\'); return false"><img class="gpbp_vote_img" src="', $settings['images_url'], '/gpbp_voterslist.gif" alt="', $txt['gpbp_show_voters'], '" title="', $txt['gpbp_show_voters'], '" /></a>
Replace with:
Code: [Select]
<a class="gpbp_voterslist" id="gpbp_voterslist_', $message['id'], '" onmouseover="oVotePost.voterslist(\'', $message['id'], '\'); return false"><img class="gpbp_vote_img" src="', $settings['images_url'], '/gpbp_voterslist.gif" alt="', $txt['gpbp_show_voters'], '" title="', $txt['gpbp_show_voters'], '" /></a>

Offline Guillelmus

  • Semi-Newbie
  • *
  • Posts: 92
    • Usko ja elämä -forum (in Finnish)
Re: Good Post/Bad Post Mod
« Reply #409 on: October 19, 2011, 01:20:54 PM »
Liked messages should be hidden from the Messages of the week list if they're on a board the user cannot read.

Offline Major Wood

  • Semi-Newbie
  • *
  • Posts: 45
Re: Good Post/Bad Post Mod
« Reply #410 on: October 21, 2011, 06:12:01 PM »
Every time that I click on install (to go to the page that tests the various operations, not the confirmation page) for this mod, I start getting 500 errors sitewide.
Any thoughts? Running 2.0.1

Offline Gambi

  • Semi-Newbie
  • *
  • Posts: 69
Re: Good Post/Bad Post Mod
« Reply #411 on: October 30, 2011, 07:13:01 AM »
Hi, is this mod supposed to refresh the page when you click the up or down arrow? It'll register it if you refresh manually but it'll be great if it could update instantly or refresh the page kind of like how karma works. I've tried but couldn't get it to work. Does anyone know how they'd alter the code below so it refreshes the page at that post or even just updated the arrows instantly. I'd appreciate the help.

Code: [Select]
// 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 normaltext">
<span id="gpbp_score_', $message['id'], '" class="help" title="', $txt['gpbp_post_score'], '">', $message['gpbp_score'], '</span>';

if ($context['can_vote_gpbp'] && $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'], ';sesc=', $context['session_id'], ';board=', $context['this_board'], ';topic=', $context['current_topic'], '"><img class="gpbp_vote_img" id="gpbp_vote_down_', $message['id'], '" src="', $settings['default_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'], ';sesc=', $context['session_id'], ';board=', $context['this_board'], ';topic=', $context['current_topic'], '"><img class="gpbp_vote_img" id="gpbp_vote_up_', $message['id'], '" src="', $settings['default_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>';
}


Offline Interested bystander

  • Semi-Newbie
  • *
  • Posts: 27
Re: Good Post/Bad Post Mod
« Reply #412 on: November 05, 2011, 07:20:27 PM »
I installed this on one of my 2.0.1 forums and it worked fine.   I just installed it on a second forum of the same version today and only the admin can see the arrows and cast votes.   Where should I start looking for my problem?   

Offline Interested bystander

  • Semi-Newbie
  • *
  • Posts: 27
Re: Good Post/Bad Post Mod
« Reply #413 on: November 06, 2011, 01:52:05 AM »
Never mind, I figured it out.

Offline crazyASD

  • Semi-Newbie
  • *
  • Posts: 19
Re: Good Post/Bad Post Mod
« Reply #414 on: November 06, 2011, 06:58:29 AM »
After installation Google +1 button, user scores (under user`s avatar) doesn`t shown, it shown again only if user clicking on good/bad post control.
Please fix it!

Offline valpo04

  • Semi-Newbie
  • *
  • Posts: 18
Re: Good Post/Bad Post Mod
« Reply #415 on: November 06, 2011, 07:44:02 PM »
Trying to install this mod and I get an error with the modification of Load.php.  Every other modification is successful, except that one, it says "Test Failed."

Any ideas?

Offline Major Wood

  • Semi-Newbie
  • *
  • Posts: 45
Re: Good Post/Bad Post Mod
« Reply #416 on: November 07, 2011, 08:17:07 AM »
Every time that I click on install (to go to the page that tests the various operations, not the confirmation page) for this mod, I start getting 500 errors sitewide.
Any thoughts? Running 2.0.1

Bump! Anyone?

Offline Gambi

  • Semi-Newbie
  • *
  • Posts: 69
Re: Good Post/Bad Post Mod
« Reply #417 on: November 08, 2011, 12:49:51 PM »
Hi, is this mod supposed to refresh the page when you click the up or down arrow? It'll register it if you refresh manually but it'll be great if it could update instantly or refresh the page kind of like how karma works. I've tried but couldn't get it to work. Does anyone know how they'd alter the code below so it refreshes the page at that post or even just updated the arrows instantly. I'd appreciate the help.

Code: [Select]
// 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 normaltext">
<span id="gpbp_score_', $message['id'], '" class="help" title="', $txt['gpbp_post_score'], '">', $message['gpbp_score'], '</span>';

if ($context['can_vote_gpbp'] && $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'], ';sesc=', $context['session_id'], ';board=', $context['this_board'], ';topic=', $context['current_topic'], '"><img class="gpbp_vote_img" id="gpbp_vote_down_', $message['id'], '" src="', $settings['default_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'], ';sesc=', $context['session_id'], ';board=', $context['this_board'], ';topic=', $context['current_topic'], '"><img class="gpbp_vote_img" id="gpbp_vote_up_', $message['id'], '" src="', $settings['default_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>';
}



And while you're at it, this as well.

Offline krazytim

  • Semi-Newbie
  • *
  • Posts: 22
    • Tim Silva
Re: Good Post/Bad Post Mod
« Reply #418 on: December 04, 2011, 09:21:28 PM »
Any chance that this will be updated for SMF 2.0.1 any time soon??

Offline Guillelmus

  • Semi-Newbie
  • *
  • Posts: 92
    • Usko ja elämä -forum (in Finnish)
Re: Good Post/Bad Post Mod
« Reply #419 on: December 05, 2011, 03:14:25 AM »
Any chance that this will be updated for SMF 2.0.1 any time soon??
Works just fine on 2.0.1. Install emulating SMF 2.0.