PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Register OR Login: looking for a solution

  1. bluantinoo
    Member

    Hi everyone,
    I'm new and this is my very first topic, so please don't yell on me :)

    I'm building a 3 steps form for selling a service that is customizable.

    In my plans it sould be done like that

    1 Step: configure the product
    2 Step: Register OR Login
    3 Step: checkout and payment

    I've been able to achieve all, except the login part.
    Reading the forum I've realized that login functionality is not (Yet?) implemented on GF

    So I've looked for 3rd part login solutions and found this plugin for ajax login function:
    - Login With Ajax http://wordpress.org/extend/plugins/login-with-ajax/
    With that you can show a login block that logs users without refreshing the page.

    Then I've tried to make a condition in GF form to make users choose if they have an account or not (in the 2nd step I've mentioned before)

    if the user DOES NOT have an account I show all fields that I've mapped with user registration addon, and it's working.

    if the user DOES already have an account, I show an HTML GF block where I put the shortcode for ajax login block.

    It looks like I'm not too far from solution, but ad this point I have 3 different problems:

    1) the login block is not shown where it should, I mean: not in the HTML BLock i put in GF form, but BEFORE GF form, so it shows at the top of every form step (and not just in the 2nd)
    (I will ask about this to the ajax login plugin author as well)

    2) GF does not understand that a users is logged.
    I mean: I've set the GF module NOT to USE AJAX, so that for each step the page is reloaded. In my ideas if in 2nd step I make users login with that ajax plugin, in the 3rd step they should be logged.
    BUT is not like that: the entire wp site understands that user is logged (admin bar is showed, for example) but GF module not.
    I control if a user is logged using this simple trick http://gravitywiz.com/2012/03/07/gravity-forms-conditional-logic-based-on-user-login/

    3) Assuming that everything will be allright, how can I relate the form entry to the logged user that has entered it?

    you can have a look at it at this address
    http:// sviluppo.idearia.it/riparaiphone/ ?page_id=2
    (i've broken the url because it's just a test site and I don't want to be linked or crawled)
    --------------------

    If i'm totally wrong and this cannot be done, what would be the best practice for doing this?

    Posted 10 years ago on Friday August 3, 2012 | Permalink
  2. (I will ask about this to the ajax login plugin author as well)

    Please do that. If that is not the issue, please be sure all the HTML you have added to the form is valid. If not, the fields can appear in the wrong order, just like this. I did not see the AJAX login box in the form at all, and I didn't know I needed to be logged in or create an account. I made it all the way to the end where I could have checked out, but I did not. Is that as expected?

    Why not require that the user be logged in before they can access the form? There is a check box on the advanced tab of the form settings which says "Require user to be logged in." If you check that box, the form will not show, and you can show an alternate, registration form, instead (the "Require Login Message" will accept a shortcode, and you can put the shortcode here for your registration form.)

    Does handling things in that order take care of any of your issues? You have a lot of issues so we have to work through them one at a time.

    Posted 10 years ago on Saturday August 4, 2012 | Permalink
  3. bluantinoo
    Member

    Hi Chris,
    thanks for reply.

    Why not require that the user be logged in before they can access the form?

    Actually I don't want to limit access to the form for logged users.
    We made split tests and putting this kind of actions AFTER service/product cofiguration step pushes conversions quite a lot.
    So, allowing any user access to module is essential.

    I did not see the AJAX login box in the form at all

    Sorry, I was surely working on it when you've seen the site... and as I did fall asleep in front of the pc (!) maybe it was deactivated or I wasn't using it.
    I will set up right now the config I've spoken above, and give you (via PM?) admin access, so you could have a look if you want. I will even set english language so you will be more confortable.

    please be sure all the HTML you have added to the form is valid

    I'm very sure that I've included it well, it was just an HTML block with a custom made shortcode calling a php template function.
    Actually I've tried even others plugins in the same way, and every one was rendered BEFORE the GF module, and not where I did put it... maybe it's just an early php printing issue.

    ---

    Assuming that I can find a way to show an ajax login function inside an HTML field of GF module, I still have a basic problem: even if the user logs in, the next non-ajax step of GF module does not recognize the user logged. It has to log BEFORE the first step of the module, even it's divided into non-ajax steps (using page breaks fields).
    Maybe it's just that the entire form is already stored in an object, and it does not get updated passing from a step to another, even not using ajax?

    Posted 10 years ago on Saturday August 4, 2012 | Permalink
  4. bluantinoo
    Member

    I have an update about the wrong position of the rendered login block.

    I've tested that if the shortcode used inside HTML field calls a functions that echoes html it will be printed at screen BEFORE the GF form.

    On the contrary, if the shortcode does not echoes, but returns a variable (containing the html) it will be printed in the right place.

    Now, I could try to edit that plugin (or make some custom one) trying to return the block instead of echoing it.

    But I still have a 2 foundamental obstacles.
    Even if I do login via ajax, let's say in step 2:
    1) How can I make that page reload at that second step, without loosing the already entered infos in previous step?
    2) HOw can I load logged user datas (from user meta) and populate with them GF fields?

    Posted 10 years ago on Saturday August 4, 2012 | Permalink