I have a Member database where I store user related information such as Name, Email, etc… . However I also store their subscription status, and I would like to make it so they can’t edit it. Can someone please help ?
Hello Sneaky …
ok —> " user related information" this say allready everything.
user related information = get some personal data of somebody.
personal data of somebody = getCurrentUser
personal data of somebody = get an item by user-ID
personal data of somebody = user-email
So your first question should be—> how to get the right user-data ?
Everyone who is logged in has an e-mail.
get User-E-mail…
import wixUsers from 'wix-users';
$w.onReady(function () {
let userEmail = wixUsers.currentUser.getEmail()
console.log(userEmail) //---> Shows the E-Mail of current-user (PRESS-F12 in google-chrome-browser)
})
The first part is done, you have now the users-email.
Sorry but this has nothing todo with my question, I already got the user’s personal information, this is not my question.
So if you already have the users-data like e-mail, where is the problem?
Just do a query of your data-collection where you search for the current email.
e-mail found in the database = persons data found (now you can edit data in the right column)
So you will find all data for the current logged in person.
Then you refer to the right colum ( subscription status).
I do have trouble making a query, can you please fully read my question ?
I need to block the subscription field so it can’t be edited by members
Ok, first few questions!
- Who is allowed to edit the STATUS-COLUMN ?
a) Just the ADMIN ?
b) The owner itself? (logged-in-user?)
c) Both?
d) Which STATUS should the user have to have a permission?
Please write here your STATUS-Choice:
- Status: ADMIN
- STATUS: USER
- …
I hope i understand you right.
On my opinion you are searching for something like this…
- User-1 —> (status = ADMIRAL) allowed to do everything
- User2 —> (status = SOLDIER) not allowed to do anything
- User3 —> (status = MAJOR) allowed to do a few things
Is that what you want to construct? Doing some rolles?
So basically right now, I have a Members collection, this are the permissions :
- Read : Author Member
- Create : Site Member
- Delete Admin
When a user signs in, a new row is created with all his data (email, name, etc…), there is also a field called “Subscription Status” that is either “Active” or “Inactive”, I need the user to be able to read this field but not to edit it.
“So basically right now, I have a Members collection, this are the permissions : 1. Read : Author Member 2. Create : Site Member 3. Delete Admin When a user signs in, a new row is created with all his data (email, name, etc…), there is also a field called “Subscription Status” that is either “Active” or “Inactive”, I need the user to be able to read this field but not to edit it.”
ok, a few hours ago, i saw a similar problem, look here…
https://www.wix.com/corvid/forum/community-discussion/keep-switch-on-until-switched-back-by-member/p-1/dl-5ef0a5425de91a0017455aed-5ef079bbf0d26200170de110-1?commentId=5ef079bbf0d26200170de110&origin=notification&postId=5ef01016e0dae4004ab6c2e1&replyId=5ef0a5425de91a0017455aed
You have the same issue.
You have to be able to save the current status of the permission for each member.
Like in this example…
https://russian-dima.wixsite.com/wixworld/blank-13
The read-out-process is already done.
All you have to do is the write-process (similar to the read-process).
If you still have troubles and can’t achieve your aim, so write again, here.
@developersneakybot Hey Sneaky, could you forward me an email saying Hello? Wanted to talk with you briefly about something. Cheers!