• Welcome to Simple Machines Community Forum. Please login or sign up.
January 21, 2022, 06:52:56 AM

News:

Want to get involved in developing SMF, then why not lend a hand on our github!


Restrict Access Until Post

Started by TechnoDragon, April 04, 2007, 02:46:02 PM

Previous topic - Next topic

TechnoDragon

Link to Mod

I had been trying to figure out a way to make it so that members of my forum would not have access to certain parts until they posted (mainly because they would make the initial posts to get access upon registration, but then would never post again)  So I came up with this.  This is actually a recode of the post count warning mod.

After install you will need to add the code below per the instructions to make this work right>

This will add the ability to enable/disable the post count restriction not just through admin, but allow you to also restrict ANY page you want if you add this code to the template file.  To do this add this code to the main source file for the section of the forum you want to restrict right after the brace ( { ) after the initial function call in the source directory file (example would be smf shop initial function call in the shop.php is function shop () { ) the code below goes right after that:

     global $sourcedir;
  // If it is sunday allow everyone on.
require_once($sourcedir.'/RestrictAccess.php');
if ($context['user']['is_logged']){
echo RestrictAccess(2);
}


The additional beauty of this code is it shows a warning box on every page your members go to remind them they need to make their posts, I have made the number of post perday changeable in admin as well as the ability to change the day of the week that you can have as your free-for-all day!
Don't tell me to get into shape...I have a shape...It is round!


lockelymarkets

Where do I find it in the admin panel after installation?

TechnoDragon

Quote from: lockelymarkets on April 10, 2007, 08:55:58 PM
Where do I find it in the admin panel after installation?

It is under features and options
Don't tell me to get into shape...I have a shape...It is round!


drazprod

Sorry for my english.
Can you introduce the karma condition ?

Example:

if you have the karma <5, you don't have the permission and the restrict access.

TechnoDragon

That wasn't the point of this mod...sorry.
Don't tell me to get into shape...I have a shape...It is round!


drazprod


linette97

This is exactly what I've been looking for.. I installed it and applied.. but it makes my forum all off ..everything is stretched out.. have to scroll way down to see the main part... ... I'm not using the default theme.. using Leviathan theme.. what can i do to fix this?? thanks in advance
Watch Documentaries Online!


Yesterday is history,
Tomorrow is a mystery,
Today is a gift,
That's why it's called the Present.

Joshsux

line, i'm not using it but it must be because the message is bigger than your template, the easiest way for me to explain here is go into the edit file "i don't have the mod here so i don't know what it would be" and find where it has the width and height for the message, you should be able to make it shorter, meaning it will be in your template better.

Another thing you could do is move it to another part of your theme editing the template.php file.
If you can't hear it before you see it, then it ain't a harley

Valodim

Quote from: TechnoDragon on April 04, 2007, 02:46:02 PM
I had been trying to figure out a way to make it so that members of my forum would not have access to certain parts until they posted (mainly because they would make the initial posts to get access upon registration, but then would never post again)

What's the matter with postgroup permissions? They do the job just fine...

SpelingMistakes

Is it possible to look almost whole weak without notice and only one day with notice – Just to remember people not to forget to post?

Spel
There is a huge difference between living and being alive!

CommonCents

The "main source file" thats the index file correct?

0mExIcAn

Please help me!

I dont know how to put in the code...

I am new and I dont know where to put it...

This is the code I am supposed to put in right.

//Otherwise annoy them to post daily!
// If post count is less required let them know!!
$memberResult = loadMemberData($ID_MEMBER, false, 'profile');
list ($memID) = $memberResult;
$date = @getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']) - ($modSettings['time_offset'] * 3600);
$query = db_query("
SELECT COUNT(ID_MSG) AS 'msgCount'
FROM {$db_prefix}messages
WHERE ID_MEMBER = '$memID' AND posterTime >= '$midnight'", __FILE__, __LINE__);
$result = mysql_fetch_assoc($query);
$posts_per_day = $result['msgCount'];
$restrictaccess = $modSettings['DayOfTheWeek'];
$dotw = date("w");
// If it is sunday allow everyone on.
if($dotw != $restrictaccess)
{
// If post count is less that 3 per day deny!!
if(($context['user']['is_logged']) && ($posts_per_day < $modSettings['MinReqPostCountRestrict']) && ($modSettings['restrictaccess'] == '1'))
{
echo '
<table align="center" style="width: 100%; padding: 20px; text-align: left; vertical-align: middle; margin: 2ex 1ex 2ex 1ex; border: 2px dashed ', $modSettings['PostCountWarningBorderColor'],'; background-color: ', $modSettings['PostCountWarningBackgroundColor'],';">
<tr>
<td width="64">
<img style="vertical-align: middle;" src="'.$settings['images_url'].'/pcWarn.gif" alt="Attention!" />
</td>
<td style="color: ', $modSettings['PostCountWarningTextColor'],';">
<strong>', $modSettings['PostCountRestrictMessageTitle'], '</strong><br />', $modSettings['PostCountRestrictMessage'], '
</td>
</tr>
</table>
';
} // End restrict low posts
} //end free-for-all

0mExIcAn

Nobody can help?

This site is huge!

And nobody cant help me?

0mExIcAn


Guy Verschuere

August 08, 2007, 02:34:29 AM #14 Last Edit: August 08, 2007, 06:58:03 AM by guyverschuere
Hey,

I've put the code in 'downloads.php'
The message shows up saying I don't have a post yet for that day, but stil I see the rest of the page and I am able to download.
What's going wrong?

edit: can I link this to some parts of the profile? ex If a member doesn't fillin it's location, that the warning shows?

Thanks
Guy

leomai

would this work for 1.1.3?

i have try it this is what i got

Parse error: syntax error, unexpected ',' in .../index.template.php on line 207

Guy Verschuere

it works in 1.1.3

The parse error is because you mistyped something.

wmiles

Sorry i would like to know where to put the code in the first post. I have installed the mod and i can see the options in Admin Panel, but i cant see how i can restrict a board within the forum

Thanx in advance

PandoraBizkit

Hi there,

I think I have the same issue with this mod.  It's installed but I can't find out how to restrict access to simply one board.  I don't want a post count on all the boards, only on one, I thought the info with the mod said that this was possible?

Thanks for any help that comes from this post.

PandoraBizkit.  :)
Just live it!

PandoraBizkit

Well........I have to say that I'm really surprised there has been no replies to this.  I'm sure we are not the only people having issues with it and surely it's better to iron out the kinks?

The main thing I have always reccommended SMF to people for is the support that is always readily available.  Sadly, not so on this thread.
Just live it!

Advertisement: