Tovább a tartalomhoz

Filter hookok

A Tutor LMS filter hookjai csoportosítva: bejelentkezés, kérdések, beállítások, árak, sablonrészek, pénzfelvétel és REST API.

A filter hookokkal egy értéket módosíthatsz, mielőtt a Tutor LMS felhasználná vagy kiírná. A kódot add_filter( 'hook_neve', 'fuggveny_neve' ); formában add hozzá a gyermektéma functions.php fájljához vagy egy saját bővítményhez, és a függvény mindig adja vissza a (módosított) értéket.

Az alábbi listákban a hook neve után az az alapérték vagy változó látszik, amelyet a hook átad.

apply_filters( 'tutor/options/generated-html', $tutor_option->generate() );
apply_filters( 'tutor_admin_tools_page', $tutor_admin_tools_page_fajl, $tutor_admin_tools_page );
apply_filters( 'tutor_tool_pages', $oldalak ); // az Eszközök oldal fülei (Tutor Oldalak, Állapot)
apply_filters( 'tutor_display_admin_footer_text', $bool );
apply_filters( 'tutor_get_screen_ids', $screen_ids );
apply_filters( 'tutor_addons_lists_config', array() );
apply_filters( 'tutor_pro_addons_lists_for_display', array() );
apply_filters( 'tutor_wizard_attributes', array() );
apply_filters( 'tutor_in_plugin_update_message', $upgrade_notice );

Ha egy saját bővítményből szeretnél kérdést vagy választ felvenni a Tutor LMS kérdések és válaszok rendszerébe, ezeket a hookokat használd. Az átadott tömb a WordPress megjegyzés (comment) mezőit tartalmazza.

apply_filters( 'tutor_add_question_data', array(
'comment_post_ID' => $course_id,
'comment_author' => $user->user_login,
'comment_date' => $date,
'comment_date_gmt' => get_gmt_from_date( $date ),
'comment_content' => $question,
'comment_approved' => 'waiting_for_answer',
'comment_agent' => 'TutorLMSPlugin',
'comment_type' => 'tutor_q_and_a',
'user_id' => $user_id,
) );
apply_filters( 'tutor_add_answer_data', array(
'comment_post_ID' => $question->comment_post_ID,
'comment_author' => $user->user_login,
'comment_date' => $date,
'comment_date_gmt' => get_gmt_from_date( $date ),
'comment_content' => $answer,
'comment_approved' => 'approved',
'comment_agent' => 'TutorLMSPlugin',
'comment_type' => 'tutor_q_and_a',
'comment_parent' => $question_id,
'user_id' => $user_id,
) );
apply_filters( 'tutor_answer_to_question_data', $adatok );

A tutor_process_login_errors szűrővel a bejelentkezési képernyő hibaüzeneteit szabhatod testre.

apply_filters( 'tutor_process_login_errors', $validation_error, $creds['user_login'], $creds['user_password'] );
apply_filters( 'tutor_login_credentials', $creds );
apply_filters( 'tutor_login_redirect_url', $redirect_to );
apply_filters( 'login_errors', $e->getMessage() );
apply_filters( 'tutor_get_username_from_email', true );
apply_filters( 'allow_password_reset', true, $user_data->ID );
apply_filters( 'tutor_email_from_address', get_tutor_option( 'email_from_address' ) );
apply_filters( 'tutor_email_from_name', get_tutor_option( 'email_from_name' ) );
apply_filters( 'tutor_lostpassword_url', wp_lostpassword_url() );
apply_filters( 'tutor_reset_password_message', $uzenet );
apply_filters( 'tutor_student_registration_required_fields', $mezok );
apply_filters( 'tutor_student_register_validation_errors', array() );
apply_filters( 'tutor_student_register_redirect_url', $redirect_page, $user );
apply_filters( 'tutor_instructor_registration_required_fields', $mezok );
apply_filters( 'tutor_instructor_register_validation_errors', array() );
apply_filters( 'tutor_profile_edit_validation_errors', array() );
apply_filters( 'tutor_reset_password_validation_errors', array() );

Az oktatói regisztráció alapból kötelező mezői: keresztnév, vezetéknév, e-mail-cím, felhasználónév, jelszó és a jelszó megerősítése. A hozzájuk tartozó hibaüzenetek a tutor_instructor_registration_required_fields szűrővel bővíthetők (a hallgatói regisztráció kötelező mezőit a tutor_student_registration_required_fields bővíti, lásd Testreszabás kódrészletekkel).

apply_filters( 'tutor_initial_instructor_status', 'pending' ); // az új oktató kezdő állapota
apply_filters( 'add_new_instructor_data', array(
'user_login' => $user_login,
'user_email' => $email,
'first_name' => $first_name,
'last_name' => $last_name,
'role' => tutor()->instructor_role,
'user_pass' => $password,
) );
apply_filters( 'tutor_instructor_statuses', $allapotok );
apply_filters( 'tutor_instructor_query_when_exists', ' AND ID <1 ' );
apply_filters( 'tutor_course_instructors_html', $instructor_output, $instructors );

A tutor_monetization_options szűrővel új értékesítési módot vehetsz fel a Bevételszerzés beállításai közé (alapból csak a „Disable Monetization”, vagyis a kikapcsolt monetizáció szerepel a tömbben).

apply_filters( 'tutor_monetization_options', array(
'free' => __( 'Disable Monetization', 'tutor' ),
// ide vedd fel az új lehetőséget
) );
apply_filters( 'tutor_option_input', $option );
apply_filters( 'tutor/options/attr', $attr );
apply_filters( 'tutor/options/extend/attr', array() );

Kurzusok, bejegyzéstípusok, hivatkozások

Szekció neve “Kurzusok, bejegyzéstípusok, hivatkozások”
apply_filters( 'tutor_courses_base_slug', $course_post_type );
apply_filters( 'tutor_lesson_base_slug', $lesson_post_type );
apply_filters( 'tutor_course_settings_tabs', $args );
apply_filters( 'use_block_editor_for_post_type', true, 'courses' );
apply_filters( 'tutor_course_level', $szintek );
apply_filters( 'tutor_course_contents_post_types', array( $lesson_post_type, 'tutor_quiz' ) );
apply_filters( 'tutor_course/single/enrolled/nav_items', $nav_items );
apply_filters( 'tutor_course/single/enrolled/nav_items_rewrite', $course_nav_items );
apply_filters( 'tutor_course_additional_info', $detail );
apply_filters( 'tutor_course_categories_dropdown_args', $args );
apply_filters( 'tutor_course_categories_checkbox_args', $args );
apply_filters( 'tutor_get_course_categories_args', $args );
apply_filters( 'tutor_get_course_categories_terms_args', $args );
apply_filters( 'tutor_placeholder_img_src', $src );
apply_filters( 'tutor_course_thumbnail_size', $size, $post_id );
apply_filters( 'tutor_video_types', array( 'mp4' => 'video/mp4', 'webm' => 'video/webm', 'ogg' => 'video/ogg' ) );
apply_filters( 'tutor_video_stream_is_public', false, $post_id );
apply_filters( 'tutor/utils/languages', $language_codes );
apply_filters( 'tutor_file_types_icon', $ikonok );
apply_filters( 'tutor/posts/attachments', $data );
apply_filters( 'is_course_paid', false, $course_id );
apply_filters( 'is_course_purchasable', false, $course_id );
apply_filters( 'get_tutor_course_price', null, $course_id );
apply_filters( 'get_tutor_currency_symbol', $symbol );
apply_filters( 'should_remove_price_if_enrolled', true );
apply_filters( 'tutor_is_enrolled', $getEnrolledInfo, $course_id, $user_id );
apply_filters( 'tutor_enroll_data', $adatok );
apply_filters( 'is_completed_course', false, $course_id, $user_id );
apply_filters( 'tutor_course_sell_by', null );
apply_filters( 'tutor_enroll_required_login_class', 'cart-required-login' );
apply_filters( 'tutor_enroll_form_classes', $osztalyok );
apply_filters( 'tutor_course_add_to_cart_form_action', get_permalink( get_the_ID() ) );
apply_filters( 'tutor_new_earning_data', array_merge( $earning_data, $fees_deduct_data ) ); // WooCommerce
apply_filters( 'tutor_popup_login_class', 'cart-required-login' );
apply_filters( 'tutor_wishlist_btn_class', 'tutor-course-wishlist-btn' );
apply_filters( 'tutor_course_rating_average', $course_rating->rating_avg );
apply_filters( 'tutor_course_rating_count', $course_rating->rating_count );
apply_filters( 'tutor_dashboard/nav_items', $nav_items );
apply_filters( 'tutor_dashboard/nav_items_all', $all_nav_items );
apply_filters( 'tutor_dashboard/nav_ui_items', $nav_items );
apply_filters( 'tutor_dashboard/permalinks', $permalinks );
apply_filters( 'tutor_dashboard_page_id', $page_id );
apply_filters( 'tutor_public_profile/permalinks', $permalinks );
apply_filters( 'tutor_social_share_icons', $icons );
apply_filters( 'tutor_user_social_icons', $icons );
apply_filters( 'frontend_course_create_url', admin_url( 'post-new.php?post_type=' . tutor()->course_post_type ) );
apply_filters( 'tutor_course_builder_logo_src', tutor()->url . 'assets/images/tutor-logo.png' );
apply_filters( 'tutor_dashboard/index', $kimenet );
apply_filters( 'tutor_dashboard/student/index', $kimenet );
apply_filters( 'tutor/student/register', $kimenet );
apply_filters( 'tutor_withdraw_methods', $methods );
apply_filters( 'tutor_withdraw_options_input', $option );
apply_filters( 'tutor_withdraw_method_set_success_msg', $uzenet );
apply_filters( 'tutor_no_withdraw_method_msg', $uzenet );
apply_filters( 'tutor_required_min_amount_msg', $uzenet );
apply_filters( 'tutor_pre_withdraw_data', $adatok );
apply_filters( 'tutor_withdraw_successful_msg', $uzenet );
apply_filters( 'tutor_withdraw_account_field_type_data', $adatok );
apply_filters( 'tutor_should_withdraw_delete', true );
apply_filters( 'tutor_lms_should_template_override', true );
apply_filters( 'tutor_lesson_template', $template );
apply_filters( 'tutor_get_template_path', $template_location, $template );
apply_filters( 'tutor_get_template_part_path', $template_location, $template );
apply_filters( 'get_tutor_load_template_variables', $variables );
apply_filters( 'should_tutor_load_template', true, $template, $variables );
apply_filters( 'tutor_localize_data', $localize_data );
apply_filters( 'tutor_get_flash_msg', $msg, $name );
apply_filters( 'tutor_referer_url', $url );
apply_filters( 'tutor_pages', $oldalak );
apply_filters( 'tutor_login_form_popup_html', $output );

Az osztályok és az elrendezés CSS-osztályai:

apply_filters( 'tutor_course_loop_wrap_classes', $osztalyok );
apply_filters( 'tutor_course_loop_col_classes', $osztalyok );
apply_filters( 'tutor_container_classes', $osztalyok );
apply_filters( 'tutor_post_class', $osztalyok );
apply_filters( 'tutor_widget_course_loop_classes', $osztalyok );

A kurzusarchívum és a kurzuskártya HTML-kimenetét az alábbi szűrők módosíthatják (mindegyik a kész HTML-t adja át):

apply_filters( 'tutor_course_loop_start', $html );
apply_filters( 'tutor_course_loop_end', $html );
apply_filters( 'tutor_course_archive_pagination', $html );
apply_filters( 'tutor_course_archive_filter_bar', $html );
apply_filters( 'tutor_course_loop_before_content', $html );
apply_filters( 'tutor_course_loop_after_content', $html );
apply_filters( 'tutor_course_loop_header', $html );
apply_filters( 'tutor_course_loop_thumbnail', $html );
apply_filters( 'tutor_course_loop_start_content_wrap', $html );
apply_filters( 'tutor_course_loop_end_content_wrap', $html );
apply_filters( 'tutor_course_loop_title', $html );
apply_filters( 'tutor_course_loop_meta', $html );
apply_filters( 'tutor_course_loop_author', $html );
apply_filters( 'tutor_course_loop_price', $html );
apply_filters( 'tutor_course_loop_rating', $html );
apply_filters( 'tutor_course_loop_add_to_cart_link', $html );
apply_filters( 'tutor_course_loop_footer', $html );
apply_filters( 'tutor_course_price', $html );
apply_filters( 'tutor_get_the_excerpt', $get_post->post_excerpt );
apply_filters( 'get_tutor_course_author', $szerzo_neve );

Az egy kurzus oldalának részei:

