Wordpress user registration to upload data for admins approval - database

I want that users be able to upload info, this info will be show on a product list but it will only be posted if the admins approve it.
The user may need to register or not, the contact info will be on the info they upload.
Do i need to storage the info on a different database? can i do this with the wordpress registration?

You can use wordpress database table user to store data, set post_status as 'pending', so that admin can check and can change its status to 'publish'
You can create custom template page, then insert user data in post table using custom query or
wp_insert_post() function.
Hope this helps.
Cheers!!!!

Related

Best way to implement one-time feature after signup?

Note: This is likely a duplicate question but I couldn't search for a solution/suggestion for my use case, so if anyone can re-direct me, that would be appreciated.
Problem: I have a NextJS application that runs on Prisma ORM and MySQL database. I am using NextAuth for OAuth authentication for sign up and log in.
So far the application works just fine but I want to check whether a user is logging in for the first time and redirect them to a set up page whether they would input personal details in order to populate a table on the database, so that the app can form a dynamic page based on their newly added information.
On the database, there are the user table (populated by NextAuth immediately at login) and the profile table.
Under NextAuth, the user table is populated automatically with the account's user name and email etc. However, that is not a unique entry and NextJS getStaticPath requires a unique entry to generate a dynamic page. That's why I have created the profile table to allow users to add their custom username where the dynamic URL will be generated (e.g. localhost:3000/u/[slug])
Here's my question - I want to check that the user is first time logging in and send a form for them to fill out the necessary information to input data onto the profile table, otherwise they would go straight to their profile homepage. What is the best way to check that and to redirect them to that form page?
Do I do it at server side with getServerSideProps by checking that the id from user table is missing from the profile table and do a redirect? Or is there some method that's customarily used to implement this "initial set-up" procedure?

Is this possible to create a private report filtering in Data Studio embeded report

I created a report in DataStudio and embedded it on my website. I activated the option "anyone with the link can view" so this report will be visible to my website users.
But I need to show my website users different data depending on their user ids and more important I don't want users would be able to see other users' data so if I used URL filtering users would be able to breach and search another user id to see his data.
Does anyone have a solution for this scenario?
In Google documentation I saw an option to limit the report to users in my domain, I assume this will solve this issue, but I don't find how to restrict other domains.
Users are logged onto Google
If users of your website are already logged onto Google, use the Filter by email address guide from Data Studio help center. This requires you to setup FILTER BY EMAIL and then have a field in your data can be directly used as an email filter.
Users are not logged on to Google
If you want a solution where the users don't have to be logged onto Google, you will need to:
Create a Community Connector to pass the filtered data to your users. The connector should accept a short lived token as part of the config.
Create a dashboard with your connector and pass unique short-lived tokens for each user.
You should have an endpoint that returns the current user's data based on the token provided. Alternatively, the endpoint can return only the user's identify and you can query a secondary data source with a service account filtering for the user's identity.
Your connector should call your endpoint to fetch data only for the user/for the user's identity.
This official guide demonstrates how to implement this in more details.
Disclaimer: I work in the Data Studio team and wrote the above guide.
First option is to add extra 2 fields to your data source.
User_ID
Password
For example:
Data, User_ID, Password
$10,Daniel,123
$20,Alex,456
In your dashboard, you need to create two parameters:
User_ID_Parameter
Password_Parameter
Both parameters can set the default value to null, and accepts any values.
Then create a new calculated field:
CASE
WHEN REGEXP_MATCH(User_ID,USER_ID_Parameter) AND REGEXP_MATCH(Password,Password_Parameter) THEN 1
ELSE 0
END
Then create a new filter to the chart that you want to hide:
To include the above calculated field Equal to 1
Second option is to use the Data Studio default Row Level Security
The only caveat is the users need to sign in before they can view the report.

How to Display Specific User information in cakephp..?

Iam new to cakephp and i have a problem with an element. how to display each user account information when ever the user loggedin than click on myaccount link how will show the particular user details. myaccount link is in element.
Finally How to display specific user information when click on the myaccount link. The myaccount link is in element file.
If you want to display the logged In users information in their account page.Then you simply do it by using Session. Cause in CakePHP logged in user's are stored into session.
In this case you can try var_dump($this->Session->read('Auth.User'));, here you can see the logged in users information. And now you can populate users information form it.
If you want login user data then, After your successfully login your user data will be store in Auth User session.
So if you want to fetch whole user data then you can try var_dump($this->Session->read('Auth.User'));
Or
If you want any single field from your login user table then you can use like,
$this->Auth->user('id')
here instead of 'id' you can use any field name of users(where you store your user credentials and details) table.
Make sure your login user data stored in the authentication table i.e if you are storing only username and password in users table and the other details stored in another table with name user_details, then you can not fetch user_details for the login user.
for that you need to store user_details in Auth.User session after login.
I hope this will be helpful for you.

cakephp add associated model on manual login

In cakephp I have two Models User and Account, User belongsTo Account model, now on logon by cakephp UsersController->login method the the associated table automatically added to session variable but when I manually login by $this->Auth->login($user['User']) only User Model data added in the Session variable, how can I achieve Account data Session on manual login?
Manually logging in using $this->Auth->login($data); will populate the session with $data, as stated in the documentation: http://api.cakephp.org/2.5/class-AuthComponent.html#_login
The solution is to login all the data you want. In your case:
$this->Auth->login($user);
Where $user contains the Account data.
I found another way to doing this, all I need to find user and login by method :$this->Auth->login($user);
, now for manual login I have to set all components so I use $this->Session->write('Auth.User', $user); to write all data in session Component which add Associated tables in Session.

how to design a db like Facebook where users can update their status and of the fb page as admin

i am designing a database where users can update status messages of theirs and they can create pages groups like facebook fan page and post status like the admin of the page and not as a user.
user(id, name..)
group(id, name...)
group_admin(group_id, user_id)
this is my set up. Is this the way to do it.
How to post under the group as an admin. will i need to make a check to every user if he is the admin or not ?
well you could say that when a user posts messages on a page group, on witch they're registered as admin, then the message is posted as page group admin, otherwise it's posted as user.

Resources