Post Karma

Started by nend, September 22, 2012, 01:10:38 PM

Previous topic - Next topic

nend

Link to Mod

This mod adds two new links to the Karma system which you can see in each post. These links contain the number of smites and applauds a post has.

This mod has no configuration since it relies on SMF's karma system settings.

License
QuoteCopyright (c) 2012, Russell Najar (SiberInc)
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the SiberInc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Releases
0.1
- First build and initial upload

0.2
* Small change in installation. Doesn't affect modification once installed.

NanoSector

Nice mod, I'm going to use this on my own site :)

Going to make a small change to it though to only show/work on the first post of a topic. That'll make it ideal for my site :)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

tMicky


nend

Thanks,

Expected a little more comments with all the downloads. Later on when I have enough time I will post my "Trending" block which looks at the karma per post and displays which post are trending. You can add this in a PHP block in your portal. Will post later though because I have to go soon.

nend

Here is the trending post function.

function mini_trendingPosts($num_recent = 5)
{
global $context, $settings, $scripturl, $txt, $db_prefix, $user_info;
global $modSettings, $smcFunc;

//Check cache
if($context['user']['is_logged'] && ($data = cache_get_data('g'.$user_info['groupString'].'trendingPostscache', 1800)) != null) {
return $data;
} else if (!$context['user']['is_logged'] && ($data = cache_get_data('uguesttrendingPostscache', 1800)) != null) {
return  $data;
}

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
IFNULL(mem.real_name, m.poster_name) AS poster_name, mem.avatar, m.body AS body, m.smileys_enabled, m.icon, tb.subject, tb.body AS tbody,
IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member AND a.attachment_type!=3)
LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
LEFT JOIN {db_prefix}messages AS tb ON (tb.id_msg = t.id_first_msg)
WHERE m.poster_time > {int:time_back}
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY m.karma_good - m.karma_bad DESC
LIMIT {int:numrecent}' ,
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' : $include_boards,
'exclude_boards' => empty($exclude_boards) ? '' : $exclude_boards,
'min_message_id' => $modSettings['maxMsgID'] - 35 * min($num_recent, 5),
'is_approved' => 1,
'numrecent' => $num_recent,
'time_back' => time() - 2599277,
)
);

$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$shortSub = null;
$row['body'] = strip_tags(str_replace('<br />', ' ', parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg'])));
if ($smcFunc['strlen']($row['body']) > 170)
$row['body'] = $smcFunc['substr']($row['body'], 0, 170) . '...';
if ($smcFunc['strlen']($row['subject']) > 45)
$shortSub = $smcFunc['substr']($row['subject'], 0, 45) . '...';

// Censor the subject.
censorText($row['subject']);
censorText($row['body']);

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>',
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'readmore' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new">Read More</a>',
'avatar' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="&nbsp;"  />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt="&nbsp;" />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar']) . '" alt="&nbsp;" />'),
'subject' => $row['subject'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => protimeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '" rel="nofollow"' . (isset($shortSub) ? ' title="' . $row['subject'] .'">' . $shortSub : '>' . $row['subject']) . '</a>',
// Retained for compatibility - is technically incorrect!
'new' => !empty($row['is_read']),
'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '"  />',
);
}
$smcFunc['db_free_result']($request);

// Make cache
if($context['user']['is_logged']) {
cache_put_data('g'.$user_info['groupString'].'trendingPostscache', $posts, 1800);
} else {
cache_put_data('uguesttrendingPostscache', $posts, 1800);
}

return $posts;
}


You can use this function to return the trending post within the time frame of time_back.

Jade Elizabeth

OH MY GOD I LOVE YOU SO MUCH.

BUT how does it work? Will it work with Karma Description and Limit Karma?
http://mods.simplemachines.org/index.php?mod=192
http://custom.simplemachines.org/mods/index.php?mod=1308
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

tMicky

Quote from: nend on September 28, 2012, 12:42:23 PM
Here is the trending post function.

You can use this function to return the trending post within the time frame of time_back.

Thank you. I do have a question, are we supposed to change something in the time_back area, to make the posts show. I added the block, but no post is listed?

CreativeITWorld.com

Had a problem:

