seandrickson / YOURLS-Remove-the-Share-Function

Remove the Share button and box that toggles the sharing options on the Admin page
4 stars 0 forks source link

This plugin may remove too much. #1

Closed innov8ion closed 11 years ago

innov8ion commented 11 years ago

This plugin was exactly what I was looking for however I think I may have found a bug. What's good is that the plugin does remove Quick Share from the admin page and after creating a shortened link.

However, it unfortunately removes the portion below after the statement that it already exists in the database or has been added to it. It's important for people to know what the short link is, even if they didn't initially create it or even if they need a reminder. Can you duplicate this? I'm running YOURLS v1.6.

Thanks!


"http://google.com already exists in the database" or "htttp://google.com added to the database"

Your short link

http://exampleshortlink.com/google

Long link: http://google.com Stats: http://exampleshortlink.com/google+

innov8ion commented 11 years ago

Right now I'm solving this by commenting out the following code from functions-html.php but I know it's not the right way... <?php yourls_do_action( 'shareboxes_middle', $longurl, $shorturl, $title, $text ); ?>

    <div id="sharebox" class="share">
        <?php echo $share_title; ?>
        <div id="tweet">
            <span id="charcount" class="hide-if-no-js"><?php echo $count; ?></span>
            <textarea id="tweet_body"><?php echo $share; ?></textarea>
        </div>
        <p id="share_links"><?php yourls_e( 'Share with' ); ?> 
            <a id="share_tw" href="http://twitter.com/home?status=<?php echo $_share; ?>" title="<?php yourls_e( 'Tweet this!' ); ?>" onclick="share('tw');return false">Twitter</a>
            <a id="share_fb" href="http://www.facebook.com/share.php?u=<?php echo $_url; ?>" title="<?php yourls_e( 'Share on Facebook' ); ?>" onclick="share('fb');return false;">Facebook</a>
            <a id="share_ff" href="http://friendfeed.com/share/bookmarklet/frame#title=<?php echo $_share; ?>" title="<?php yourls_e( 'Share on Friendfeed' ); ?>" onclick="share('ff');return false;">FriendFeed</a>
            <?php
            yourls_do_action( 'share_links', $longurl, $shorturl, $title, $text );
            // Note: on the main admin page, there are no parameters passed to the sharebox when it's drawn.
            ?>
        </p>
    </div>
seandrickson commented 11 years ago

Sorry its been so long for me to get back to this. From what I understand you don't like that it hides the "Your Short Link" box in addition to the "Quick Share" box. It's never bothered me, and it doesn't hide the notifications that a shortlink already exists (those pop up from the top): screen shot 2013-07-08 at 8 15 59 am

If you are looking to hide the Quick Share box without hiding the "Your Short Link" box, use the Custom CSS plugin and replace the CSS in the plugin with the following code. This is the best way to do this (there are no PHP functions to hide one and not the other):

#sharebox { display: none }

If there is an issue with the way this is handled, and you want a way to bypass this using PHP, post an issue with the YOURLS repo and the issue may be resolved.