wpuzer on "[Plugin: Ultimate Member] Dynamically changing the user editable status of a field?"

ساخت وبلاگ

I want to add a field to profiles that is something like "locked?" that only admin users can edit. Then if that field is yes, then I want to change the user-editable status of other fields on the profile. Basically blocking regular users from editing them if the profile is in a locked state.

My thought is to check when profile is saved to check locked? status. If locked then change the user-editable status of fields to not editable and if not locked change to editable.

My questions are:
1. how do I hook into when the profile is being saved so I can check the state of the locked? field
2. how do I programmatically toggle the user-editable status of other fields?

https://wordpress.org/plugins/ultimate-member/

For question 1 perhaps I can use the following action?
um_user_after_updating_profile

What about for question 2?

ridethetides
Member
Posted 4 hours ago #

My advice, create 2 different types of users. Stock you get Admin & Member. Perhaps create 1 more which is Locked Member.

Then inside Ultimate Member > User Rolls - there is the option "Can edit their profile?". You can set this to no so a Locked Member cannot edit.

Then you just need to figure out how you want Members to get into each one of those rolls.. You could create a Registration form for each member type you have, and set the form to register that user to Locked or regular member. You could also set the "Default New User Role" to be in one of those roles and move users when you need.

Ok looks like I need to somehow modify um_fields in wp_options table. Hoping there is a function for this

ridethetides
Member
Posted 3 hours ago #

I don't think you need to modify any code, please re-read what I posted. I believe you just need to set user roles for a normal member and a locked member, and register them accordingly.

wpuzer
Member
Posted 14 minutes ago #

Thanks ridethetides. Actually in my last post I didn't refresh the page so I hadn't seen your post yet. A non-code solution might be ideal and what you're suggesting sounds good

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 248 تاريخ : پنجشنبه 3 تير 1395 ساعت: 12:10