tombenner / wp-mvc

An MVC framework for WordPress
http://wpmvc.org
MIT License
624 stars 172 forks source link

Load Model MvcUser #259

Closed marcelmastel closed 5 months ago

marcelmastel commented 2 years ago

Hi, is possible load model user in a controller for manage email first name e last name in a view '/my-account/'?

cyberscribe commented 2 years ago

Yes, see documentation

On Wed, 6 Apr 2022 at 14:03, Marcello Mastellone @.***> wrote:

Hi, is possible load model user in a controller for manage email first name e last name in a view '/my-account/'?

— Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/259, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFJLZLHL2O5TWKHVJ4DUMLVDWDSNANCNFSM5SV6ZRUA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Sent from Gmail Mobile

marcelmastel commented 2 years ago

I found this load_model.. but if I passed MvcUser.. Not works i have an issue

http://wpmvc.org/documentation/controllers/controller_methods/load_model.html

jose-tog commented 5 months ago

@marcelmastel try this instead.

$user_model = mvc_model('MvcUser'); $user = $user_model->find_by_id(1);

If you want to use the other way you need to do a mapping to a model in your Project say Member like in this link

https://wpmvc.org/documentation/wordpress_data_integration/models_for_wordpress_tables.html Good luck!