Quote1.   Execute Code   db.php   
   2.   Execute Modification   ./Sources/Karma.php   Test successful
   3.   Execute Modification   ./Sources/Display.php   Test failed
      1.   Add After   ./Sources/Display.php   Test successful
      2.   Add After   ./Sources/Display.php   Test failed

   4.   Execute Modification   ./Themes/default/Display.template.php   Test successful

This is a heavily modified forum, so if nobody else reports the same problem, you will know that the installation problem is due to conflicts.

Arantor

Well, the conflicts aren't there on a vanilla 2.0 install, which means it's due to conflicts...

nend

Quote from: CreativeITWorld.com on October 12, 2012, 07:33:03 PM
Had a problem:

Quote1.   Execute Code   db.php   
   2.   Execute Modification   ./Sources/Karma.php   Test successful
   3.   Execute Modification   ./Sources/Display.php   Test failed
      1.   Add After   ./Sources/Display.php   Test successful
      2.   Add After   ./Sources/Display.php   Test failed

   4.   Execute Modification   ./Themes/default/Display.template.php   Test successful

This is a heavily modified forum, so if nobody else reports the same problem, you will know that the installation problem is due to conflicts.
The install code was tested on a vanilla 2.0 board without any problems.

The two lines in Display.php is the portion added to the query and the portion to add the information to the array. The mod will not display karma per post without this.

I recommend to do a manual install or pay someone to manually install it for you.

I don't recommend to go further with the install via the package manager, I doubt it would cause any problems but it wouldn't add any benefits/features without that portion of the code working.

The choice is yours.

rlh2006

I started using this mod about a week ago. I like it but there are some minor issues that need a coding fix.

Issue I: Guest Browsers

Logged-in users see post karma (normally) as:



Guests sees the post karma in an odd way:




And there is an error constantly showing up in my log, which I think is related to guests browsing topics

Error: 8: Undefined index: karma
File: forum/Themes/default/Display.template.php (main sub template - eval?)
Line: 498
Line Text ==>498: if ($message['member']['karma']['allow'])


Issue II: Posts that Remain from Deleted User Accounts

When logged-in users browse a post left over from a deleted account the following error is generated:

Error: 8: Undefined index: karma
File: forum/Themes/default/Display.template.php (main sub template - eval?)
Line: 498
Line Text ==>498: if ($message['member']['karma']['allow'])


If any Simple Machines Hero could give a possible coding fix here I would surely appreciate it.

368 Urban Terror avatars for your site or forum.
The avatars pack is 11.6 mbs. Direct free download for the avatars pack is right here: urt_avatars.zip This avatar pack is 1up Clan's way of contributing to both the Urban Terror gaming community and the Simple Machines community. Due to the size of the pack, SMF has not approved it.

nend

Your theme may be using a custom Display.template.php which may be causing the errors and causing the text to miss align.

Basically saying, post your Display.template.php, something is wrong in it.  ;D

Jade Elizabeth

Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

NanoSector

Set up a test installation and see :P

Looking at the code it doesn't appear to do anything special with them.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

rlh2006

Quote from: nend on October 14, 2012, 01:14:05 PM
Your theme may be using a custom Display.template.php which may be causing the errors and causing the text to miss align.

Basically saying, post your Display.template.php, something is wrong in it.  ;D
Ok. I had a coder look this over and these changes were applied to my site.
Note: on my site guests can't post or give karma.

