Description
The Firebase for WordPress Plugin will help a Firebase user to login to your WordPress interface – not to WordPress dashboard – from Firebase authentication. You can show user info and display data that is only available to your Firebase users.
Get 57 firebase WordPress plugins, code & scripts on CodeCanyon. Buy firebase WordPress plugins, code & scripts from $9. From now, if you use the plugin authentication shortcode, users will be created in WordPress & Firebase at the same time. You can try the process at the Demo Shop.You can follow to checkout page, the sample product is an abook that I wrote. Using login form shortcode, users can enter their Firebase credentials to login into the WP site, and using the registration form shortcode, users can register into the WordPress site, and that user is also auto created in Firebase with an email address and password. Since v0.17.0, you only need to update security rules on your database (realtime / firestore), so any can write to your database or they have to log in before saving.It totally depends on the firebase security rules. Note: if you use ‘Contact 7 Redirect’ feature, it may not work properly because the redirect may interfere with the sync process.
If you want a secured implementation, with much more features, check the Interate Firebase PRO version.
Links
Installation
If installing the plugin from wordpress.org:
- Upload the entire
/integrate-firebase
directory to the/wp-content/plugins/
directory. - Activate Integrate Firebase Plugin through the ‘Plugins’ menu in WordPress.
- Profit.
FAQ
What can I do with this Integrate Firebase plugin?
At version 0.6.1, the user can integrate Firebase authentication to WordPress. That means you can:
- Log in, log out and show custom data only to logged in users.
- Get Real Time and Firestore database in Dashboard
- Show realtime database on frontend after users log in
How can I put a shortcode in a widget or WordPress editor?
The example in this guide only shows you how to put in a PHP file. If you want to put the shortcode inside a widget or editor. You can simply do this:
[firebase_login][/firebase_login]
How can I add a login form to WordPress?
After adding Firebase credentials from Settings > Firebase. You can add login form through shortcodes:
echo do_shortcode(“[firebase_login]”);
Beerbongs and bentleys album download zip. If you want to create your own form. Please start with *
<
form id=’login-form’>*. For submit button, you have to add ‘firebase-form-submit’ as an ID.
How can I show user info after login?
You can add a shortcode to show user’s info
echo do_shortcode(“[firebase_greetings]”);
How can I show error when a user cannot login?
You can show error message when a user cannot login by using a shortcode
echo do_shortcode(“[firebase_login_error class=”your-class-name”][/firebase_login_error]”);
How can I show data for a not logged in user?
You can put your data as an HTML code inside a shortcode
echo do_shortcode(“[firebase_show_not_login class=”your-class-name”]YOUR HTML CODE[/firebase_show_not_login]”);
How can I hide or show data for a logged in user?
You can put your data as an HTML code inside a shortcode
echo do_shortcode(“[firebase_show class=”your-class-name”]YOUR HTML CODE[/firebase_show]”);
How can I show realtime database for a logged in user?
You can put your data as an HTML code inside a shortcode. Realtime data will be shown as a table with an id #if-realtime.
echo do_shortcode(“[realtime class=”your-class-name” collection_name=”string” document_name=”string”]”);
How can I log out?
This is a shortcode for log out button.
echo do_shortcode(“[firebase_logout]”);
Reviews
If your Contact7 is >= v.5.2, please use update this plugin to the latest version (>= v1.5.0).
In this guide, I will show you how to add new data to Realtime database Firestore. In this example, I use Contact Form 7, but you feel free to design your own form or use other plugin.
The reason that I use Contact Form 7 is because it’s the most popular form in WordPress plugin. It is well supported and highly customisation. You don’t have to worry about form validation or email handling after submitting a form.
If you decide to create your own custom form, remember to add “if-create-data-form” as an ID to your form, together with the hidden fields below.
Prerequisite¶
Since v0.17.0, you only need to update security rules on your database (realtime / firestore), so any can write to your database or they have to log in before saving. It totally depends on the firebase security rules.
Note: if you use ‘Contact 7 Redirect’ feature, it may not work properly because the redirect may interfere with the sync process.
Getting Firebase UID value¶
If you want to get the Firebase UID to any inputs as a value. You can add a special class getFirebaseUid to the input fields.
Wordpress Firebase Push Notifications
Example of creating new form and writing data to Firestore¶
Sample of data that I will use to update to Firestore
The createdAt field will be added automatically for sorting purpose.
From that you can create a sample form in Contact tab. The hidden fields are important.
- [hidden collectionName “users”] -> collection name is users.
- [hidden documentId “your-document-name”] -> it will override the document id 1. This field is optional.
- [hidden databaseType “firestore”] -> data will be saved in firestore.
- [hidden arrayType “hobbies,food”] -> array data should be added to arrayType field. This field is optional.
- [hidden dateType “dateOfBirth”] -> will save as ISO string type. This field is optional.
- [hidden mapTypes “contact”] -> will save a map (object) type
- [hidden integerTypes “age,phone”] -> will save as integer type
- [hidden formAction “UPDATE”] -> This option is DEPRECATED.
The default option is to upsert data to firebase. If the node / id does not exist, it will create a new one; otherwise, it it update the existing data.
The shortcode will be added to the WordPress page or post. With the id: “if-create-data-form”. The id is important in order for the plugin to save the data to firebase.
Sample form on frontend
After submitting, data will be saved to Firestore
Example of creating new form and writing data to Realtime¶
If you want to save data to Realtime database, the only thing that you need to change is the databaseType hidden field.
If there form is valid, the data will be saved to realtime database
Xt1643 frp. Data saved to realtime
Firebase Hosting Wordpress
Addition Settings¶
Firebase Wordpress Hosting
Contact form 7 comes with extra configurations. If you don’t want to send a confirmation email to customers, you can this line to the addition settings.