Share This Topic

Started by Suki, September 06, 2009, 05:09:23 AM

Previous topic - Next topic

Suki

can you attach both your  theme's  display.template.php  and Sources/Display.php  files  I  will make some edits so the links this mod adds does not get parser by the other mod.

Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

DrBermant

Quote from: Miss All Sunday on March 14, 2011, 02:00:17 PM
can you attach both your  theme's  display.template.php  and Sources/Display.php  files  I  will make some edits so the links this mod adds does not get parser by the other mod.

There is no separate Theme display.template.php, so here is the default one. The Display.php is from the source folder. I downloaded the active ones from the live site.

Thank you so much for your help.  I really like both mods and being able to use both would be so nice. Did you take a look at the other mod. I think it is the same one used on this forum. At present I am using only the first option, blocking by post count.

Michael Bermant, M.D.
Board Certified
American Board Plastic Surgery
Plastic Surgery Encyclopedia
A Body Beautiful Plastic Surgery Forum

Bancherd

I have similar problem to that of DrBermant.  Same mods on default theme.

Suki

#1123
well, since there's more people with this, I will post instructions then.

Open your Sources/Display.php find and delete this part:




// share this topic start

    // Lets check if there are some boards where the buttons will NOT be show
    if (!empty($modSettings['share_options_boards']))
{
$share_denied_boards = explode(",", preg_replace("/[^0-9,]/", "", $modSettings['share_options_boards']));
foreach ($share_denied_boards as $key => $value) if ($value == "") unset($share_denied_boards[$key]);
}
else $share_denied_boards[] = '';

// define some parameters
$parameters = array(
'url' => $scripturl . '?topic=' . $topic . '.msg' . $message['id_msg'] . '#msg' . $message['id_msg'],
);

// :)
  $suki =  share_this($parameters);
  $mirahalo = share_icons($parameters);

if (!empty($modSettings['share_all_messages']) &&  !in_array($board_info['id'], $share_denied_boards))
$message['body'] = ($suki.$message['body'].$mirahalo);

if (empty($modSettings['share_all_messages']) && $counter == 0 &&  !in_array($board_info['id'], $share_denied_boards))
$message['body'] = ($suki.$message['body'].$mirahalo);

    // Share this topic mod end



now open your theme's Display.template.php file or the default one if your theme doesn't have a custom display  find this:

// Show the post itself, finally!

and above that add this:

// share this topic start

    // Lets check if there are some boards where the buttons will NOT be show
    if (!empty($modSettings['share_options_boards']))
{
$share_denied_boards = explode(",", preg_replace("/[^0-9,]/", "", $modSettings['share_options_boards']));
foreach ($share_denied_boards as $key => $value) if ($value == "") unset($share_denied_boards[$key]);
}
else $share_denied_boards[] = '';

// define some parameters
$parameters = array(
'url' => $message['href'],
);

// :)
  $suki =  share_this($parameters);
  $mirahalo = share_icons($parameters);


    // Share this topic mod end



lastly, find this:

<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
</div>';



and replaced with this:

<div class="inner" id="msg_', $message['id'], '"', '>',$suki,'', $message['body'], '',$mirahalo,'</div>
</div>';

Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

DrBermant

That works fixing the conflict. Here is an example of it working:

http://www.abodybeautiful.com/forum/index.php/topic,197.0.html

Is it possible to make it so that the social link options are only available for first posts?  With the hand coding changes, are there any options that should now not be selected in the mod? For instance is changing any of the social networks going to cause a problem?

Even if it does not, thank you so much for the improvement.

Michael Bermant, M.D.
Board Certified
American Board Plastic Surgery
Plastic Surgery Encyclopedia
A Body Beautiful Plastic Surgery Forum

Suki

ok, on your display.template.php file find:

// :)
  $suki =  share_this($parameters);
  $mirahalo = share_icons($parameters);


and replace with this:



// :)
  $suki = '';
  $mirahalo = '';

if empty($message['counter']){
  $suki =  share_this($parameters);
  $mirahalo = share_icons($parameters);
  }
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

DrBermant

To begin with, I really am limited on my coding abilities.

