dalenguyen / firebase-wordpress-plugin

A plugin that helps to integrate Firebase to WordPress
https://firebase-wordpress-docs.readthedocs.io
GNU General Public License v2.0
110 stars 31 forks source link

Integrate Firebase Template issue with pre-existing wordpress plugins #168

Closed Hassankhd closed 3 years ago

Hassankhd commented 3 years ago

Hello Dale!

I remember you suggested that I use the Integrate Firebase Template plugin for my javascript files. I used the plugin to put most of my JavaScript files and tried to load my sign up page but it gave me a weird error in the console about some pre-existing plugins.

Screen Shot 2021-06-18 at 8 37 26 AM

I contacted wordpress support and they told me the problem is with something related to the plugin and so I had to contact you about it. To help you understand where the issue may be coming from, I will show you one of my sign up files and how I'm adding all my files via wp_enqueue_script:

Screen Shot 2021-06-18 at 8 40 33 AM Screen Shot 2021-06-18 at 8 41 44 AM

the class.if-template.php file is in the "public" folder not the "dashboard" folder. I mentioned this because perhaps it has to be elsewhere and I didn't know. If there's anything else you need to know about let me know. Thanks in advance!!

Best regards, Hassan

dalenguyen commented 3 years ago

Hi Hassan, it's likely that you missing a ")" in your script. The other errors belong to Jetpack.

Hassankhd commented 3 years ago

Hi Dale,

I just fixed the issue as well as most of my errors, but I'm getting this error from the onauthstatechanged function:

Screen Shot 2021-06-20 at 8 49 44 PM Screen Shot 2021-06-20 at 8 50 15 PM

Here I'm trying to get the uid of the currently signed in user to perform the vast majority of my firebase functions, but apparently the logged in user is always being undefined, although the sign up/log in process is working and user info is being stored in firebase successfully. Is there anything I'm supposed to add in the sign up/log in pages to guarantee that the onauthstatechanged functions in other pages fetch the logged in user? Please let me know what I can do in this case. Thanks in advance!

dalenguyen commented 3 years ago

Can you add this one after the condition?

console.log(user)
Hassankhd commented 3 years ago

Here's what I got:

Screen Shot 2021-06-20 at 9 57 35 PM

I can see the user's uid here okay. Should I just write user.uid instead of user.user.uid? I used the latter because I saw something of the sort online as I was learning firebase functions.

dalenguyen commented 3 years ago

@Hassankhd, sorry I was busy today. I guess you found the solution for it?