New to Wordpress development.
I am using a plugin that uses custom posts types to create online courses.
I noticed that the plugin has a file called
/wp-content/plugins/sfwd-lms/includes/classes/class-ldlms-topic-model.php
It contains:
<?php if ( ( class_exists( 'LDLMS_Model_Post' ) ) && ( ! class_exists( 'LDLMS_Model_Topic' ) ) ) { class LDLMS_Model_Topic extends LDLMS_Model_Post { private static $post_type = 'sfwd-topic'; function __construct( $topic_id = 0 ) { $this->load( $topic_id ); } // Endof functions. } } So in a hook action I am trying to access the plugin's models. For instance as so:
require_once LEARNDASH_LMS_PLUGIN_DIR . 'includes/classes/abstract-ldlms-model-post.php'; require_once LEARNDASH_LMS_PLUGIN_DIR . 'includes/classes/class-ldlms-topic-model.php'; add_action( 'learndash-topic-quiz-row-before', 'show_topic_content', 10, 3); function show_topic_content($topicID, $course_id, $user_id) { // get model $thistopic = new LDLMS_Model_Topic($topicID); print_r($thistopic);die; } But I get this error:
Fatal error: Uncaught Error: Call to undefined method LDLMS_Model_Topic::load() in wp-content/plugins/sfwd-lms/includes/classes/class-ldlms-topic-model.php:8 I just came from Laravel development so I suppose there is a wordpress-ish way to go about accessing a model and maybe I am missing some step?
Or maybe, because a topic in this plugin is a type of post I need to use the post model? Seems like that would be odd since this topic model is its own unique sort of post.
Would be very curious to know what is the proper, plugin-agnostic way to access a model, its permissions.
Thanks, Brian