When I paste your code into the file I get an error on this line:

       if empty($message['counter']){

Here is the total code section as I copied it:

// :)      
        $suki = '';
        $mirahalo = '';
      
       if empty($message['counter']){
        $suki =  share_this($parameters);
        $mirahalo = share_icons($parameters);
        }
         

    // Share this topic mod end   

---------------------
I did not load it up to my live site. Is there a coding error or should I disregard the dreamweaver warning of syntax error?  I am quite good at my Plastic Surgery, but this coding stuff is a little beyond me.

Thank you,

Michael Bermant, M.D.
Board Certified
American Board Plastic Surgery
Plastic Surgery Encyclopedia
A Body Beautiful Plastic Surgery Forum

HunterP

Quote from: DrBermant on March 14, 2011, 09:12:29 PM
       if empty($message['counter']){

This line is missing parantheses, should be :

       if (empty($message['counter'])) {

DrBermant

Wow, thank you all:

http://www.abodybeautiful.com/forum/index.php/topic,197.0.html

ta da!

Now that you pointed out the missing ), it is so obvious, but that is why I proudly admit to my limited coding skill.  Boy, when I was learning Quicktran back in 1964, I bet I would have caught the missing parenthesis, or back in my college years, but that was still decades ago. Oh well.

Now back to the issue of what on the share this admin tools can be touched and what cannot be messed with after this mod of the mod?  Or will the mod be updated for this situation?

Everyone, thank you very much.

Michael Bermant, M.D.


Board Certified
American Board Plastic Surgery
Plastic Surgery Encyclopedia
A Body Beautiful Plastic Surgery Forum

Suki

sorry for the missing ()   I was in a hurry when I posted it :(

this was a temp solution, the mod settings were overwritten by this custom code, even if you check/un check the  "Show the buttons and icons on every message?"  setting the icons and buttons will only appear in the first message.

however,  you can still check/un check all the icons and buttons to enable/disable them with no problems :)

currently I don't have plans on changing how the mod works,  doing template edits means more issues for both me and the final users who uses a custom theme,  doing source edits only means that no matter what theme you are using, the mod will still work :)

unfortunately, if you decide to change your theme and the new theme has its own display.template, you will have to make the edits to that file too,  thats the reason the previous mod author move the edits from template file to source files, to avoid regular users the need to modify their files when they decide to use a custom theme.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

DrBermant

You may also want to edit your post:

code select
<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
                     </div>';

to

<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>


I was able to figure that one out, but feel dumb missing the () issue.

I do not see the need to change the social network to all posts. Even if so, I think I can figure out from this thread how to go there manually.

My main concern was turning on and off the individual social engines. That would be a pain to go back and do manual edits each time.

Again thank you for taking the time to figure this out.

Michael Bermant, M.D.
Board Certified
American Board Plastic Surgery
Plastic Surgery Encyclopedia
A Body Beautiful Plastic Surgery Forum

HunterP


Bugreport

When showing the button(s) only in the first message and selecting 'Show most recent posts at the top' in the profile, no buttons will appear, probably because the first message isn't actually shown as first?

Suki

no,  the first message  is not the first one that is been show but rather the very first one of the entire topic,  $counter= 0

so technically, if you chose 'Show most recent posts at the top'  the buttons will appear in the last message
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

HunterP

Quote from: Miss All Sunday on March 21, 2011, 10:49:37 AM
no,  the first message  is not the first one that is been show but rather the very first one of the entire topic,  $counter= 0

so technically, if you chose 'Show most recent posts at the top'  the buttons will appear in the last message

Did you test this? In a topic with only two messages, this is very simple, but it doesn't show in either of them.

Suki

ahh, the problem is, when the "Show most recent posts at the top"  is enable, the "first"  message  have  1  instead of 0,   when is disable, the first message have 0, thats why when you enable that feature, the buttons and icons does not show because theres  no 0,  it starts from 1, dunno why.

to solved  find in your Sources/Display.php


if (empty($modSettings['share_all_messages']) && $counter == 0 &&  !in_array($board_info['id'], $share_denied_boards))
$message['body'] = ($suki.$message['body'].$mirahalo);


and replace $counter == 0  with $counter == 1
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

HunterP


Thanks for your fix, but when the "recent first" is not enabled, the button(s) appear in the second message  :(

HunterP

Quote from: HunterP on March 21, 2011, 11:58:39 AM
Thanks for your fix, but when the "recent first" is not enabled, the button(s) appear in the second message  :(

Think I've fixed it myself :

      if (empty($modSettings['share_all_messages']) && $counter == empty($options['view_newest_first']) ? 0 : 1 && !in_array($board_info['id'], $share_denied_boards))
         $message['body'] = ($suki.$message['body'].$mirahalo);

This makes the button(s) appear in the first (top-most) posting which isn't neccessarily the first post, but this is perfect for me :)

HunterP


When I think of it, we only want to see the button (only Twitter) in the first posting, to link to the first posting. With my fix, the posting in which the button appears keeps on changing, so if you can make a fix which shows the button allways in the first posting, also when show_newest_first is true.

Suki

please  do not create multiple messages, edit your previous one if you have something more to say.


I was gonna, say it, your fix isn't really a fix, I'm going to release and update with a proper fix when I have enough time to test properly.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

HunterP


Advertisement: