[BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!

[BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby ycl6 » Thu Jan 03, 2008 12:50 pm

MOD Title: [phpBB3] Simple Hide URL MOD

MOD Description: Whenever [URL] BBcode is used in a message, the hyperlink is automatically hidden from guests.

MOD Version: 0.0.1

Author Notes:
Tested on phpBB 3.0.0 GOLD.

Supported Languages
  • English
  • Traditional Chinese
  • Simplified Chinese

Download: Simple Hide URL MOD

~Mac
User avatar
ycl6
Former Team Member
 
Posts: 5702
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby ChriZathens » Thu Jan 03, 2008 2:30 pm

Nice Idea!!!
Congrats.. I'll test it and report any probs !!!

EDIT: OK, just tested it... Very simple installation, It works great and the prosilver edits are the same for my subsilver based style, too...

Main problem in my forum is that there are too many links without url bbcodes... :lol:
25% of the links get hidden with ur mod, the other 75% (without bbcode) are publically visible... :lol:

But the part that involves your mod works as it should.. Nice !!!
My mods in MODDB:
Add Homepage link in header | Change user activity post limit | Post number in viewtopic

My mods in DEV:
Ajax Dock Menu - Change user warnings count - Mark forums read (3.0.6-RCx)
User avatar
ChriZathens
Registered User
 
Posts: 1417
Joined: Tue Apr 18, 2006 9:11 pm
Location: Athens, Greece

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby xnitelifex » Thu Jan 03, 2008 4:56 pm

Cool, it works the way it's described here!,

Suggestions:
-hide all URL, not just those using BBCode
-message to be in bold, color, etc. to stand out more
-if the post have multiple links, show [*xxx] with a notation below the message. that way, it won't display "URL is hidden from guests, please register and login to view the hyperlink" multiple times to clutter the post.

Thanks!
phpBB3 mod requests:
1) HTTP referer [available on vb] - [wiki lookup]
2) Hide links from guest [available on vb]
xnitelifex
Registered User
 
Posts: 126
Joined: Wed Jun 27, 2007 6:35 pm

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby Sniiper » Sun Jan 06, 2008 2:30 am

is there anyway to get this mod without using bbcode..
because on my froum no links used with bbcode..but at the sametime i need a mod to hide links from guest to make them register
Sniiper
Registered User
 
Posts: 36
Joined: Sat Dec 22, 2007 4:55 pm

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby Blanky » Thu Jan 17, 2008 10:03 am

Does this work with text also? Let's say I type [url]bla bla lbla b notalink[/url] will that be higgen also?
Blanky
Registered User
 
Posts: 254
Joined: Wed Aug 23, 2006 4:25 pm

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby methos3uk » Thu Jan 17, 2008 9:51 pm

xnitelifex wrote:Suggestions:
-message to be in bold, color, etc. to stand out more


If you edit the new line in bbcode.html (in styles\...\template) and change it from:
Code: Select all
<!-- BEGIN url_hidden -->{L_URL_HIDDEN}<!-- END url_hidden -->

to
Code: Select all
<!-- BEGIN url_hidden --><span style="background-color:#FAFAFA; border:#D1D7DC solid 1px; color:#444444;">&nbsp;{L_URL_HIDDEN}&nbsp;</span><!-- END url_hidden -->


You can get it to look exactly as you want.
In this case I did this for proSilver and it appears in a light grey box on the blue background with a grey border.
Adding a font-weight:bold or changing the value of the color:#444444; within the style="" attribute may give you what you need.
The values are hard-coded in this sample, but could be set up as configurable
methos3uk
Registered User
 
Posts: 1
Joined: Thu Jan 17, 2008 8:26 pm

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby s60Addict » Sun Jan 20, 2008 9:13 am

Also, try to include the URL's in [ CODE ] tags..
s60Addict
Registered User
 
Posts: 49
Joined: Tue Sep 26, 2006 5:08 pm

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby Muad''Dib » Wed Apr 16, 2008 3:18 pm

s60Addict wrote:Also, try to include the URL's in [ CODE ] tags..


That would be excellent.
User avatar
Muad''Dib
Registered User
 
Posts: 305
Joined: Tue Jun 12, 2007 6:20 pm

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby mysteryclub » Wed Apr 23, 2008 2:21 pm

Hey! This works great. Thanks for this mod but I have a tiny problem. The hidden text does not show up.

I did exactly what I should. Any idea? :|
User avatar
mysteryclub
Registered User
 
Posts: 20
Joined: Wed Oct 17, 2007 5:34 pm

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby Muad''Dib » Fri Apr 25, 2008 11:53 pm

Ok i have good news for those of you who wanted to use this mod to hide "code" bbcode instead of or along with "url" bbcode:

Here is my example:

Image

Here are my instructions:

Open: includes/bbcode.php and find:

