Hiya,
Just posting this in case it is of any help to people out there. This is a very very basic plugin that I created for a site that I am currently working on. It works in conjunction with an SAEF and all it does is allows you to restrict how many entries users are allowed to post.
The plugin as said above is exceptionally simple. I may (if I ever get the time) update this so you can set different amounts of entries per user or per member group but at the moment it is one amount for everybody as that is all I needed on the site I am creating.
It is exceptionally simple to use and was exceptionally easy to make. I hope that I haven’t done anything silly in there but as always please do check it out on a non-live site before trusting it to your data. It shouldn’t hose anything due to the way in which it operates but just be careful never-the-less! 😊
Hope it helps someone out there.
Best wishes,
Mark
USAGE : Put this tag pair around the Stand-Alone Entry Form to check if the user has reached their maximum amount of posts. {exp:maximum_posts_reached entries="2"} {if maxed_out} FAILED!! {if:else} Yay!!! This is allowed! {/if} {/exp:maximum_posts_reached} The entries=”20” parameter is the only parameter and is a required value and sets how many entries users can post at any one time. If they try to post any more than this number then the form won’t show.
Also I must bring in a disclaimer here and say that this plugin must not under any circumstances be used to allow a blog site to be set up. You must still operate this plugin within the EE licensing regulations.
Hi there sajwal,
As mentioned above I don’t really have the time at the moment to take this any further as it was just something I created in about 3 minutes for a site that I am working on and I thought it might be nice for people to use.
Member groups would be nice but I think it would have to also tie in on the user side of things as well anyway because if I said only 10 posts for say a ‘Publishers’ group and you had 20 users in the group then only 10 of them would be able to post once! 😊
To be able to do proper member groups would mean that it would have to check the user out to find out what member group they are in first and then apply that to them. Not really something I have time for at the moment I’m afraid.
Also I must bring in a disclaimer here and say that this plugin must not under any circumstances be used to allow a blog site to be set up. You must still operate this within the EE licensing regulations.
Best wishes,
Mark
Hiya,
As a quick update I did a really (and I mean really) quick test of this as an extension would take me a while to code so I was thinking this could be handled quite simply with some conditionals and an embedded template.
Step One Create a template called embedded-saef using the standard SAEF code.
Step Two Create a template called SAEF and have the following code in it :
{if member_group == "1"}
{exp:restrict_entries entries="30" error-template="error-templates/maximum-entries-reached"}
{embed="embedded-saef"}
{/exp:restrict_entries}
{/if}
You can have as many of these on the page as you like and all that needs to change is the {if member_group == "1"} part and then the related entries=”30” part for each member group.
This will use a conditional on the member group of the person logged-in and then spit out the form with the restrict entries plugin used at a different level for each member group!! 😊
Simple yet effective!
As I don’t have time to create the extension at the moment then hopefully this will help some people out somewhere along the line? Also not fully tested but I don’t see why it would fail for any reason.
Hope this helps.
Best wishes,
Mark
Mark, may I recommend renaming this? There is a restrict entries extension and it’s probably best to avoid confusion. =)
Cool plugin, though. You should submit it to the addon library, or at least add it to our wiki plugins page. =)
Hi Lisa,
Updating now. Will re-attach new file to top post once done. Will be a while as just taking some time out watching a film! 😊 Sorry about the copyright and credits but I thought that we had to credit EE when making plugins and the such but will change this now.
Best wishes,
Mark
P.S. I will add it to the wiki plugins page also and try submitting it to the addon library but it really is quite simple so not really sure if it deserves a place there or not?
Finally got the post to update. New version with new name at top post! 😊
Hmm,
I have tried ten times now to update the attachment to the original post above but I can only succeed in updating the text and not the attachment. The forums just time-out on me every single time so I am attaching the file to this post instead.
Maybe someone could come up with a better name than I have done for this? Naming is not my strong subject 😊
Best wishes,
Mark
Updated and now submitted to the wiki plugins page also.
Hope it helps people out.
Best wishes,
Mark
Hi Mark I played around with the plugin but its giving me an error if i use the following tags
{exp:maximum_posts_reached entries="2" error-template="error-templates/maximum-entries-reached"} Stand-Alone Entry Form code here… {/exp:maximum_posts_reached}
Notice: Undefined variable: member_group in /home/domain/public_html/admin/plugins/pi.maximum_posts_reached.php on line 44
and when i tried to embed from a location :
Error The following tag has a syntax error: {exp:restrict_entries} Please correct the syntax in your template.
I am using EE 1.6.0
is it not compatible? Help me please.
Hiya sajwal,
Hmm. Not too sure what that error is as all my plugin does is checks a database table to see if the user has reached the amount of entries set in the entries=”” variable and then either allows the content between the tag pair to be visible or not.
The fact that you are getting the error
Error The following tag has a syntax error: {exp:restrict_entries} Please correct the syntax in your template.
is a little weird as I have now re-named the plugin and all the functions and classes within it. Have you downloaded the new version from the top post here in this thread?
If not then you are probably using the wrong call to the plugin. I would suggest downloading the plugin from the top of this thread and then using the code written at the bottom of the top post also.
I must admit that I haven’t tested this on anything less than 1.6.1 so I am not sure as to whether it will work or not on that system but I have followed the same sort of methods as for other extensions and as per the documentation so perhaps that is for the latest version of EE and the plugin calls and syntax have changed since then but as I only just started making any kind of plugins at V1.6.1 then I’m afraid I don’t know about that.
I think the best thing to do would be to download the plugin again from the top post in this thread and then change all your templates code to the code given in the example at the top of this thread. Also make sure to delete the other ‘pi.restrict_entries.php’ plugin from your system or you may be getting problems there.
Hope that helps.
Best wishes,
Mark
Also just this second updated it in case people don’t fill in the error-template variable so it will spit out a standard message instead of throwing an error. This message is set in the plugin though so definitely best to use the error-template variable anyway as then you can place your own message and a link to the edit form if you so desire. A lot more usage in that way then.
Hope that helps.
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.