Open Themes/default/Display.template.php  its the default theme (because the theme I am using doesn't have its own and loads the file from the default theme).

find:



// Karma Per Post
if ($message['member']['karma']['allow'])
echo '
<li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</a></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</a></li>';


and below that part, add the following:


elseif ($context['user']['is_guest'])
echo '
<ul class="reset smalltext quickbuttons"><li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=login">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</a></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=login">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</a></li></ul>';



So the final product looks like this:



// Karma Per Post
if ($message['member']['karma']['allow'])
echo '
<li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</a></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</a></li>';

elseif ($context['user']['is_guest'])
echo '
<ul class="reset smalltext quickbuttons"><li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=login">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</a></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=login">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</a></li></ul>';

else
echo '
<li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><span style="padding-left:20px;display:block;height:20px;line-height:18px;float:left;">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</span></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><span style="padding-left:20px;display:block;height:20px;line-height:18px;float:left;">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</span></li>';
// Can we restore topics?
368 Urban Terror avatars for your site or forum.
The avatars pack is 11.6 mbs. Direct free download for the avatars pack is right here: urt_avatars.zip This avatar pack is 1up Clan's way of contributing to both the Urban Terror gaming community and the Simple Machines community. Due to the size of the pack, SMF has not approved it.

rlh2006

Also, if you do not allow guest posting and you have deleted accounts from prior members but left their posts then you will receive an error related to that, so this fix will resolve that:

// Karma Per Post
if (!$message['member']['is_guest'] && $message['member']['karma']['allow'])
echo '
<li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</a></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</a></li>';

elseif (!$message['member']['is_guest'] && $context['user']['is_guest'])
echo '
<ul class="reset smalltext quickbuttons"><li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=login">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</a></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=login">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</a></li></ul>';

elseif (!$message['member']['is_guest'])
echo '
<li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><span style="padding-left:20px;display:block;height:20px;line-height:18px;float:left;">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</span></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><span style="padding-left:20px;display:block;height:20px;line-height:18px;float:left;">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</span></li>';

// Can we restore topics?
368 Urban Terror avatars for your site or forum.
The avatars pack is 11.6 mbs. Direct free download for the avatars pack is right here: urt_avatars.zip This avatar pack is 1up Clan's way of contributing to both the Urban Terror gaming community and the Simple Machines community. Due to the size of the pack, SMF has not approved it.

impreza

Nice addition, for sure come in handy. thanks
Portal ToTemat.pl - treści w postaci artykułów i filmów tematycznych.

nend

Quote from: rlh2006 on October 15, 2012, 02:16:28 PM
Also, if you do not allow guest posting and you have deleted accounts from prior members but left their posts then you will receive an error related to that, so this fix will resolve that:

// Karma Per Post
if (!$message['member']['is_guest'] && $message['member']['karma']['allow'])
echo '
<li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</a></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</a></li>';

elseif (!$message['member']['is_guest'] && $context['user']['is_guest'])
echo '
<ul class="reset smalltext quickbuttons"><li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=login">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</a></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><a href="', $scripturl, '?action=login">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</a></li></ul>';

elseif (!$message['member']['is_guest'])
echo '
<li style="background: url(', $settings['images_url'], '/post/thumbup.gif) no-repeat 0 0;"><span style="padding-left:20px;display:block;height:20px;line-height:18px;float:left;">', $modSettings['karmaApplaudLabel'], $message['karma']['good'], '</span></li>
<li style="background: url(', $settings['images_url'], '/post/thumbdown.gif) no-repeat 0 0;"><span style="padding-left:20px;display:block;height:20px;line-height:18px;float:left;">', $modSettings['karmaSmiteLabel'], $message['karma']['bad'], '</span></li>';

// Can we restore topics?


Been a little busy to go over the code but yeah guest posting and deleted members may throw some errors. Will look into that to see what needs to be done to fix it if a fix is needed.  ;)

Lazarevics

#18
here the full corrected package (tested)
thx rlh2006!

nend

Thanks,

I completely forgot about that bug. I have been doing this one off from memory as I haven't set up any tracking for such mods. I might set up a repo, anybody is welcomed to add to this mod, hence the open source license.

However to avoid confusion if anyone does want to release a variant on the mod site of any of my mods please make sure it adds a completely new feature, otherwise don't because it may cause too much confusion.

That being said, please feel free to modify, distribute or whatever you like. Remember you can't sell the code due to the license. Anyways have fun with it.

phue

Hi nend,

I am using your mod and it works perfect! Just wanted to ask if you know a technique to get a list of posts sorted by upvotes.

Thanks for this great mod, and happy holidays!

TCRoss

#21
I installed post karma several days ago and after running into the error noted earlier in the thread with messy text and karma images instead of just images, uninstalled it.  It couldn't uninstall and disabled my forum.  I reinstalled it so I could keep the forum up.  NOW it's duplicated itself.  I've gone in and deleted the duplicate code to try to only get one to show until it could be fixed, but I'm assuming the problem is the extra db column - which I can't find to delete. 

I tried the code fix mentioned, but it didn't fix mine.

How do I uninstall it?!  Where are the columns I need to delete?

*Edit*  Manually fixed the text issue, but still have the duplicate icons.


nend

