1 of 3
1
NEW - Maximum Posts Reached plugin…
Posted: 28 January 2008 07:12 AM   [ Ignore ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

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! grin

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.

File Attachments
pi.maximum_posts_reached.php.zip  (File Size: 2KB - Downloads: 352)
 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 28 January 2008 07:38 AM   [ Ignore ]   [ # 1 ]  
Grad Student
Avatar
Rank
Total Posts:  60
Joined  09-02-2006

You are a darling…...I will check this out tonight and be back if something needed!!!

I WISH YOU CAN WORK TO RESTRICT IT PER MEMBER GROUP BASIS ... SO AS IT MAY HELP IF PAID MEMBERSHIPS ARE GIVEN ON THE BASIS

Profile
 
 
Posted: 28 January 2008 07:53 AM   [ Ignore ]   [ # 2 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

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! grin

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 28 January 2008 11:07 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

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!! grin

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 28 January 2008 11:10 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  60
Joined  09-02-2006

You are the man…..thanx buddy….I am sure this is gonna work out….I didnt notice ur last post ....but hey….You made my Day…. grin

Profile
 
 
Posted: 28 January 2008 11:16 AM   [ Ignore ]   [ # 5 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006
sajwal - 28 January 2008 11:10 AM

You are the man…..thanx buddy….I am sure this is gonna work out….I didnt notice ur last post ....but hey….You made my Day…. grin

Glad to have been of assistance! grin

Hope this helps some other people out too.

Good luck with your site.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 28 January 2008 01:30 PM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32911
Joined  05-14-2004

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. =)

 Signature 
Profile
MSG
 
 
Posted: 28 January 2008 01:31 PM   [ Ignore ]   [ # 7 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32911
Joined  05-14-2004

oh, and you should update the copyright and credits…. =)

 Signature 
Profile
MSG
 
 
Posted: 28 January 2008 02:06 PM   [ Ignore ]   [ # 8 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

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! grin
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?

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 28 January 2008 02:18 PM   [ Ignore ]   [ # 9 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

Finally got the post to update. New version with new name at top post! grin

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 grin

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 28 January 2008 02:28 PM   [ Ignore ]   [ # 10 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

Updated and now submitted to the wiki plugins page also.

Hope it helps people out.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 29 January 2008 04:07 AM   [ Ignore ]   [ # 11 ]  
Grad Student
Avatar
Rank
Total Posts:  60
Joined  09-02-2006

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.

Profile
 
 
Posted: 29 January 2008 04:25 AM   [ Ignore ]   [ # 12 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 29 January 2008 04:30 AM   [ Ignore ]   [ # 13 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

Hiya sajwal,

As a quick update I have just tested the plugin on V1.6.0 and it all worked fine so hopefully if you download the new plugin at the top of the page it should all work out for you! grin

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 29 January 2008 04:39 AM   [ Ignore ]   [ # 14 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 29 January 2008 05:49 AM   [ Ignore ]   [ # 15 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  717
Joined  07-02-2007

Hey mark, may i suggest something?

I see you have the error-template=”” parameter, but what about a conditional? like:

{exp:maximum_posts_reached entries="2"}
{if maxed_out}
Sorry you have reached your maximum number of entries
, go an purchase more credits!
{/if}
Stand
-Alone Entry Form code here…
{
/exp:maximum_posts_reached}

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 29 January 2008 05:55 AM   [ Ignore ]   [ # 16 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6579
Joined  04-15-2006

Hi Victor,

Yep I suppose that would be better wouldn’t it. I will see about adding this in as soon as I can.
Is it any use to you though?

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 29 January 2008 06:08 AM   [ Ignore ]   [ # 17 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  717
Joined  07-02-2007

Mark just to keep things simple smile...
Don’t like to make an extra template, while the SAEF template itself is already embedded. (like to keep things clean)

No rush tho, Just an suggestion

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
Super Cache (Cache heavy tag output)
reCAPTCHA Extension
Rewrite Module


See all my EE Addons (8)

Profile
 
 
Posted: 29 January 2008 08:45 AM   [ Ignore ]   [ # 18 ]  
Grad Student
Avatar
Rank
Total Posts:  60
Joined  09-02-2006

hi mark….
      I tried all possible ways to get this working but in vain. The same error ... now it shows the error on line 51 .... checked the line 51 in the plugin :

Error
The following tag has a syntax error:
{exp:restrict_entries}
Please correct the syntax in your template.

I also tried installing on local server but same errors….

Mark I rely on you.

Profile
 
 
   
1 of 3
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65032 Total Logged-in Users: 24
Total Topics: 82119 Total Anonymous Users: 18
Total Replies: 441335 Total Guests: 182
Total Posts: 523454    
Members ( View Memberlist )
Newest Members:  d_ananksreekanthcfvicdreamNOIRgmonCooperWrightReedsmeenoiYang.Jianuoioitsuki