Skip to content

Instantly share code, notes, and snippets.

View wbcomdev's full-sized avatar

Wbcom Dev wbcomdev

View GitHub Profile
<?php
/*
** Add a custom field on topic front end form
*/
function ld_dashboard_topic_form_fields_callback( $fields ) {
/**
* Add following classes to add fields in specific sections.
*
* For 'Main' tab - 'ld-dashboard-form-post-data-tab'
<?php
/*
** Add a custom field on course front end form
*/
function ld_dashboard_course_form_fields_callback( $fields ) {
/**
* Add following classes to add fields in specific sections.
*
* For 'Main' tab - 'ld-dashboard-form-post-data-tab'
<?php
/**
* Use below snippet to change default loading text.
*/
function ld_dashboard_waiting_text_call() {
return 'Details loading...';
}
add_filter( 'ld_dashboard_waiting_text', 'ld_dashboard_waiting_text_call' );
<?php
/**
* Use below snippet to display no activity text.
*/
function ld_dashboard_no_activity_text_call() {
return 'Test message when course activity not created!!!!';
}
add_filter( 'ld_dashboard_no_activity_text', 'ld_dashboard_no_activity_text_call' );
<?php
/**
* Use below snippet to display pagination on course details section.
*/
function course_details_per_page_call() {
return 1;
}
add_filter( 'ld_dashboard_course_details_per_page', 'course_details_per_page_call' );
<?php
/**
* Use below snippet to display pagination on student details section.
*/
function student_course_details_per_page() {
return 1;
}
add_filter( 'ld_dashboard_student_course_details_per_page', 'student_course_details_per_page' );
<?php
/**
* Use below snippet to create custom navigation menu in dashboard.
*/
function ld_dashboard_add_nav_menu( $menu_items ) {
$menu_items['all']['custom-nav'] = array(
'url' => get_the_permalink(),
/**
* Filters the MySQL WHERE conditions for the Activity items get method.
*
* @since BuddyPress 1.9.0
*
* @param array $where_conditions Current conditions for MySQL WHERE statement.
* @param array $r Parsed arguments passed into method.
* @param string $select_sql Current SELECT MySQL statement at point of execution.
* @param string $from_sql Current FROM MySQL statement at point of execution.
* @param string $join_sql Current INNER JOIN MySQL statement at point of execution.
@wbcomdev
wbcomdev / Snippet to create a custom nav on My Dashboard page
Created April 1, 2022 07:11
Snippet to create a custom nav on My Dashboard page
<?php
function ld_dashboard_add_nav_menu( $menu_items ) {
$menu_items['all']['custom-nav'] = array (
'url' => get_the_permalink(), //here you can add any custom url
'icon' => '<img src="http://lddashboard.local/wp-content/plugins/ld-dashboard/public/img/icons/tachometer-alt.svg">', //set the icon of the menu
'label' => 'Custom Nav', //(label) name of the menu
);
return $menu_items;
}
<?php
/**
* User redirect to after signup successful.
*/
function wbcom_redirect_after_signup() {
$page = 'signup-successful';// Enter page slug here.
bp_core_redirect( site_url( $page ) );
}