In the version .3 repo currently I have rlh2006 fixed code for deleted members. I also plan to add hooks in it for the template before releasing it to prevent user error or any visual problems.

@TCRoss

That isn't a error but more than likely a incompatibility with your theme. I am going to see about using hooks in the template so we can hopefully avoid any of those incompatibilities.

Your going to have to go to the listing on the mod site and select the manual install for 2.0.2 to remove any duplicate code.

As for the tables in the database being a problem it shouldn't be.

nend

Added to Github, any contributions welcomed. Fork and play around.  ;D

wildcat180

This is a great mod and works wonderfully!  Is there anyway to make it to where you can see who is changing the karma? 

adisz

Quote from: tMicky on September 30, 2012, 05:17:21 AM
Quote from: nend on September 28, 2012, 12:42:23 PM
Here is the trending post function.

You can use this function to return the trending post within the time frame of time_back.

Thank you. I do have a question, are we supposed to change something in the time_back area, to make the posts show. I added the block, but no post is listed?
Hello,
it looks like the same problem.
I've pasted this code to php block, but I don't understand what is time_back area. What must I do to see list of posts?

chereneb

Hi,

I have installed this mod to my site. Without a problem. I am using SMF 2.0.4 with the Gray style theme. The thumbs up and thumbs down appears above each post, but it is not clickable. Any ideas why this might be?

chereneb

Still no response?

tMicky

I keep getting an error:

"Field 'karma_bad' doesn't have a default value"

nend

Compatible and tested with SMF 2.0.2 using default theme.

Haven't had much time lately to update it for compatibility with any newer versions. However the modification is open source so anyone is free to contribute or fork as they please.

Shrink

i have 1 suggestion for next upgrade. add a filter like accending or desending within a topic!!!

FrankiGoode

Hi,

We had the mod installed but recently uninstalled it while trying a few things out. Trouble is the thumps up [applaud] and thumbs down [smite] remain at the top of each post. See attached file.

Can you please let me know how these can be deleted as it is now affecting the re-installation of this and other mods.

many thanks

f00ty

Any example on how to use trending function? Where to place it eg.?

Yoss

#33
Quote from: nend on May 19, 2013, 01:13:23 AM
Compatible and tested with SMF 2.0.2 using default theme.

Haven't had much time lately to update it for compatibility with any newer versions. However the modification is open source so anyone is free to contribute or fork as they please.
hi, I'm testing the mod with smf 2.07 and it works properly and smoothly.

Quote from: phue on December 16, 2012, 08:35:21 AM
Hi nend,

I am using your mod and it works perfect! Just wanted to ask if you know a technique to get a list of posts sorted by upvotes.

