Like Posts

Started by vbgamer45, June 29, 2013, 09:29:03 AM

Previous topic - Next topic

JoeWaters

I've passed that link on to the server admins. Hopefully, they (Lunarpages) will be able to apply that fix. Thank you!

Black Tiger

#941
We're having the same issue CDLehner had, and we did not make any changes to the modfiles.
Yes we made changes to index.template.php but that shouldn't be any issue since other mods do that too.

Uninstalling 2.02 gave errors. Reinstalling 2.02 did not help. Placing index.template.php back did not help either.

The thing is we moved from a server without https and mod_ruid2 and php 5.3.36 to a server with https and mod_ruid2 and php 5.6.35. After that the Like button did not work anymore.
You could click on it, but it would not respond anymore.

So we tried uninstalling 2.02 which gave errors and a blank screen. We had to put all files back and it worked again, however it displayed "uninstalled. So we installed it again, uninstalled it (which went fine that time) and again a blank screen.
So again all files back. Getting tired of this crap, installed 2.0.5. Which is working.

But not as should be. There are 2 like buttons now. If I use the right side like button, a like will be added, but I can like as often as I want (and my name get's mentioned +1 every time in the list of people who liked).

The left side like button turns to a unlike button (when liking with the right side button) with which I can remove all my likes again.

Does not look like it works as should be.

I would like to remove the complete thing to get a clean version again but don't know how.
But if the above could be fixed I would be happy to.

Maybe it's in here. This is from the /Themes/default/index.template.php which contains multiple lines, should this be like this? Or is one of these lines from the old mod version an can be removed?

                if(LikePosts::$LikePostsUtils->showLikeNotification()) {
                        echo '
                                        <li><span class="showLikeNotification" onclick="lpObj.likePostsNotification.showLikeNotifica
tion()">', $txt['like_show_notifications'], '</span></li>';
                }

                if(LikePosts::$LikePostsUtils->showLikeNotification()) {
                        echo '
                                        <li><a href="#" class="showLikeNotification" onclick="lpObj.likePostsNotification.showLikeNo
tification()">', $txt['like_show_notifications'], '</a></li>';
Greetings, Black Tiger

Black Tiger

This one was not a duplicate, but in other base php files (source and default templates and custom templates) there were duplicate entry's.
Removed all duplicate entry's from those files. When removing the correct ones, the uninstaller turned the files in black with test succesfull. This way I removed all duplicates and seems to work fine now again.

So fixed it. :)
Greetings, Black Tiger

sera

When installed on 2.0.15, users can no longer access anything, instead receiving the error:

Unable to load the 'main_above' template.

This occurs regardless of what theme they are using.  Now, for the details.

We have three custom themes available: DarkDream, Dash, and Everest.  Install failed on each of their index.template.php files.  i manually edited DarkDream for the installation failure.  Test user immediately received the above error on next refresh, regardless of theme used.

Admin can manually change a user's theme to either Dash or Everest and users can navigate the site again.  Putting the user on DarkDream, however, causes the error again.  A user force changed to a theme can then change to another theme. 

Manual edit is as follows:

Ctrl+F
<li><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a></li>';

AddAfter
if(LikePosts::$LikePostsUtils->showLikeNotification()) {
            echo '
                    <li><span class="showLikeNotification" onclick="lpObj.likePostsNotification.showLikeNotification()">', $txt['like_show_notifications'], '</span></li>';
        }


i'm guessing it's where the If(LikePosts) function is set; messing with the If/Else coding?  This now appears within the file as:

// User login
if (!empty($context['user']['is_logged']))
echo '
<li><a href="', $scripturl, '?action=profile;area=forumprofile">', $txt['forumprofile'], '</a></li>
<li><a href="', $scripturl, '?action=profile;area=account">', $txt['account'], '</a></li>
<li><a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
<li><a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>

if(LikePosts::$LikePostsUtils->showLikeNotification()) {
echo '
<li><span class="showLikeNotification" onclick="lpObj.likePostsNotification.showLikeNotification()">', $txt['like_show_notifications'], '</span></li>';
}

<li class="divider"></li>
<li><a href="', $scripturl, '?action=logout;', $context['session_var'], '=', $context['session_id'], '">', $txt['logout'], '</a></li>';
else
echo '
<li><a href="#" data-toggle="modal" data-target="#loginModal">', $txt['login'], '</a></li>
<li><a href="', $scripturl, '?action=register">', $txt['register'], '</a></li>';


Thank you for any assistance!  This has always been a forum favourite mod.

GL700Wing

#944
The 'echo' command in the following block of code is not terminated - there should be a '; at the end after the </li>.

// User login
if (!empty($context['user']['is_logged']))
echo '
<li><a href="', $scripturl, '?action=profile;area=forumprofile">', $txt['forumprofile'], '</a></li>
<li><a href="', $scripturl, '?action=profile;area=account">', $txt['account'], '</a></li>
<li><a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
<li><a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>


Also, there is no 'echo' command at the beginning of the following block of code (which shouldn't be between the '}' and the 'else'):
<li class="divider"></li>
<li><a href="', $scripturl, '?action=logout;', $context['session_var'], '=', $context['session_id'], '">', $txt['logout'], '</a></li>';


I think the following block of code should work:
// User login
if (!empty($context['user']['is_logged']))
{
echo '
<li><a href="', $scripturl, '?action=profile;area=forumprofile">', $txt['forumprofile'], '</a></li>
<li><a href="', $scripturl, '?action=profile;area=account">', $txt['account'], '</a></li>
<li><a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
<li><a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>';

if(LikePosts::$LikePostsUtils->showLikeNotification())
echo '
<li><span class="showLikeNotification" onclick="lpObj.likePostsNotification.showLikeNotification()">', $txt['like_show_notifications'], '</span></li>';

echo '
<li class="divider"></li>
<li><a href="', $scripturl, '?action=logout;', $context['session_var'], '=', $context['session_id'], '">', $txt['logout'], '</a></li>';
}
else
echo '
<li><a href="#" data-toggle="modal" data-target="#loginModal">', $txt['login'], '</a></li>
<li><a href="', $scripturl, '?action=register">', $txt['register'], '</a></li>';
Life doesn't have to be perfect to be wonderful ...

sera

#945
Perfect fix!  Thank you so much, GL700Wing!!!!

Edit: Okay, well the theme is up and working again!  lol  i may need another edit later as i'm having some difficultly locating the Like option on the theme. xD Thank you, thank you!

Didn't have the user permissions set up correctly!  Again, thank you so much! =3

vbgamer45

Version 2.0.6 released
- Remote Avatars now also support https
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

efk

Hey guys I really want to have dislike button. Someone have lines which should be added to have dislike with same functions which like have? And of course if someone click on some of those button it should disable another one till clicking on Unlike. Any help so I can summon one brilliant coder to install that plugin finally?  O:)

