I am trying to integrate a LMS plugin with a membership plugin.
My goal is to allow all visitors to see courses and even lessons pages, but the corespondant videos would be restricted to members (of course).
Well, I found the LMS Plugin function responsible for displaying the video-HTML portion.
Is there a way to write another function to prevent that function to execute if the user is not a member (I already have the if statement for this ready).
Hiding div video element with CSS would not be a reasonable solution, of course.
And I can’t hack the LMS Plugin code, because it would be difficult to update later. I need to this using my own plugin, or inserting code on the functions.php file.
Thus my question: How to prevent a function execution with another function? Or is there any other way to do this?
EDIT: Well, I just found an add_action( 'lesson_video', array( $this, 'lesson_video' ), 10, 1 );
on the class core file. And there is a do_action( 'lesson_video', $post->ID );
on the php file that displays the content of the lesson. SO, I think I need to hook on this action too with my if statement. How would it be?
NEW EDIT: Well, the function is inside a class. It is like
class LMS_Frontend {
public function __construct () {add_action( 'lesson_video', array( $this, 'lesson_video' ), 10, 1 );...}
How to remove this action?
NEW EDIT: Well, I finally did it. The action I was trying to remove was added inside a class, and this class was instantiated by another class.
I did:
global $varUsedWhenMainClassWasInstantiated;
remove_action('lesson_video', array($varUsedWhenMainClassWasInstantiated->classLessonVar, 'custom_lesson_video'));
Hope someone can benefit from this.
add_action( 'lesson_video', array( $this, 'lesson_video' ), 10, 1 );
on the class core file. And there is ado_action( 'lesson_video', $post->ID );
on the php file that displays the content of the lesson. SO, I think I need to hook on this action too with my if statement. How would it be?