Thanks for this great mod, and happy holidays!
+1, it would be nice  :)  im thinking about the code for a block "best posts of the week" Can anyone try it?
Edited: The code is at 4th post, sry :-[ I paste the code in a simple portal php block but nothing is showed  :'(

...and I have another request for future versions of this interesting mod:

is possible to limit the change of karma for each user once for each post? I think it's interesting that you can not repeat the action so that the numbers on the post are more representative of the number of people who liked

Thanks for the work nend



jack_1985

Hi all,

I have stumbled upon the following bug in this mod:

It's possible to smite a post (by using the thumb icon) and then applaud another post of that same member, within the karma waiting time. If you do this, the first karma action gets undone, but the counter next to the thumb doesn't change back. So you can keep pressing the thumb icon to smite post A, then applaud in post B, then smite post A, applaud post B, etc. And the counter just keeps adding up.

In other words, I guess a user should only be able to use the thumbs up/down once per post.

This bug defies the purpose of the mod a bit. Anybody any idea on how to fix this?

Using SMF 2.0.8 btw.

Gwenwyfar

Any news on the problem above? Or anyone know of another mod that does the same thing as this one? I basically just want something to add positive/negative points to individual posts and to show the total negative/positive in a user's profile, if possible to also see which posts received what or a notification to the user who got it. I've been looking on some other mods but this one still seems the best, but this bug... =/

I guess it could take a while to someone to find this bug but it could be easily abused once that happens.
"It is impossible to communicate with one that does not wish to communicate"

Squash

Is there a way to not have the text at all, just the thumbs up and down? How do I remove it, what file? I'll try doing it on my own if I just knew the file to look for.

Gwenwyfar

I haven't installed the mod yet so this is a guess, but you could try looking on your display.template.php file.
"It is impossible to communicate with one that does not wish to communicate"

Neek

Quote from: jack_1985 on August 28, 2014, 03:14:42 PM
Hi all,

I have stumbled upon the following bug in this mod:

It's possible to smite a post (by using the thumb icon) and then applaud another post of that same member, within the karma waiting time. If you do this, the first karma action gets undone, but the counter next to the thumb doesn't change back. So you can keep pressing the thumb icon to smite post A, then applaud in post B, then smite post A, applaud post B, etc. And the counter just keeps adding up.

In other words, I guess a user should only be able to use the thumbs up/down once per post.

This bug defies the purpose of the mod a bit. Anybody any idea on how to fix this?

Using SMF 2.0.8 btw.

Indeed, this bug ruins the mod. :(

Quote from: Gwenwyfar on November 14, 2014, 06:04:01 PM
Any news on the problem above? Or anyone know of another mod that does the same thing as this one? I basically just want something to add positive/negative points to individual posts and to show the total negative/positive in a user's profile, if possible to also see which posts received what or a notification to the user who got it. I've been looking on some other mods but this one still seems the best, but this bug... =/

I guess it could take a while to someone to find this bug but it could be easily abused once that happens.

Exactly what I want too. I'll try to figure out a solution but don't hold your breath. Anyone willing and able to offer some guidance, please?

Gwenwyfar

What I have done after this is install like posts, duplicate it, and call the new one dislikes, so that there are the two.

But it doesn't have notifications or anything else, so you have to modify that yourself, and the above has to be done manually after the first install.

There's also good post bad post, I don't recall what was wrong with that one though, only that it can't be automatically uninstalled and I still have bits of its corpse to throw out.
"It is impossible to communicate with one that does not wish to communicate"

confuseamuse

Hilariously, every part of this mod failed the installation. I'm using 2.0.14 on a not-so-heavily modded forum.

addlife

Quote from: rlh2006 on October 13, 2012, 04:42:25 PM
I started using this mod about a week ago. I like it but there are some minor issues that need a coding fix.

Issue I: Guest Browsers

Logged-in users see post karma (normally) as:



Guests sees the post karma in an odd way:




And there is an error constantly showing up in my log, which I think is related to guests browsing topics

Error: 8: Undefined index: karma
File: forum/Themes/default/Display.template.php (main sub template - eval?)
Line: 498
Line Text ==>498: if ($message['member']['karma']['allow'])


Issue II: Posts that Remain from Deleted User Accounts

When logged-in users browse a post left over from a deleted account the following error is generated:

Error: 8: Undefined index: karma
File: forum/Themes/default/Display.template.php (main sub template - eval?)
Line: 498
Line Text ==>498: if ($message['member']['karma']['allow'])


If any Simple Machines Hero could give a possible coding fix here I would surely appreciate it.

I seem to have a similar problem with how the post karma looks for guests. I'm also using the karma button mod so theres a thumbs up and a button that aren't displaying properly. Here's screenshots of guests view and logged in view

My question is would the fix that this user posted below also work for my theme or is it a custom fix for his site?

Also I have like 30,000 errors in my log (which I just checked for the first time due to OP's post) that says

"8192: Function create_function() is deprecated

File: /home/........../public_html/Sources/Subs.php "

Does this have anything to do with that?



addlife

Quote from: addlife on February 21, 2019, 03:58:53 AM
I seem to have a similar problem with how the post karma looks for guests. I'm also using the karma button mod so theres a thumbs up and a button that aren't displaying properly. Here's screenshots of guests view and logged in view

My question is would the fix that this user posted below also work for my theme or is it a custom fix for his site?

So just an update in case this will help anyone.

I used this updated package from this post and it's working for my site perfectly
Quote from: Lazarevics on November 11, 2012, 03:23:25 PM
here the full corrected package (tested)
thx rlh2006!

There was one issue though. My site has a responsive theme and the buttons covered the post timestamp when in mobile view. All I had to do to fix that was locate the buttons responsive css and change the position property from absolute to relative. That moved the buttons to the right corner of the post area and made it look good.

Heres a screenshot of mobile and desktop version of a guests view

Advertisement: