LLMS_User_Postmeta::get_link( string $context = 'course' )
Retrieve a link for the item on the admin panel
Parameters Parameters
- $context
-
(string) (Optional) Display context either "course" or "student".
Default value: 'course'
Return Return
(string)
Source Source
File: includes/models/model.llms.user.postmeta.php
public function get_link( $context = 'course' ) { $url = ''; switch ( $this->get( 'meta_key' ) ) { case '_achievement_earned': case '_certificate_earned': case '_email_sent': $url = get_edit_post_link( $this->get( 'meta_value' ) ); break; case '_enrollment_trigger': $url = get_edit_post_link( str_replace( 'order_', '', $this->get( 'meta_value' ) ) ); break; default: $student = $this->get_student(); if ( ! $student ) { return ''; } $course = false; if ( 'course' === get_post_type( $this->get( 'post_id' ) ) ) { $course = llms_get_post( $this->get( 'post_id' ) ); } else { $course = llms_get_post_parent_course( $this->get( 'post_id' ) ); } if ( $course ) { $url = LLMS_Admin_Reporting::get_current_tab_url( array( 'course_id' => $course->get( 'id' ), 'stab' => 'courses', 'student_id' => $student->get_id(), 'tab' => 'students', ) ); } } return $url; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
6.0.0 | Don't use deprecated achievement and certificate meta data. Combined redundant cases into a single case. Fixed return value. |
3.15.0 | Introduced. |