Best Option for Wordpress Form That Updates External MySQL Database Table? - wordpress

I have a Wordpress site that I need to place some forms on that when submitted the form data is updated in an external MySql database of an in-house business system.
Obviously you could customize the PHP form handler of whichever form plugin you choose, but I would imagine in most cases this is not plugin 'upgrade safe'
The other option would be do develop the form (and handler) outside Wordpress and include it in an iFrame on a Wordpress page. This is a clunky solution though in my opinion as I think iFrames should be avoided whenever possible.
IDEALLY, there's a really robust form plugin out there that has taken these things into consideration and allows modular update of external databases by specifying database credentials and what form fields you want to map to which tables and fields. Or at the least provide an option of an include file for any custom post processing of the form data that is upgrade safe.
What are the best options?

Related

Reading/writing to the WordPress database using WordPress and Javascript

I am working with a client who is using WordPress. I am not familiar with WP like I am with other frameworks. In this situation, the client wants to allow users to enter data into a form and I will create pages to display this data so it can be managed. I am thinking I need to get the user entered data saved into a table. I will then read from this table to display in another page. I need to do CRUD stuff within WP with JavaScript.
Are there plugins that will allow me to create tables within the WP database? Can I use JavaScript to read/write to them, or do I need to use PHP? I don't have access to the source code so I am doing everything via the functions.php and JS files.
Because I don't have much experience with WP, I am not sure what can be done. Thanks for any suggestions.
While it's definitely doable programmatically, I don't see much reason in recreating the wheel. Perhaps Contact Form 7 would work for you. If not, Gravity Forms can do what you need, but I believe there is a cost for that.

Wordpress retrieving data from Cakephp

I run a website where I have both Wordpress and Cakephp installed in the same domain.
Cakephp is the administrative backend to maintain and create business listings (like the yellow pages).
Wordpress is the front end for the public website.
I'm creating custom Wordpress templates to display the business listings from Cakephp, but am not sure how Wordpress is going to retrieve data from Cakephp.
I already have a bunch of Controller Actions that return json array with data that I would like to call from Wordpress. I don't want to duplicate in Wordpress data retrieval code that I've already written in Cakephp. But i'm not sure how in Wordpres would i make calls to these Cakephp Controller / Actions.
What is the recommended / best way to have Wordpress retrieve data from the Cakephp backend given at they are on the same domain? What other options do i have?
What is the recommended / best way to have Wordpress retrieve data
from the Cakephp backend given at they are on the same domain? What
other options do i have?
Access the DB directly, I'm not sure how to do that with Wordpress fugly API and code, but I'm pretty sure you can instantiate a new DB object with a connection to the CakePHP apps database. The WP API documentation will tell you how to do it I guess, if not it sucks more than I thought.
An alternative would be to expose the data via a RESTful service and consume it from Wordpress. If you return JSON you could even simply use a JS widget on a WP page to retrieve and render the data with pure JS.
As burzum suggested you have 2 real options.
WordPress does have a class for interacting with a DB called WPDB and will give you access to a few ways of querying the data in your CakePHP app. WordPress WPDB Class. It is by no means perfect but will do the job.
However you much better creating a custom WordPress plugin to parse and format the JSON as burzum suggested interacting via your own API. You could then if needed make this a 2 way communication allowing your WordPress install to make changes as necessary to yoru Cake app.

Is it possible to save my Form Data into a database in Wordpress

I am putting my forms on a Wordpress page, and was wondering if it was possible to save the data in a database in Wordpress. Would this be possible ?
Yes it would be possible.
It entails using either WordPress core functions such as:
wp_insert_post
wp_insert_attachment
Or the WordPress DB class and writing your own SQL INSERT queries:
wpdb
In either case you need to add your own form processing logic -- taking form variables and organizing them into the correct parameters required by the WordPress post structure -- as well as your own access-control logic -- checking which user is submitting this form and if he is allowed to do so.

Wordpress to use Drupal users' credentials

I have both Wordpress and Drupal installed on two domains. I want the users that register via Wordpress to be stored in Drupal's user table. Also, any login attempts should be checked against Drupal's database.
I don't have a lot of experience with either (though I'm fairly confident in my PHP skills). I am not looking for a way to mirror the users, but to actually tell Wordpress to use Drupal's database.
I think I have to rewrite the login and register methods on Wordpress. Am I wrong? And what's the best way to do this? (what files do I need to go into)?
You wouldn't want to tell Wordpress to use Drupal's entire database as it'll just create a lot more headaches. You're better off loading something like Drupal's boostrap and attempting to call the registration functionality, this again would cause more issues.
Is there a particular reason preventing you from using one system? Migration plugins/modules exist for both CMS'.
I'm sure others have come across the same issues.
http://wordpress.org/extend/plugins/external-database-authentication/
Wordpress and Drupal SSO/Single Sign On
How to register a user to Drupal 6.x without using the API?

The appropriate way to build a registration form in Drupal?

I just started studying Drupal 7 and learned how powerful CCK and Views are. But it still confuses me a bit because it behaves so differently compared to Wordpress. Now I want to build registration form, is it appropriate to build it using CCK? If so, how do I make it so it would make the login system aware that a new user has registered? Or would it be better and easier to modify the built-in registration system to my liking?
A registration form for... what exactly? The site? An event? RSVP? If this is just to register and post comments or blog articles, then use the core login system- thats what it's there for. You can add fields to this form by enabling Profile module and adding fields to capture more data about the user.

Resources