We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

NEW - Maximum Posts Reached plugin…

Development and Programming

Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

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

       
sajwal's avatar
sajwal
52 posts
17 years ago
sajwal's avatar sajwal

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.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hiya sajwal,

Please please please don’t rely on me 😊

This was a very quick plugin that I created for a site and not really something that I can offer support for at the moment as I don’t really have the time at the moment but the fact that you are having that same error that you have posted above is very weird as the new plugin at the top of this post does not have that syntax any more. Are you sure you are using the new plugin syntax as shown below :

{exp:maximum_posts_reached entries="2" error-template="error-templates/maximum-entries-reached"} 
Stand-Alone Entry Form code here… 
{/exp:maximum_posts_reached}

Note that the plugin has now changed name and to call it you have to use {exp:maximum_posts_reached} instead of {exp:restrict_entries. Are you definitely doing that in your template because the fact that you are getting the error saying that you are using restrict_entries says to me that you are either still using the old code or the old plugin somewhere along the line.

Hope that helps.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen
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}

Hi Victor,

Excellent thought that you had, just wish I knew how to do this. After a whole day of looking around for a plugin that even had this functionality I have given up as I can’t find a way to create a conditional variable inside the plugin tag. I will have to post on the Plugins Tech Support Forum to find out how to do this unless you or anyone here has an idea perhaps?

Best wishes,

Mark

       
sajwal's avatar
sajwal
52 posts
17 years ago
sajwal's avatar sajwal

I have downloaded the new one … well i am giving a try again and will be back to you….

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Okay no problem.

Just make sure that you delete the old pi.restrict_entries.php plugin from your EE installation and make sure you are using the new plugin code. That should do it for you. I have tested this using EE 1.6.0 and it works fine for me so hopefully should do for yourself too.

Best wishes,

Mark

       
Mr. Wilson's avatar
Mr. Wilson
131 posts
17 years ago
Mr. Wilson's avatar Mr. Wilson

Mark,

Check out $FNS->prep_conditionals(). I haven’t looked in your plugin, but you might use it like:

global $FNS, $TMPL;

$maxed_out = TRUE;
$my_var = 6;
$another_var = 'Abraham Lincoln';

$my_vars = array(
  'maxed_out' => $maxed_out,
  'my_var' => $my_var,
  'another_var' => $another_var
  );

$output = $FNS->prep_conditionals($TMPL->tagdata, $my_vars);

return $output;
       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

Thanks for that. I knew it was something to do with the prep_conditionals bit but just couldn’t really find any strong examples of it in use. Will take a look at this now.

Haven’t seen you in here for a while. Are you busy on new projects?

Thanks again.

Best wishes,

Mark

       
sajwal's avatar
sajwal
52 posts
17 years ago
sajwal's avatar sajwal

Mark you are right the syntax was incorrect …. but now with corrections it gives me

Notice: Undefined variable: member_group in D:\aiyp\admin\plugins\pi.maximum_posts_reached.php on line 51

any suggestions?

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Do you by any chance have member_group=”some number here” in your plugin code?

I did originally place some code in that I was going to use for allowing the plugin to work with different member groups but after seeing that conditionals could do it a lot easier I took this out. Just make sure that the only parameters you have in the plugin call are entries=”20” and error-template=”error-template-group/your-error-template”.

Hope that helps.

Best wishes,

Mark

       
sajwal's avatar
sajwal
52 posts
17 years ago
sajwal's avatar sajwal

if ($member_group == “”){ // Perform the SQL query global $DB;

This is what is on line 51 of the plugin code….

and my saef template is

{if member_group == "2"}

{exp:maximum_posts_reached entries="1" error-template="error-templates/maximum-entries-reached"}

{exp:weblog:entry_form weblog="default_site" return="site/index" preview="site/entry"}

{preview} <h1>{title}</h1>

{display_custom_fields}

{/preview}

<table> <tr> <td>

Title

<input type=”text” name=”title” id=”title” value=”{title}” size=”50” maxlength=”100” onkeyup=”liveUrlTitle();” />

URL Title

<input type=”text” name=”url_title” id=’url_title’ value=”{url_title}” maxlength=”75” size=”50” />

{formatting_buttons}

{custom_fields} {if required}* {/if}{field_label}

{field_instructions} {if textarea} <textarea id=”{field_name}” name=”{field_name}” dir=”{text_direction}” cols=”50” rows=”{rows}” onclick=”setFieldName(this.name)”>{field_data}</textarea> {/if}

{if textinput} <input type=”text” dir=”{text_direction}” id=”{field_name}” name=”{field_name}” value=”{field_data}” maxlength=”{maxlength}” size=”50” onclick=”setFieldName(this.name)” /> {/if}

{if pulldown} <select id=”{field_name}” name=”{field_name}”> {options}<option value=”{option_value}”{selected}>{option_name}</option>{/options} </select> {/if}

{if date} <input type=”text” id=”{field_name}” name=”{field_name}” value=”{field_data}” maxlength=”{maxlength}” size=”50” onclick=”setFieldName(this.name)” /> {/if}

{if relationship} <select id=”{field_name}” name=”{field_name}”> {options}<option value=”{option_value}”{selected}>{option_name}</option>{/options} </select> {/if} {/custom_fields}

Trackback URLs

<textarea name=”trackback_urls” cols=”50” rows=”5”>{trackback_urls}</textarea>

</td> <td valign=”top”>

<input type=”submit” name=”submit” value=”Submit” /> <input type=”submit” name=”preview” value=”Preview” />

{status_menu} Status

<select name=”status”> {select_options} </select>

{/status_menu}

Date

<input type=”text” name=”entry_date” value=”{entry_date}” maxlength=”23” size=”25” />

Expiration Date

<input type=”text” name=”expiration_date” value=”{expiration_date}” maxlength=”23” size=”25” />

Comment Expiration Date

<input type=”text” name=”comment_expiration_date” value=”{comment_expiration_date}” maxlength=”23” size=”25” />

<input type=”checkbox” name=”sticky” value=”y” {sticky} /> Make Entry Sticky <input type=”checkbox” name=”allow_comments” value=”y” {allow_comments} /> Allow Comments <input type=”checkbox” name=”allow_trackbacks” value=”y” {allow_trackbacks} /> Allow Trackbacks <input type=’checkbox’ name=’dst_enabled’ value=’y’ {dst_enabled} />DST Active on Date of Entry

{ping_servers} Ping Servers

{ping_row} <input type=”checkbox” name=”ping[]” value=”{ping_value}” {ping_checked} /> {ping_server_name}

{/ping_row}

{/ping_servers}

{category_menu} Categories

<select name=”category[]” size=”4” multiple=”multiple”> {select_options} </select>

{/category_menu}

</td> </tr> </table>

{/exp:weblog:entry_form} {/exp:maximum_posts_reached}

{/if}


The best thing is that the plugin is still working giving me the error on the very first line of webpage and continuing functioning showing me saef depending upon the entries allowd….just want to get rid of that wierd line Notice: Undefined variable: member_group in D:\aiyp\admin\plugins\pi.maximum_posts_reached.php on line 51

I am so sorry to bother you dear

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi sajwal,

If you re-download the plugin from the first post then I have taken out the member_group line in the code so it should hopefully all work for you now?

Also it would be best to test this without the SAEF first maybe just some text like this :

{if member_group == "2"}
{exp:maximum_posts_reached entries="1" error-template="error-templates/maximum-entries-reached"}
Some text to show if the plugin is working correctly.
{/exp:maximum_posts_reached}
{/if}

Hope that helps?

Best wishes,

Mark

       
sajwal's avatar
sajwal
52 posts
17 years ago
sajwal's avatar sajwal

Mark …. Atlast i got it working ,, there is a little mistake i think, the member_group variable was not assigned in the code….i assigned it

$member_group = $TMPL->fetch_param(‘member_group’);

and tested the plugin …. all perfect….. Mark You cant imagine how badly I needed something like this for my new project to launch……I am really happy…I wish you all success man….

and hey i noticed you are modifying something in this plugin to enhance it?

I did not understand what exactly you & Mr. Wilson were talking about?

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Sajwal,

If you download the latest version from the top post then you won’t have to modify anything as I have taken out the member_group part now although it shouldn’t have been causing problems anyway due to the way I had coded it. It was just in there ready to be used when I needed it. The latest version should work fine now though.

The code that Mr Wilson has shown is for a request that Victor put in. At the moment I am using the error-template=”“ parameter which works fine but it would be even better if instead of that the code could be like below :

{exp:maximum_posts_reached entries="2"}

{if maxed_out}
Sorry but you do not have permission to post any more entries...
{/if}

SAEF form goes here
{/exp:maximum_posts_reached}

This would allow you to keep everything in the one template. I only added in the error-template variable because when I created the plugin for use on my site I wanted all error templates in one place.

Mr Wilson. Thanks for the code above but I have tried everything I can think of to get this into what I already have and I just can’t get it to work. I don’t suppose you could throw any more bones my way could you? 😊

Best wishes,

Mark

       
sajwal's avatar
sajwal
52 posts
17 years ago
sajwal's avatar sajwal

Ohmmm, perhaps thats nice to put something which directs the user to upgrade page….when max post is reached …. But i am happy with this itself ….. still would love to see what comes next… 😉 HUMAN WANTS … U KNOW ! :zip:

       
1 2 3 4

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.