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.

Integrate Openfire registration to Gravity Forms

  1. Hi,

    I want to integrate wordpress and openfire user registration using Gravity Forms on wordpress. I have created a registration form and try to hook the registration to openfire, but nothing happened. All I need is to send a HTTP_POST to Openfire server using the following format :

    http://example.com:9090/plugins/userService/userservice?type=add&secret=bigsecret&username=kafka&password=drowssap&name=franz&email=franz@kafka.com

    I have created a code according to the gform_after_submission tutorial (http://pastebin.com/d5QX5wgH). But I'm not sure if the code is correct, and where to put the code in to. I've tried to paste it to form_display.php and theme's functions.php, which cause both stop working.

    Can anybody help me on this problem?

    Posted 11 years ago on Tuesday July 31, 2012 | Permalink
  2. You paste that code into your theme's functions.php. Do not modify the plugin files.

    If the site stops working when you paste the code, you've likely pasted it incorrectly, or there is a syntax error. I assume "stop working" means you get a blank white screen in your browser?

    I'm not sure if it is your paste here which contains the error or if this is the actual code you're using, but line 4 contains a syntax error at the end.

    Your URL example here is a GET request, but in your code, and in the paragraph here, you describe it as a POST. Can you clarify which way it needs to be done? We can help you with the code after that. Do you have a link to the documentation showing how this should be done? Thanks.

    Posted 11 years ago on Tuesday July 31, 2012 | Permalink
  3. Ah, I notice a typo at line 4 of my code there.

    Here is the documentation of openfire about it :
    http://www.igniterealtime.org/projects/openfire/plugins/userservice/readme.html

    All we need is whenever a user register to our site, we will automatically create a xmpp user account for them using the same credentials.

    Btw, is it possible to send a confirmation email before activating the account by using the registration form from GF?

    Thanks

    Posted 11 years ago on Wednesday August 1, 2012 | Permalink
  4. No solution for this problem?

    Posted 11 years ago on Friday August 3, 2012 | Permalink
  5. You're right to use the gform_after_submission hook. You're not constructing the URL properly though, and you have an error on line 4 as you saw. You're also using WP_Http to send a POST when you just need a GET according to the documentation. These items are not related to Gravity Forms and are PHP and WordPress functionality. We can help point you in the right direction but we can't do the work for you.

    I would focus on getting the $post_url correct, integrating the values entered into the form into the URL you are going to send to openfire. Just echo it rather than trying to call it with WP_Http. Once you have the URL correct (loading it in a browser should add the user as you expect) then you can use WP_Http to GET the URL. The WP_Http call will look more like this, rather than as you have done it with POST body variables.

    // construct $post_url before calling WP_Http
    
    // WP_Http stuff
    $request = new WP_Http;
    $result = $request->request($post_url);
    $json = $result['body'];
    // do something with your result if you like
    Posted 11 years ago on Friday August 3, 2012 | Permalink
  6. Please take a look at the revised paste: http://pastebin.com/WxvzziPi

    You might have to URL encode the & and equal sign, but you can try it like this at first. I think you might also have to change the "secret". Let us know how it goes.

    Posted 11 years ago on Friday August 3, 2012 | Permalink