View/edit another profile, programatically getting the user being edited

4 years 1 month ago - 4 years 1 month ago #316696 by fdinkler
I've written a module to validate profile fields, and it's working well.
What's missing is the ability to run the module against the user whose profile is being edited/viewed, not the logged-in user.
When I'm viewing or editing a profile using CB, is there a method to tell me what user I'm viewing/editing?
Thanks,
Fred

Please Log in to join the conversation.

4 years 1 month ago #316698 by krileon
Depends entirely on how you've implemented your validation. Was it not possible to implement your validation using CB Code Field or CB Query Field? Both provide a means of implementing custom validation. CB Code Field provides Code Validation so you can implement custom PHP based validation and CB Query Field provides Query Validation so you can implement custom SQL based validation. Both also already support ajax validation out of the box.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

4 years 1 month ago - 4 years 1 month ago #316703 by fdinkler
Kyle - thanks for the reply.
Yes, the module code can be implemented in a CB Code field, and I have tested it there, and I'm aware of the CB Query Field, and have used both.

My question lies in user context...
Use Case:
I'm logged in as a SuperUser, viewing or editing another user's profile,
JFactory::getUser() returns the logged-in SuperUser, me
How do I retrieve the user whose profile I am editing/viewing?

Actually, I see that part of the solution is to write this as a CB Plugin, not a Joomla module...
FYI - the Joomla module I'm writing is a generic, configrable profile validation extension.

Thanks, Fred

Please Log in to join the conversation.

4 years 1 month ago #316706 by krileon
CB Code Field and its Code Validation provides the user object for you. You can access it with $user from your custom PHP. I've no idea why you're trying to run validation from a Joomla module and don't see how that could possibly work for anything other than client side validation. To properly extend CB validation it should be a CB field as we've triggers in place for extending validation (e.g. see CB Code Field for example). The trigger will provide the edited users user object. Aside from that you'll have to pull the user id from GET and build a user object from that id.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.487 seconds

Facebook Twitter LinkedIn