News:

Welcome to the Unofficial Help Forum



Author Topic: SMF Likes Plus  (Read 124427 times)

Offline Illori

  • Administrator
  • *
  • Posts: 322
    • View Profile
Re: SMF Likes Plus
« Reply #30 on: April 01, 2013, 01:31:14 PM »
there is no reason the css should be broken in IE the image next to like/unlike is normal css so it should show in any browser without issue.

i dont have IE 10 but in IE9 the image next to the like/unlike shows up just fine.

Offline frostybore

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SMF Likes Plus
« Reply #31 on: April 01, 2013, 01:42:34 PM »
You're right -- I think it was a cache issue. It looks just fine on IE10 now.

Offline Illori

  • Administrator
  • *
  • Posts: 322
    • View Profile
Re: SMF Likes Plus
« Reply #32 on: April 01, 2013, 01:51:30 PM »
good to hear

Offline BGH

  • Jr. Member
  • *
  • Posts: 15
    • View Profile
Re: SMF Likes Plus
« Reply #33 on: April 01, 2013, 08:16:20 PM »
Time to keep-bothering-asking-questions LOL. (Just a wee bit of humor in this 'special day' :P)

How can I edit the DIV popup? I mean, one of the things I want is to point the like.png image to the default theme's images url. Maybe is kind of a silly edition, but I want to redesign the popup look a bit if possible (mind you, I'm not talking about modifying the table with the likes, I want to edit the div element in its structure, not only the CSS).

Thanks in advance!

Regards.

Offline Illori

  • Administrator
  • *
  • Posts: 322
    • View Profile
Re: SMF Likes Plus
« Reply #34 on: April 02, 2013, 05:48:57 AM »
the like.png is pulled from the default themes images folder... i dont know what you mean there.

if you want to edit the popup look in script.js and the index.css file.

what exactly do you want to change in the popup?

Offline Illori

  • Administrator
  • *
  • Posts: 322
    • View Profile
Re: SMF Likes Plus
« Reply #35 on: April 03, 2013, 07:31:05 AM »
ah i see the issue, try this fix

in script.js find
Code: [Select]
var sIcon = smf_images_url + '/' + typeof(sIcon) == 'string' ? sIcon : smf_images_url + '/' +  'likes/like.png';
and replace it with

Code: [Select]
var sIcon = smf_default_theme_url + '/' + typeof(sIcon) == 'string' ? sIcon : smf_default_theme_url + '/' +  'images/likes/like.png';

Offline BGH

  • Jr. Member
  • *
  • Posts: 15
    • View Profile
Re: SMF Likes Plus
« Reply #36 on: April 04, 2013, 05:46:00 AM »
Thanks, that did the trick, Illori! ;D

Regards.

Offline Illori

  • Administrator
  • *
  • Posts: 322
    • View Profile
Re: SMF Likes Plus
« Reply #37 on: April 04, 2013, 05:48:30 AM »
first post updated with the change.

Offline BGH

  • Jr. Member
  • *
  • Posts: 15
    • View Profile
Re: SMF Likes Plus
« Reply #38 on: April 05, 2013, 10:15:30 AM »
Finally, I managed to come up with something nifty for those who don't want to allow guests to see people's likes. As it isn't something included by default, I'll share it here.

Here we go:

On Modifications.english.php:

Add before ?>:

Code: [Select]
$txt['likes_more2'] = '<a href="%1$s" onclick="return reqOverlayDivLike(this.href, \'An Error Has Occurred!\')">more people</a> like this.';


On Display.template.php:

Find:

Code: [Select]
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));
Replace with:

Code: [Select]
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));


On index.css:

Add at the end:

Code: [Select]
.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}


On script.js:

Find:

Code: [Select]
error: function (xhr, textStatus, errorThrown) {
oPopup_body.html(textStatus);

Replace with:

Code: [Select]
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);


So, when guests click the 'more people' link in the post, they'll see this:



I think that the bits of code added to script.js, can be worked out to fit your needs, so that's a very basic statement, but you can edit it to whatever you want (keep in mind if you need to use an ' add an \ before, so it should be = \', otherwise it'll return an error ).

