Basically what I need is to return the gender of each friend who is in the feed
The following does not work:
gender is covered by public_profile permission – so you need to get that from every individual user first, before you can access it.
Without those friends becoming users of your app and granting it permission to access their basic profile information, you won’t be able to get this field.
Plus, the gender field will only return a value, if the user has chosen one of the “traditional” settings, male or female. If they entered their own custom value (which Facebook made possible a while ago), then the gender field will just return an empty string.
Related
I have an idea of doing a back office for my website. The problem is that, when I introduce a user who has, for example, two roles, I want the user to choose the role to work with, but I can't figure out how to do that. I've tried so different things such as putting the two roles separate with commas in MySQL and separating them in PHP but it didn't work.
let say you have a user table, and a user can have multiple role.
you can create a master table for role ( let say roles )
you can have a field on user table say user_roles -> it can have values like 1,2,4
note:- there should not be gaps between the numbers / comma
on the front-end you can take a mutiselect / tags UI element to input role for the user.
to fetch the role of a user at server side - you can use explode() + in_array() to check the role if exists
comma separated example
EDIT:-
It requires validation when adding roles ( ie: which user's role is allowed to select when already selected specific types )
For authorization, the user's roles should be added to the session :- this will help when allowing the user to do tasks he is allowed to do.
you can take a third table to maintain user's roles ( as suggested by #ADyson ), this will help if you want to join tables based on user + roles but you will need to join roles table for getting user data when starting session for the user.
Im using Plaid Plaid.com
Im using Plaid's Auth feature to verify account details. I found in the docs that it needs a "user" object while creating an item (asking the legalName and email of the user).
Here is what the doc says:
user (optional) Specify a user object to enable all Auth features.
Required fields are: legalName – your user's legal first and last name
emailAddress – your user's associated email address
Im confused that which user are they asking for? Is it my Plaid account's user. Or the real user in my application (customer) ?
Thanks in advance.
The user object is only necessary if you want to use the additional Auth features such as microdeposits - this would be for the end user (so in your case, the real user in your application/the customer).
I am developing a web app which uses Firebase Authentication and Real-time Database. The sign-in method is via Google and then if the user is new he/she will be ask if whether he/she is a teacher or student.
Teacher: can create classrooms and add students using their user.uid. Each classroom has a unique classroom id. Can view the list of their students.
Student: can view their classroom, and classmates.
So How do I code two different types of users in Firebase for my web app?
What will be the rules to use in the database?
[UPDATED]
You could try this the simple way:
Create a JSON object to store the users information in a field depends on the usage:
a field isTeacher of type boolean (assume you won't add other user type) or
a field userType of object contain all the feature types (isTeacher: boolean, isStudent: boolean, isHeadmaster:boolean, etc.) or
a field of userType of type string
Create a method or condition to check the field of the user document whether is true for a particular user type / compare string (depends which one you use) by using if or switch case
Under each case / condition, show the elements of the web according to their privilege.
After signed-in, before the page load, do the checking using the function created
I have website which uses URL parameters e.g. example.com?key=value.
Let's imagine I have business card generator but besides parameters like name, surname. I want the user to provide a key to access it.
An example key can be gI8ol3dAci, I want my Javascript to check it before doing everything else. The key will be in a MySQL database table, I want to block IPs that entered wrong keys after 3 times and I want to store how many times key has been used. I was thinking about the following concept:
Check if IP is not blacklisted (3+ failed attempts)
Check if the key is working
Add 1 to count of uses of this key
The thing is I am not sure if it will be safe using JavaScript.
In my web application, I want to go to the user home page or profile page of another user.
What should I pass to query data for a particular user ?
What should be the flow ?
I am trying to build a full stack JS application with user profiling.
A good choice would be to choose the user property that matches the following rules :
be unique (required)
never change (recommended, if not, provide a 404 redirect)
So often the username is used.
If you provide a way to change the username, the User UID would be less semantic but will work.