Code: Select all
            case 8:
               $this->bbcode_cache[$bbcode_id] = array(
                  'preg' => array(
                     '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#ise'   => "\$this->bbcode_second_pass_code('\$1', '\$2')",
                  )
               );
            break;


Replace with:

Code: Select all
            case 8:
               if ($user->data['user_id'] != ANONYMOUS)
               {
                  $this->bbcode_cache[$bbcode_id] = array(
                     'preg' => array(
                        '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#ise'   => "\$this->bbcode_second_pass_code('\$1', '\$2')",
                     )
                  );
               }
               else
               {
                  $this->bbcode_cache[$bbcode_id] = array(
                     'preg' => array(
                        '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#ise'   => "\$this->bbcode_second_pass_code_hidden('\$1', '\$2')",
                     )
                  );
               }
            break;


Find:

Code: Select all
      $code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close');

      return $code;
   }


Add After:

Code: Select all
   function bbcode_second_pass_code_hidden($type, $code)
   {
      // when using the /e modifier, preg_replace slashes double-quotes but does not
      // seem to slash anything else
      $code = str_replace('\"', '"', $code);

      switch ($type)
      {
         case 'php':
            // Not the english way, but valid because of hardcoded syntax highlighting
            if (strpos($code, '<span class="syntaxdefault"><br /></span>') === 0)
            {
               $code = substr($code, 41);
            }

         // no break;

         default:
            $code = str_replace("\t", '&nbsp; &nbsp;', $code);
            $code = str_replace('  ', '&nbsp; ', $code);
            $code = str_replace('  ', ' &nbsp;', $code);

            // remove newline at the beginning
            if (!empty($code) && $code[0] == "\n")
            {
               $code = substr($code, 1);
            }
         break;
      }

      $code = $this->bbcode_tpl('code_open') . $code = $this->bbcode_tpl('code_hidden') . $this->bbcode_tpl('code_close');

      return $code;
   }


Save and close bbcode.php.

Open: language/en/viewtopic.php and find:

Code: Select all
));

?>


Add Before:

Code: Select all
'CODE_HIDDEN'         => 'CODE is hidden from guests, please register and login to view the code',


Save and close viewtopic.php.

Open: styles/prosilver/template/bbcode.html and find:

Code: Select all
<!-- BEGIN code_open --><dl class="codebox"><dt>{L_CODE}: <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></dt><dd><code><!-- END code_open -->
<!-- BEGIN code_close --></code></dd></dl><!-- END code_close -->


Add After:

Code: Select all
<!-- BEGIN code_hidden -->{L_CODE_HIDDEN}<!-- END code_hidden -->


Save and close bbcode.html.

Upload all changed files, purge cache, and your all set!

I hope that helps someone!
User avatar
Muad''Dib
Registered User
 
Posts: 305
Joined: Tue Jun 12, 2007 6:20 pm

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby talkbasket » Sat Apr 26, 2008 8:56 am

Code: Select all
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /forums/includes/bbcode.php on line 600

I got this error :?
TalkBasket - Home of basketball

Create Blog | Forums | Ask the Coach
talkbasket
Registered User
 
Posts: 41
Joined: Fri Jun 29, 2007 2:18 pm
Location: Lithuania

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby shinzo » Tue May 06, 2008 7:28 pm

can be used with PHPPbb3 Olympus?
shinzo
Registered User
 
Posts: 26
Joined: Sun Mar 16, 2008 6:05 am

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby Muad''Dib » Tue May 06, 2008 8:51 pm

shinzo wrote:can be used with PHPPbb3 Olympus?


Isnt that what the title says?? :?
User avatar
Muad''Dib
Registered User
 
Posts: 305
Joined: Tue Jun 12, 2007 6:20 pm

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby shinzo » Wed May 07, 2008 4:45 am

Muad''Dib wrote:
shinzo wrote:can be used with PHPPbb3 Olympus?


Isnt that what the title says?? :?


oo i c.
im sorry, i dun know PHPbb3 Gold is Olympus too!
ill give it a try! ;)
shinzo
Registered User
 
Posts: 26
Joined: Sun Mar 16, 2008 6:05 am

Re: [BETA] Simple Hide URL MOD 0.0.1 (phpBB3 GOLD)

Postby shinzo » Thu May 08, 2008 9:15 am

Thanks Muad''Dib! it works! :D
shinzo
Registered User
 
Posts: 26
Joined: Sun Mar 16, 2008 6:05 am

Next

Return to [3.0.x] MODs in Development

Who is online

Users browsing this forum: *=Matt=*, Akbaio, Ask Jeeves [Bot], azzurri, BucsFan, DzoA, fs_unreal, jbarrouk, Lasse86, madmartyau, metropolis2k, MSNbot Media, poppertom69, posey, Twiceler [Bot] and 84 guests