That's it!  ;D
« Last Edit: April 05, 2013, 11:44:32 AM by BGH »

Offline Johann

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SMF Likes Plus
« Reply #39 on: April 06, 2013, 07:10:36 AM »
Dear SMF - Unofficial Help Forum Team,

coming into know your work here, some kind of desire in regard of your great work here came up and so I finally registered here.

Please allow me some (maybe silly seeming) question:

* Do you like to share this modification so that I can offer it further, on a place I am looking for at this time?
* would it be possible to use an alternative text for "Like", for example "esteem"
* is it possible to show different texts for different languages?
* and to change the picture (thumb)? cleared

and a little different question

* why you do not use this mod here on in your forum?

for a person who is not very familiar with all programming and website stuff.

Thanks for your time!

« Last Edit: April 06, 2013, 07:15:47 AM by Johann »

Offline Illori

  • Administrator
  • *
  • Posts: 322
    • View Profile
Re: SMF Likes Plus
« Reply #40 on: April 07, 2013, 08:04:48 AM »
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.

Offline BGH

  • Jr. Member
  • *
  • Posts: 15
    • View Profile
Re: SMF Likes Plus
« Reply #41 on: April 07, 2013, 10:35:17 PM »
Some things you may want to be aware of. Not trying to bother you, but I think it will help you to be aware of this. Mostly, they have to do with the popup.

Height & Width of popup

Right now you've set a class named popup_content which has a min-height set to 20em. It'd be good to also add a max-height with, for example, 35em. This would be right, because if a lot of people likes a post, like saying, 10 people, for example, the popup will enlarge a lot and sink to the bottom of the page, because it will indefinetely increase its height. If you set a certain max-height unit, then you have to set an overflow: auto;, so if the max height limit is surpassed it will add a scrollbar.

Summarizing, the changes needed should be:

Find:

Code: [Select]
.popup_content
{
min-height: 20em;
}

Replace with:

Code: [Select]
.popup_content
{
min-height: 20em;
max-height: 35em;
overflow: auto;
}

Avatar images present in popup

Well you might be aware of this, and kept in mind while you were making this mod. The default config of having set avatars to a width and height of 65px, is OK and it wouldn't be an issue for those who have set this. Problem comes when the images are set to a higher value, like for example, 150px x 150px. This size will mantain when the popup opens, and the result isn't lovely at all. One solution I came across with was to modify this (on Likes.php):

Code: [Select]
' . $memberContext[$liker]['avatar']['image'] . '
... to this:

Code: [Select]
<img src="' . $memberContext[$liker]['avatar']['href'] . '" height="65" width="65" alt="*" class="popup_avatar" />
Which now respects the height/width of 65px, which is OK, IMO (don't mind the popup_avatar class, is just there to give the image some styling).

This solution works pretty well for those who, actually, have an avatar. But for those who doesn't it will load an non-existent image, and it will look like a broken image link.

I was thinking on adding something like this (I grabbed this code from my theme's index.template.php)

Code: [Select]
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" />';
}

... and adding an no_avatar.png image, to my theme images folder, which would be OK, but I'm not able find a proper way to do this.

Hoping this is useful for you, and remember that I'm just only posting this to let you know about this stuff.

Best regards.
« Last Edit: April 07, 2013, 10:42:02 PM by BGH »

Offline Johann

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SMF Likes Plus
« Reply #42 on: April 08, 2013, 10:38:03 AM »
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.

Thanks for your time and effort.

_()_

Offline Illori

  • Administrator
  • *
  • Posts: 322
    • View Profile
Re: SMF Likes Plus
« Reply #43 on: April 09, 2013, 12:14:19 PM »
new version of the mod released in the op, allows you to style the popup using css instead of the tables it had before. added the max height to the popup and allows overflow[scrollbar].

Offline BGH

  • Jr. Member
  • *
  • Posts: 15
    • View Profile
Re: SMF Likes Plus
« Reply #44 on: April 10, 2013, 02:48:03 PM »
Thank you Illori, great work!  :D

Great stuff!

Regards.