Customizing SMF > SMF Coding Discussion

Must have post to see links

(1/7) > >>

Android4Life:
Is it possible to make it where you have to have  a certain amount of post to see links?

Marceline:
You mean the links on any message?

sure is possible, open Sources/Subs.php find:


--- Code: ---'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',
--- End code ---

replace with:


--- Code: ---'content' => $user_info['posts'] < 10 ? 'sorry, you cannot see the links until you get 10 posts' : '<a href="$1" class="bbc_link" target="_blank">$1</a>',
--- End code ---

find this:


--- Code: --- 'after' => '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
--- End code ---



and replace with:


--- Code: --- 'after' => '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;

if($user_info[\'posts\'] < 10)
$data = \'sorry, you cannot see the links until you get 10 posts\';
'),
--- End code ---


Just change the 10 for any number you want.

code is from memory so it may have some errors. Do a backup of your file first.

Android4Life:
does this work on any post?  where is this file located? Thanks

Anthony`:

--- Quote from: Android4Life on April 06, 2012, 09:39:19 PM ---does this work on any post?  where is this file located? Thanks

--- End quote ---

It'll work with the url BB code, and it's located by going to the root directory of SMF (where SSI.php is located) and going to the Sources directory. From there, you will see the Subs.php file.

Android4Life:
I did it and now my forum won't load, get this. thanks for the help in advance!

Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/content/38/6934638/html/forum/Sources/Subs.php on line 1308

Navigation

[0] Message Index

[#] Next page

Go to full version