because I said that there are valid issues with the way this modification loads its resources.
Somewhat astounding to me that you'd ignore someone helping and then remove their post so no one else see's the truth.
The efficiency with this modification isn't something to be ignored, it could cause some big problems on larger boards in regards to performance.
If more then 5 people have liked a post it will not show the names to save space.
2 Likes BGH (http://url_to_BGH_profile), testuser (http://url_to_testuser_profile) like this
Though, if I'm not mistaken, that'll make the query a bit heavier.
There is an updated version in testing which includes that, a couple of other minor presentation things (namely '1 Likes' getting fixed) and just for fun there's also a popup. Presentation on that is not entirely the best but there's something of a limit to what can be done in SMF's help popup.
global $context, $txt, $smcFunc, $memberContext, $modSettings;
global $context, $txt, $smcFunc, $memberContext, $modSettings, $scripturl;
$context['page_title'] = count($likers) == 1 ? $txt['likes_popup_1'] : sprintf($txt['likes_popup_n'], comma_format(count($likers)));
$context['help_text'] = $txt['likes_popup_liked'];
$context['help_text'] .= '<table style="width: 100%">';
foreach ($likers as $liker)
{
loadMemberContext($liker);
$context['help_text'] .= '<tr><td>' . $memberContext[$liker]['name'] . '</td><td class="ava">' . $memberContext[$liker]['avatar']['image'] . '</td></tr>';
}
$context['help_text'] .= '</table>';
$context['page_title'] = count($likers) == 1 ? $txt['likes_popup_1'] : sprintf($txt['likes_popup_n'], comma_format(count($likers)));
$context['help_text'] = '<div style="text-align:center;margin:10px 0">' . $txt['likes_popup_liked'] . '</div>';
$context['help_text'] .= '<table style="width:100%;border-top:1px solid #ccc;border-bottom:1px solid #ccc;padding:10px 0" cellpadding="7">';
foreach ($likers as $liker)
{
loadMemberContext($liker);
$context['help_text'] .= '<tr><td class="ava" style="text-align:center">' . $memberContext[$liker]['avatar']['image'] . '</td><td><a href="' . $scripturl . '?action=profile;u=' . $liker . '" target="_blank" title="' . $txt['profile_of'] . ' ' . $memberContext[$liker]['name'] . '">' . $memberContext[$liker]['name'] . '</a></td></tr>';
}
$context['help_text'] .= '</table>';
$context['help_text'] .= '<div style="text-align:center;margin:10px 0">' . $txt['likes_popup_liked'] . '</div>';
$context['help_text'] = '<div style="text-align:center;margin:10px 0">' . $txt['likes_popup_liked'] . '</div>';
i believe that is a feature of smf, not too much that can be done about it unless you dont allow guests to view the likes in each post.
echo implode(', ', $names), ' ', $txt['likes_and'], ' ', comma_format($array_length - 5), ' ', sprintf($txt['likes_more'], $scripturl . '?action=like;display;topic=' . $context['current_topic'] . ';msg=' . $message['id'], sprintf($txt[$array_length == 1 ? 'likes_popup_1' : 'likes_popup_n'], $array_length));
echo implode(', ', $names), ' ', $txt['likes_and'], ' ', comma_format($array_length - 5), ' ', $context['user']['is_guest'] ? sprintf($txt['likes_more2'], $scripturl . '?action=login') : sprintf($txt['likes_more'], $scripturl . '?action=like;display;topic=' . $context['current_topic'] . ';msg=' . $message['id'], sprintf($txt[$array_length == 1 ? 'likes_popup_1' : 'likes_popup_n'], $array_length));
$txt['likes_more2'] = '<a href="%1$s">more people</a> like this.';
echo implode(', ', $names), ' ', $txt['likes_and'], ' ', comma_format($array_length - 5), ' ', $context['user']['is_guest'] ? $txt['likes_more2'] : sprintf($txt['likes_more'], $scripturl . '?action=like;display;topic=' . $context['current_topic'] . ';msg=' . $message['id'], sprintf($txt[$array_length == 1 ? 'likes_popup_1' : 'likes_popup_n'], $array_length));
$txt['likes_more2'] = 'more people like this.';
var sIcon = smf_images_url + '/' + typeof(sIcon) == 'string' ? sIcon : smf_images_url + '/' + 'likes/like.png';
var sIcon = smf_default_theme_url + '/' + typeof(sIcon) == 'string' ? sIcon : smf_default_theme_url + '/' + 'images/likes/like.png';
$txt['likes_more2'] = '<a href="%1$s" onclick="return reqOverlayDivLike(this.href, \'An Error Has Occurred!\')">more people</a> like this.';
echo implode(', ', $names), ' ', $txt['likes_and'], ' ', comma_format($array_length - 5), ' ', sprintf($txt['likes_more'], $scripturl . '?action=like;display;topic=' . $context['current_topic'] . ';msg=' . $message['id'], sprintf($txt[$array_length == 1 ? 'likes_popup_1' : 'likes_popup_n'], $array_length));
echo implode(', ', $names), ' ', $txt['likes_and'], ' ', comma_format($array_length - 5), ' ', $context['user']['is_guest'] ? $txt['likes_more2'] : sprintf($txt['likes_more'], $scripturl . '?action=like;display;topic=' . $context['current_topic'] . ';msg=' . $message['id'], sprintf($txt[$array_length == 1 ? 'likes_popup_1' : 'likes_popup_n'], $array_length));
.popup_content_guests{text-align:center;margin:4em 2em;padding:0.5em;border:4px dotted #666;font:normal 16px/2em verdana,sans-serif;border-radius:16px}
error: function (xhr, textStatus, errorThrown) {
oPopup_body.html(textStatus);
error: function (xhr, textStatus, errorThrown) {
var like_content_guests = '<div class="popup_content_guests"><a href="index.php?action=login"><strong>Login</strong></a> or <a href="index.php?action=register"><strong>register</strong></a><br />to see people\'s likes</div>';
oPopup_body.html(like_content_guests);
.popup_content
{
min-height: 20em;
}
.popup_content
{
min-height: 20em;
max-height: 35em;
overflow: auto;
}
' . $memberContext[$liker]['avatar']['image'] . '
<img src="' . $memberContext[$liker]['avatar']['href'] . '" height="65" width="65" alt="*" class="popup_avatar" />
if (!empty($context['user']['avatar'])) {
echo '
<img height="50" width="50" class="avatar" alt="" src="', $context['user']['avatar']['href'], '" />';
}
else {
echo '
<img height="50" width="50" class="avatar" alt="" src="', $settings['images_url'], '/no_avatar.png" />';
}
read the license http://creativecommons.org/licenses/by-nc-nd/3.0/ that should answer your first question
it is possible to edit the like string to whatever you want.
you can translate this mod just like any other
i dont see a use for this mod on this forum.
8: Undefined index: 0
File: /var/www/vhosts/WEBSITE/httpdocs/forum/Themes/default/Display.template.php (main sub template - eval?)
Line: 657
// First, names
$names = array();
foreach ($context['post_likes'][$message['id']] as $liker)
{
$names[] = '<a href="' . $scripturl . '?action=profile;u=' . $liker . '">' . $user_profile[$liker]['real_name'] . '</a>';
if (count($names) >= 5)
break;
}
8: Undefined index: 0
File: /var/www/vhosts/WEBSITE/httpdocs/forum/Themes/default/Display.template.php
Line: 657
);
$context['post_likes'] = array();
while ($row = $smcFunc['db_fetch_assoc']($likes))
$context['post_likes'][$row['id_message']][] = $row['id_member'];
$smcFunc['db_free_result']($likes);
$context['html_headers'] .= '
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>';
what modification do you have installed? smf should fail to work if you do not have the id_message column in the database.
<file name="$sourcedir/ManagePermissions.php">
<operation>
<search position="before"><![CDATA['send_topic' => array(false, 'topic', 'moderate'),]]></search>
<add><![CDATA[
'can_like' => array(false, 'topic', 'moderate'),]]></add>
</operation>
do you use the core theme or a custom theme with its own display.template.php?Weird why my members cant see the like button but only me can see?
if so then you need to do manual edits to make the mod show up.
do you use a permission profile on those board(s)?By default, suppose to be yes right?
// Maybe we can approve it, maybe we should?
if ($message['can_approve'])
echo '
<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $approve_button, '</a></li>';
if ($message['can_like'])
echo '
<li class="like_button" id="like_button_', $message['id'], '"><a href="', $scripturl, '?action=like;topic=', $context['current_topic'], ';msg=', $message['id'], '">', '<strong>', $txt['likes_like'], '</strong>', '</a></li>';
if ($message['can_unlike'])
echo '
<li class="unlike_button" id="unlike_button_', $message['id'], '"><a href="', $scripturl, '?action=like;topic=', $context['current_topic'], ';msg=', $message['id'], '">', '<strong>', $txt['likes_unlike'], '</strong> ', '</a></li>';
}ul.quickbuttons li.like_button
{
background: url(../../default/images/likes/like.png) no-repeat;
}
ul.quickbuttons li.like_button
{
background: url(../../default/images/likes/like.png) no-repeat;
}
ul.quickbuttons li.unlike_button
{
background: url(../../default/images/likes/unlike.png) no-repeat;
}
.like
{
margin: 0.2em 0.2em 0.2em 0.2em;
padding: 0.2em 0.2em 0.2em 1em;
}
/* Some of the following css is BSD licensed from smf 2.1 */
/* Styles for popup windows
------------------------------------------------------- */
.popup_container
{
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
}
.popup_window
{
position: fixed;
width: 480px;
z-index: 99;
padding: 0;
box-shadow: 0 0 8px rgba(0,0,0,0.2);
border-radius: 10px;
max-height: none!important;
overflow: visible!important;
}
.popup_heading
{
height: 15px;
padding: 10px;
border-top-right-radius: 8px;
border-top-left-radius: 8px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}
.popup_content
{
padding: 5px;
margin: 0;
min-height: 20em;
max-height: 35em;
overflow: auto;
}
.popup_heading .hide_popup
{
display: inline-block;
width: 16px;
height: 16px;
background: url(../../default/images/likes/delete.png) center center no-repeat;
float: right;
}
.popup_heading .icon
{
vertical-align: middle;
margin: -4px 4px 0 0;
}
// End of BSD css
.likes{
display:table;
}
.trlikes {
display:table-row;
}
.tdlikes {
display:table-cell;
height: 32.5px;
line-height:64px
}
.tdlikes .avatar{
padding-top:10px;
max-height: 65px;
max-width: 65px;
vertical-align: middle;
}
.nameslikes{
line-height: 65px;
padding-left:50px;
}
if ($message['can_like'])
echo '
<li><img src="' . $settings['default_images_url'] . '/likes/like.png" alt="', $txt['likes'], '" /><a href="', $scripturl, '?action=like;topic=', $context['current_topic'], ';msg=', $message['id'], '">', '<strong>', $txt['likes_like'], '</strong>', '</a></li>';
if ($message['can_unlike'])
echo '
<li><img src="' . $settings['default_images_url'] . '/likes/unlike.png" alt="', $txt['unlike'], '" /><a href="', $scripturl, '?action=like;topic=', $context['current_topic'], ';msg=', $message['id'], '">', '<strong>', $txt['likes_unlike'], '</strong> ', '</a></li>';
1. A link to the site would be useful.
2. The icons do not show, but what about the text?
some details or you will get no help.
<file name="$languagedir/Modifications.english.php">
<operation>
<search position="end" />
<add><![CDATA[
$txt['likes'] = 'Likes';
$txt['likes_1'] = '1 Like';
$txt['likes_n'] = '%1$s Likes';
$txt['likes_like'] = 'Like';
$txt['likes_error'] = 'Data wasn\'t enough to process the request';
$txt['likes_no_yourself'] = 'You can\'t like your own posts';
$txt['likes_unlike'] = 'Unlike';
$txt['likes_more'] = '<a href="%1$s" onclick="return reqOverlayDivLike(this.href, \'%2$s\');">more people</a> like this.';
$txt['likes_and'] = 'and';
$txt['likes_one'] = 'likes this.';
$txt['likes_few'] = 'like this.';
$txt['likes_nobody'] = 'Nobody likes this post.';
$txt['likes_popup_1'] = 'The following 1 person likes this post';
$txt['likes_popup_n'] = 'The following %1$s people like this post';]]></add>
</operation>
</file>
<file name="$languagedir/ManagePermissions.english.php">
<operation>
<search position="end" />
<add><![CDATA[$txt['permissionname_can_like'] = 'Like Posts';
$txt['permissionhelp_can_like'] = 'This permission allows a user to like posts';]]></add>
</operation>
</file>
here you go
i am not going to do all the edits for you, you need to learn how to modify the files when a mod fails to install.
the one released is the latest version.
<img src="' . $settings['default_images_url'] . '/likes/like.png" alt="', $txt['likes'], '" />
and remove it from display.template.php are you using the default theme? if not did you install it on your custom theme?Sorry for late response and now everything is fine with that forum.
<hr class="post_separator" />';
add after: // Now we do likes.
global $user_profile;
if (!empty($context['post_likes'][$message['id']]))
{
echo '
<div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
<span class="topslice"><span></span></span>
<div class="like"><strong><img src="' . $settings['default_images_url'] . '/likes/like.png" alt="', $txt['likes'], '" />', ' ', $message['likes'] == 1 ? $txt['likes_1'] : sprintf($txt['likes_n'], comma_format($message['likes'])), '</strong> ';
$array_length = count($context['post_likes'][$message['id']]);
// First, names
$names = array();
foreach ($context['post_likes'][$message['id']] as $liker)
{
$names[] = '<a href="' . $scripturl . '?action=profile;u=' . $liker . '">' . $user_profile[$liker]['real_name'] . '</a>';
if (count($names) >= 5)
break;
}
// Now we do something with it.
if ($array_length <= 5)
{
$last_name = array_pop($names);
echo !empty($names) ? (implode(', ', $names) . ' ' . $txt['likes_and'] . ' ') : '', $last_name, ' ', ($array_length == 1 ? $txt['likes_one'] : $txt['likes_few']);
}
else
{
echo implode(', ', $names), ' ', $txt['likes_and'], ' ', comma_format($array_length - 5), ' ', sprintf($txt['likes_more'], $scripturl . '?action=like;display;topic=' . $context['current_topic'] . ';msg=' . $message['id'], sprintf($txt[$array_length == 1 ? 'likes_popup_1' : 'likes_popup_n'], $array_length));
}
echo '
</div><span class="botslice"><span></span></span></div>';
}
what theme are you using? it seems it would be highly modified which is keeping you from finding the code. you need to find where it should go in your file based on the default theme and add it.
is that a paid theme?A free theme
this mod does not modify that file. did you use another likes mod in the past? if so make sure it is completely uninstalled.
is_not_guest($txt['cannot_' . $error_permission]);
$txt['cannot_can_like'] = 'Sorry - you cannot view this';
can go at the end of the file.looks like a guest may be trying to view likes that they dont have permission to do so... this is generating an errorCode: [Select]is_not_guest($txt['cannot_' . $error_permission]);
a language string for this would need to be added to errors.english.phpCode: [Select]$txt['cannot_can_like'] = 'Sorry - you cannot view this';
can go at the end of the file.
looks like a guest may be trying to view likes that they dont have permission to do so... this is generating an errorCode: [Select]is_not_guest($txt['cannot_' . $error_permission]);
a language string for this would need to be added to errors.english.phpCode: [Select]$txt['cannot_can_like'] = 'Sorry - you cannot view this';
can go at the end of the file.