SirLouen

I used to have both combined Thank-o-matic and Like Posts
I recently deleted Thank-o-matic and now Like Posts it's crashing

I've tried to remove Like Posts and "reinstalling it" without deleting the DB registers but it's not working

Some errors:

On "sa=savegeneralsettings": Function name must be a string

forum.com/index.php?pretty;action=admin&amp;area=likeposts;sa=savegeneralsettings
8: Undefined property: LikePostsAdmin::$Array /Sources/LikePosts/LikePostsRouter.php
Line: 128

forum.com/index.php?pretty;action=admin&amp;area=likeposts;sa=savegeneralsettings
8: Array to string conversion /Sources/LikePosts/LikePostsRouter.php
Line: 91

forum.com/index.php?pretty;action=admin&amp;area=likeposts;sa=savegeneralsettings
8: Undefined property: LikePostsAdmin::$Array /Sources/LikePosts/LikePostsRouter.php
Line: 91

On "sa=seeotherslikes": Function name must be a string

forum.com/index.php?pretty;action=profile&amp;area=likeposts;sa=seeotherslikes;u=1
8: Undefined property: LikePostsProfile::$ArrayAplicar Sources/LikePosts/LikePostsRouter.php
Line 128


The most interesting thing is that ?area=likeposts;u=1 workswell (with a result equivalent to sa=seeownlikes)

But when clicking on sa=seeownlikes: Function name must be a string
forum.com/index.php?pretty;action=profile&amp;area=likeposts;sa=seeownlikes;u=1
8: Undefined property: LikePostsProfile::$Array /Sources/LikePosts/LikePostsRouter.php
Line: 128


vbgamer45

Try to uninstall like posts then reinstall hooks might have gotten cleared.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

SirLouen

Quote from: vbgamer45 on June 24, 2018, 10:46:10 AM
Try to uninstall like posts then reinstall hooks might have gotten cleared.

Quote from: SirLouen
I've tried to remove Like Posts and "reinstalling it" without deleting the DB registers but it's not working

Did so, same errors.

This happens with the "sa=" of Like Posts exclusively. Not with other sa= of the forum
No errors or anything during the installation

Maybe I have to recreate this part manually in the DB?

SirLouen

It seems that this issue is not new:
https://github.com/siddhartha-gupta/SMF-Likes/issues/53

It has been happening from last year.

SirLouen

I see that this guy solved this
https://github.com/siddhartha-gupta/SMF-Likes/pull/51/commits/5ddc158ff148a3eb9c8b2145e3bbced9d602b14d

It seems the huge problem is with installations based on PHP 7+
I've now solved the previous issue, but now new issues arise :P

Call to undefined function getOwnLikes()

SirLouen

Quote from: SirLouen on June 24, 2018, 12:29:07 PM
Call to undefined function getOwnLikes()

Ok, I've solved this also
I put:
return LikePosts::$LikePostsProfile->{$subActions[$_REQUEST['sa']]($memID)};
Instead of:
return LikePosts::$LikePostsProfile->{$subActions[$_REQUEST['sa']]}($memID);

Now the mod is running smoothly in PHP 7+

@vbgamer45 push changes for future Like Posts 2.0.7 :)
PD: Don't forget to update version in all the files, you still have all versioned under 2.0.5 on 2.0.6

pocttopus

Is there any way to use some kind of Like icon instead of hyperlink!?

SirLouen

Quote from: pocttopus on June 26, 2018, 07:23:59 AM
Is there any way to use some kind of Like icon instead of hyperlink!?

Not by default. There is no hyperlink, there is a button

pocttopus

Yes, I was referring to button which is very similar to hyperlink with background color.
So no way to use icon instead of button?

SirLouen

Yes, there is, but manually through code

pocttopus

Thanks... I had added an like icon into LikePosts.css  :D

.like_link {
background: #3159A8 url(../../default/images/like/thumb-up.png) no-repeat;
padding: 1px 20px;
color: #fff !important;
position: relative;
border-radius: 2px;
}

shawnb61

I believe the errors above are due to the lack of php7 support. 

It'd be nice to get that tweak in there when you have time!   :)
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: