MyBB Community Forums

Full Version: stop mybb from shortening links
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
On my forum..how can i force links to show the full url, instead of attempting to shorten it via adding ... such as this link or the link within this link?

Without using the codebox...as we have that turned off. 

http://python-forum.io/Thread-Python3-to...79#pid3479

EDIT:
Ive already modified class_parser.php and other core edits. So i dont mind doing that. I have a feeling that somewhere in class_parser.php it checks links and replaces it with a shortened version and still clikcable...i just cannot find where.
This is what you are looking for. I don't think it could be achieved by a plugin.
https://github.com/mybb/mybb/blob/141bd8....php#L1053

Edit: I've just found this... I think it should be an option somewhere, let me find it.

Edit2: Check this
Try changing this array
$parser_options = array(
	"allow_html" => $forum['allowhtml'],
	"allow_mycode" => $forum['allowmycode'],
	"allow_smilies" => $forum['allowsmilies'],
	"allow_imgcode" => $forum['allowimgcode'],
	"allow_videocode" => $forum['allowvideocode'],
	"filter_badwords" => 1
);

To this
$parser_options = array(
	"allow_html" => $forum['allowhtml'],
	"allow_mycode" => $forum['allowmycode'],
	"allow_smilies" => $forum['allowsmilies'],
	"allow_imgcode" => $forum['allowimgcode'],
	"allow_videocode" => $forum['allowvideocode'],
	"filter_badwords" => 1,
	"shorten_urls" => ""
);
I couldnt find this array
E486: Pattern not found: parser_options
but i did find the if condition you were talking about...and commented that out and it works

            $name = htmlspecialchars_decode($name);
            if(my_strlen($name) > 55)
            {
                //$name = my_substr($name , 0, 40).'...'.my_substr($name , -10);
                //do not shorten urls
            }
            $name = htmlspecialchars_uni($name);

Thank you!!!

It just seemed kind of silly. As if you wanted it shortened...you would use the url tag to name it anyways.

Also with having Google SEO, its more descriptive to have the whole URL linking to your own pages.
I disagree that it's silly, and there's a reason that pretty much every platform that accepts posts from users has a URL shortening mechanism. What happens if someone pastes a URL with hundreds of characters? And why would you want URLs to take up an entire line or multiple lines of text?
The $parser_options array is in showthread.php, not in class_parser.php I recommend you to revert your changes and change showthread.php instead.

(2016-10-25, 06:42 PM)brad-t Wrote: [ -> ]I disagree that it's silly, and there's a reason that pretty much every platform that accepts posts from users has a URL shortening mechanism. What happens if someone pastes a URL with hundreds of characters? And why would you want URLs to take up an entire line or multiple lines of text?

I also agree with brad-t's opinion.
There would be far and few times that that would happen. If in the event it does happen...we have so many admins/mods that if it was annoying, we would just edit it to use url tag and name it. If it happened numerous times with the same user, we would just tell the user to use url tags. If it kept happening, we would warn the user, then we would eventually lock the account. 

But i see the times its more useful as seeing a full url. Such example is in an output of parsing a site...and someone is trying to explain a portion of the url. It would be helpful to see the entire url than seeing a shortened version of it.

Quote:The $parser_options array is in showthread.php, not in class_parser.php I recommend you to revert your changes and change showthread.php instead.
Ah ok i was thinking it was class_parser.php 

Why is this? What would it matter if the line is commented out VS adding an empty value for the array?
The reason you set up $parser_options in a different page than on class_parser.php is because the options you want will depend on what you are doing. Some parts of the forum you may want smileys while others you don't.
(2016-10-25, 07:06 PM)dragonexpert Wrote: [ -> ]The reason you set up $parser_options in a different page than on class_parser.php is because the options you want will depend on what you are doing.  Some parts of the forum you may want smileys while others you don't.

Exactly because of this. A lot of features from MyBB use class_parser.php but you only want to modify the shortened URL settings on thread/posts. It's less risky.
Ah ok. Thanks guys.

OK so i changed this
        // Loop through the poll options.
        for($i = 1; $i <= $poll['numoptions']; ++$i)
        {
            // Set up the parser options.
            $parser_options = array(
                "allow_html" => $forum['allowhtml'],
                "allow_mycode" => $forum['allowmycode'],
                "allow_smilies" => $forum['allowsmilies'],
                "allow_imgcode" => $forum['allowimgcode'],
                "allow_videocode" => $forum['allowvideocode'],
                "filter_badwords" => 1,
                "shorten_urls" => ""
            );
It doesnt appear to take effect as expected.
(2016-10-25, 06:53 PM)metulburr Wrote: [ -> ]There would be far and few times that that would happen. If in the event it does happen...we have so many admins/mods that if it was annoying, we would just edit it to use url tag and name it. If it happened numerous times with the same user, we would just tell the user to use url tags. If it kept happening, we would warn the user, then we would eventually lock the account. 

But i see the times its more useful as seeing a full url. Such example is in an output of parsing a site...and someone is trying to explain a portion of the url. It would be helpful to see the entire url than seeing a shortened version of it.

Quote:The $parser_options array is in showthread.php, not in class_parser.php I recommend you to revert your changes and change showthread.php instead.
Ah ok i was thinking it was class_parser.php 

Why is this? What would it matter if the line is commented out VS adding an empty value for the array?

If you want to explain a URL without truncating it you can show it in a code tag. That makes more sense if the primary purpose of sharing the URL is examination. That situation seems more likely to be "few and far between," by the way.'

Relying on human moderation to take care of something that was previously handled automatically is a step backwards. You're seriously talking about manually moderating posts and even banning users for posting long URLs. I think your long list of ways to handle the situation explains why URLs are shortened in the first place.

Of course, you're free to run your site how you want, but be aware that you're disabling a valuable piece of functionality.
Pages: 1 2