apply_filters( 'tutor_course/single/benefits', $array, $course_id );
apply_filters( 'tutor_course/single/benefits_html', $html );
apply_filters( 'tutor_course/single/requirements', $array, $course_id );
apply_filters( 'tutor_course/single/requirements_html', $html );
apply_filters( 'tutor_course/single/target_audience', $array, $course_id );
apply_filters( 'tutor_course/single/audience_html', $html );
apply_filters( 'tutor_course/single/material_includes', $array, $course_id );
apply_filters( 'tutor_course/single/topics', $html );
apply_filters( 'tutor_course/single/instructors_html', $html );
apply_filters( 'tutor_course/single/reviews_html', $html );
apply_filters( 'tutor_course/single/reviews_form', $html );
apply_filters( 'tutor_review_disabled_text', '' );
apply_filters( 'tutor_course/single/content', $html );
apply_filters( 'tutor_course/single/lead_info', $html );
apply_filters( 'tutor_course/single/enrolled/lead_info', $html );
apply_filters( 'tutor_course/single/enrolled', $html );
apply_filters( 'tutor_course/single/enroll', $html );
apply_filters( 'tutor_course/single/' . $template, $html );
apply_filters( 'tutor_course/global/login', $html );
apply_filters( 'tutor_course/single/enrolled/nav', $html );
apply_filters( 'tutor_course/single/video', $html );
apply_filters( 'tutor_course/single/complete_form', $html );
apply_filters( 'tutor_course/single/completing-progress-bar', $html );
apply_filters( 'tutor_course/single/question_and_answer', $html );
apply_filters( 'tutor_course/single/announcements', $html );
apply_filters( 'tutor_course/single/tags_html', $html );
apply_filters( 'tutor_course/single/social_share', $html );
apply_filters( 'tutor_course/contents/lesson/title', $lesson_title, $course_id );

A lecke, a kvíz és a feladat oldala:

apply_filters( 'tutor_lesson/single/attachments', $html );
apply_filters( 'tutor_lesson/single/lesson_sidebar', $html );
apply_filters( 'tutor_lesson/single/content', $html );
apply_filters( 'tutor_lesson/single/sidebar_question_and_answer', $html );
apply_filters( 'tutor/single/next_previous_pagination', $html );
apply_filters( 'tutor_single_quiz/top', $html );
apply_filters( 'tutor_single_quiz/body', $html );
apply_filters( 'tutor_single_quiz/content', $html );
apply_filters( 'tutor_single_quiz/no_course_belongs', $html );
apply_filters( 'tutor_single_quiz/single_quiz_contents', $html );
apply_filters( 'tutor_quiz/previous_attempts_html', $previous_attempts_html, $previous_attempts, $quiz_id );
apply_filters( 'tutor_assignment/single/content', $html );
apply_filters( 'tutor_assignment/single/results/after', $html, $submit_id, $assignment_id );

A Tutor listatáblái a WordPress megszokott táblázat-hookjait használják, a képernyő azonosítójával:

apply_filters( "views_{$this->screen->id}", $views );
apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
apply_filters( 'disable_months_dropdown', false, $post_type );
apply_filters( 'months_dropdown_results', $months, $post_type );
apply_filters( 'list_table_primary_column', $default, $this->screen->id );
apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
apply_filters( 'edd_purchase_link_defaults', $args );
apply_filters( 'woocommerce_loop_add_to_cart_args', $args, $product );
apply_filters( 'woocommerce_loop_add_to_cart_link', $link );
apply_filters( 'course_categories_pmpro_args', $args );
apply_filters( 'tutor/api/get_courses', $query );
apply_filters( 'tutor_rest_response', $response );
apply_filters( 'tutor_rest_course_thumbnail_size', 'post-thumbnail' );
apply_filters( 'tutor_rest_course_single_post', $post );
apply_filters( 'tutor_rest_course_by_terms_query_args', $args );
apply_filters( 'tutor_rest_course_sort_by_price_args', $args );
apply_filters( 'tutor_rest_course_query_args', $args );

A kurzuskészítőhöz tartozó, adatválaszokat módosító szűrőket lásd a Egyedi mezők a kurzuskészítőben fejezetben.

Készült:

Tiszteletben tartjuk a magánszférádat

Sütiket használunk a böngészési élmény javítására és a forgalom elemzésére. Az analitika csak akkor indul, ha engeded. Adatvédelmi irányelvek, Sütitájékoztató.

Sütibeállítások