News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Like Posts

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

Previous topic - Next topic

Rob Lightbody

Quote from: Rob Lightbody on January 02, 2020, 08:14:04 AM
...
Installed OK - but now I have the "Like Posts" button on my menu bar as the first thing - before Home - affects all users - and is very confusing!  (I instinctively click the first button on the menu bar when i want to go home!).
...

Is anyone able to help with this please?  Screenshot attached to explain.

Thank you very much!

vbgamer45

Do you want to remove from menu completely? Or change position?
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

Rob Lightbody

Quote from: vbgamer45 on January 14, 2020, 03:44:25 PM
Do you want to remove from menu completely? Or change position?

Move it's position, anywhere but first place!!

vbgamer45

Hmm looks like this mod uses hooks should add it after the logout button

sources/likeposts/LikePosts.php


public static function addMenuItems(&$menu_buttons) {
global $scripturl, $txt, $user_info, $modSettings;

if (empty($modSettings['lp_mod_enable']) || empty($modSettings['lp_stats_enable']) ||
!self::$LikePostsUtils->isAllowedTo(array('lp_guests_can_view_likes_stats', 'lp_can_view_likes_stats'))) {
return false;
}

// insert before logout
$initPos = 0;
reset($menu_buttons);
while (($key = key($menu_buttons) && $val = current($menu_buttons)) && $key != 'logout')
$initPos++;

$menu_buttons = array_merge(
array_slice($menu_buttons, 0, $initPos),
array(
'like_post_stats' => array(
'title' => $txt['lp_stats'],
'href' => $scripturl . '?action=likepostsstats',
'show' => true,
'sub_buttons'=> ''
),
),
array_slice($menu_buttons, $initPos, count($menu_buttons) - $initPos)
);
}
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

jsx

vbgamer45,

I use a different theme than the default one and when I want to install this modification I get the following error:

Execute Modification:

index.template.php

Code: (Find)

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

Code: (Add After)


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


So I have to do this change manually, right?

vbgamer45

Yes, that change would need to be done manually.
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

jsx

vbgamer45,

I use the Express theme, which I bought a long time ago at DzinerStudio. This code does not exist in the index.template.php file:

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

This file has the following code:

<li><a class="dot" href="', $scripturl, '?action=unread">', $txt['view_unread'], '</a></li>
<li><a class="dot" href="', $scripturl, '?action=unreadreplies">', $txt['view_replies'], '</a></li>';


So I have to add this code:


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


Under this code?

<li><a class="dot" href="', $scripturl, '?action=unread">', $txt['view_unread'], '</a></li>
<li><a class="dot" href="', $scripturl, '?action=unreadreplies">', $txt['view_replies'], '</a></li>';

vbgamer45

Yes you can add it after.
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

jsx

After adding this code:


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


The theme does not display correctly.



Why is this happening?

vbgamer45

Post your whole file you modified.
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

jsx

I attached the file.


vbgamer45

Not seeing anything wrong with the code you added. It looks like a theme issue.
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

jsx

Do you surmise what could be wrong with this theme? I installed this modification without any changes to the express theme and this modification works, but the "Like" button is not displayed.

vbgamer45

Not really sure not familiar with theme issues.
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

jsx

The issue with installing this modification is on many themes. Even on the premium theme from smftricks there are errors from this modification during installation.

vbgamer45

Yes, that will happen with custom themes.
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

jsx

vbgamer45,

The modification works, I made a mistake not installing for the theme. ::) 8)

vbgamer45

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

jsx

vbgamer45,

I want to change the position of the Like stats link. How can I do that? Ideally, this link should be placed before Logout. Why is the link from this modification there is in the first position in the menu bar?

vbgamer45

Not easy to change since it is hook based you have to edit the php hook code.
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

Advertisement: