Must have post to see links

Started by Android4Life, April 06, 2012, 11:00:08 AM

Previous topic - Next topic

Android4Life

Is it possible to make it where you have to have  a certain amount of post to see links?
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

Suki

You mean the links on any message?

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

'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',

replace with:

'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>',

find this:

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




and replace with:

'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\';
'),



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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Android4Life

#2
does this work on any post?  where is this file located? Thanks
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

ascaland

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

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

#4
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
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

Android4Life

My Subs.php is attached to this post.
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

ascaland


Android4Life

Thanks! It does not block it off though, I created another account with no post and it didn't stop me from seeing links. Could my Registered Links mod be affecting it?
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

Android4Life

or does it not work on the topic post?
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

Android4Life

Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

Suki

Android4Life please do not bump your topic like that.

Use this one.

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

Android4Life

Quote from: Suki on April 07, 2012, 03:27:26 PM
Android4Life please do not bump your topic like that.

Use this one.
Using this one I get
Not Found

The requested URL /forum/sorry, you cannot see the links until you get 10 posts was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

Suki

#12
That's because we are replacing an url with text.

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

rhey15

nice tutorial thanks for the info.. :)

ascaland

Quote from: Suki on April 08, 2012, 10:06:37 AM
That's because we are replacing an url with text.

Use this one.

Suki, don't forget to bring $user_info into the function's scope.

Suki

Oh yeah, good old globals, I always forget those.

Actually, instead of modifying the tag directly, let's use the buffer instead, use this one
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Android4Life

with this in there, I get

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

on every page.
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

Android4Life

Also could you make it 2 post instead of 10? I tried, but it didn't work. Thanks, I really appreciate!
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

Android4Life

Also like an idiot I didn't back up the original so does anyone have that?
Thanks to Frank with GC Webhosting for giving me the best hosting I could ask for!
Best customer support you could ask for!

Marcus Forsberg


Advertisement: