ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Restricting member posting to a single entry?

May 09, 2008 3:01am

Subscribe [2]
  • #1 / May 09, 2008 3:01am

    Thought Nozzle

    28 posts

    Hey, gang…

    Help!

    I have a site I’m almost finished with, except for (at least) one issue.

    The site allows members to post a kind of plan that others can read.

    Each user is only supposed to post a single plan. I’m using the Maximum Posts Reached plugin on the front page, so the Entry form link is presented only once. I’m also using it on the SAEF, so those who have posted already will see a message.

    The problem is that when a new poster accidentally saves then hits Back to finish, they create a second entry.

    And that means that the next time the log in, they’ll only see the first, incomplete entry.

    So I need a way to restrict posting to a single entry under all circumstances if possible, but in particular, in a Back button situation.

    I was thinking I might be able to use some Javascript that sets a variable on submission, but would the var be reset when the user hits Back?

    no-cache doesn’t help either…

    I could really use a solution by tomorrow, Friday.

    Anyone?

    Thanks!

  • #2 / May 09, 2008 5:39am

    Mark Bowen

    12637 posts

    Well you could probably combine my Maximum Posts Reached plugin with my Redirect plugin so that once a person has posted an entry they are re-directed to what would essentially be a third page or you could direct them in other ways too but your problem more stems from the fact that people are using the back button.

    As this isn’t a problem with anything that ExpressionEngine does and just a browser specific issue then the only way I can think of stopping this is if you place some javascript on the page that shows after they have posted their entry so that you kill off the history on the back button so that they can’t go back again. Of course this is not a preferred method as you would effectively be wiping out peoples path on your site, something which I know a lot of people don’t like.

    I think either another page to redirect to so that if they do click back they at least won’t land directly on the form again (although in theory they may press the back button twice or more to get back there anyway) or better instructions on the page to tell people not to do this kind of thing.

    I actually just tried on an SAEF with my Maximum Posts Reached plugin and created an entry and then hit the back button but I didn’t get two entries so not too sure what the problem is on your site with that because the most I would have thought it would do is maybe auto-fill the fields for you but as you haven’t submitted the form again I wouldn’t have thought that you would get a second duplicate entry.

    Don’t know if any of that helps at all though?

    Best wishes,

    Mark

  • #3 / May 09, 2008 2:22pm

    Thought Nozzle

    28 posts

    Well you could probably combine my Maximum Posts Reached plugin

    ...which is already doing a fantastic job…

    with my Redirect plugin so that once a person has posted an entry they are re-directed to what would essentially be a third page or you could direct them in other ways too but your problem more stems from the fact that people are using the back button.

    Exactly.

    As this isn’t a problem with anything that ExpressionEngine does and just a browser specific issue then the only way I can think of stopping this is if you place some javascript on the page that shows after they have posted their entry

    I thought about using JS to insert a “Plan created” message on the page, but IIRC, when you leave and hit Back, the updated content disappears. :/

    so that you kill off the history on the back button so that they can’t go back again. Of course this is not a preferred method as you would effectively be wiping out peoples path on your site, something which I know a lot of people don’t like.

    But that’s worth looking at. I’ve never tried that; will see if I can just kill that single step.

    I think either another page to redirect to so that if they do click back they at least won’t land directly on the form again (although in theory they may press the back button twice or more to get back there anyway) or better instructions on the page to tell people not to do this kind of thing.

    I think you may have hit on it… The return= page would have the instructions saying “Your plan has been created! Please don’t use your Back button to edit your plan. To edit, click here.”

    I actually just tried on an SAEF with my Maximum Posts Reached plugin and created an entry and then hit the back button but I didn’t get two entries so not too sure what the problem is on your site with that because the most I would have thought it would do is maybe auto-fill the fields for you but as you haven’t submitted the form again I wouldn’t have thought that you would get a second duplicate entry.

    The problem situation is this—The user hits Save (or Enter if they’re on a nasty browser) and the post is created. Then they decide they want to edit their plan, so they hit Back. This returns them to the SAEF. When they’re finished “editing”, they hit “Save” and a new entry is created… Except they think they only edited their original plan.

    Which brings me to another helpful thought—I’ll change the Save button to say “Create my new Plan” and add some other language that makes it clear they’re creating something new.

    Don’t know if any of that helps at all though?

    Sure did!

    Thanks!

  • #4 / May 09, 2008 3:06pm

    Mark Bowen

    12637 posts

    Well seems like you have it all sorted 😉

    If you do want to try out the killing off of the browser history then you can do so using this code below :

    index.html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html charset=utf-8" />
    <title></title>
    <style type="text/css">
    <!--
    html {
    font-size: 62.5%;
    }
    
    body {
        color: #666666;
        font-size: 1.2em;
        font-family: Arial, "Lucida Grande", Verdana, sans-serif, Helvetica;
        background: url(images/header-backing.jpg) repeat-x;
        margin: 0;
        padding: 0;
        text-align: center;
    }
    
    #wrapper {
        margin: 0 auto;
        width: 950px;
        text-align: left;
        /* border: solid thin red; */
    }
    
    a {
        text-decoration: none;
    }
    
    a:hover {
        text-decoration: underline;
    }
    -->
    </style>
    
    
    <sc*ipt type="text/javasc*ipt" language="JavaSc*ipt">
    <!--
    function To(url) {
    location.replace(url);
    }
    //-->
    </sc*ipt>
    
    
    </head>
    <body>
    <div id="wrapper">
    <a href="http://javascipt:Tohistory.html">Click Here!</a>
    
    </div>
    </body>
    </html>

    You’ll need to change the *‘s above to r’s instead as the forums here are stripping the javascript code from showing correctly

    history.html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html charset=utf-8" />
    <title></title>
    <style type="text/css">
    <!--
    html {
    font-size: 62.5%;
    }
    
    body {
        color: #666666;
        font-size: 1.2em;
        font-family: Arial, "Lucida Grande", Verdana, sans-serif, Helvetica;
        background: url(images/header-backing.jpg) repeat-x;
        margin: 0;
        padding: 0;
        text-align: center;
    }
    
    #wrapper {
        margin: 0 auto;
        width: 950px;
        text-align: left;
        /* border: solid thin red; */
    }
    
    a {
        text-decoration: none;
    }
    
    a:hover {
        text-decoration: underline;
    }
    -->
    </style>
    </head>
    <body>
    
    <div id="wrapper">
    
    No back button
    
    </div>
    </body>
    </html>


    This will actually do what you need without deleting the rest of the persons history (I think so anyway).

    See if that’s any use maybe?

    Best wishes,

    Mark

  • #5 / May 09, 2008 3:13pm

    Thought Nozzle

    28 posts

    This looks exactly like what I would need.

    Thanks for beating me to it, Mark!  😊

    And thanks for going above and beyond!

  • #6 / May 09, 2008 3:19pm

    Mark Bowen

    12637 posts

    No problem. Any time I can lend a hand.

    Best wishes,

    Mark

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases