Skip to content

Instantly share code, notes, and snippets.

View wbcomdev's full-sized avatar

Wbcom Dev wbcomdev

View GitHub Profile
@wbcomdev
wbcomdev / custom-settings.php
Created June 27, 2023 06:11
custom setting tab inside business setting
<?php
/**
* Business Single page settings
*
* @package WordPress
* @subpackage bp-business-profile
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
<?php
function setup_group_nav() {
global $bp;
/* Add some group subnav items */
$user_access = false;
$group_link = '';
if ( bp_is_active( 'groups' ) && ! empty( $bp->groups->current_group ) ) {
$group_link = $bp->root_domain . '/' . bp_get_groups_root_slug() . '/' . $bp->groups->current_group->slug . '/';
$user_access = $bp->groups->current_group->user_has_access;
bp_core_new_subnav_item(
@wbcomdev
wbcomdev / contact-seller-link-redirection.php
Last active January 18, 2023 13:56
contact-seller-link-redirection.php
<?php
function ld_dashboard_add_nav_menu( $menu_items ) {
$menu_items['all']['custom'] = array(
'url' => get_the_permalink() . '?tab=custom', // tab=custom sets the slug of your custom tab which will later be used to display content in this tab.
'icon' => '<img src="http://lddashboard.local/wp-content/plugins/ld-dashboard/public/img/icons/tachometer-alt.svg">',
'label' => 'Custom Nav',
);
return $menu_items;
}
add_filter( 'learndash_dashboard_nav_menu', 'ld_dashboard_add_nav_menu', 10, 1 );
<?php
function ld_dashboard_after_content_callback() {
if ( isset( $_GET['tab'] ) && 'custom' === $_GET['tab'] ) { // We used the same slug here that we used while adding the menu i.e. 'custom'
echo 'This is custom nav content';
}
}
add_action( 'ld_dashboard_after_content', 'ld_dashboard_after_content_callback' );
?>
<?php
function ld_dashboard_add_nav_menu( $menu_items ) {
$menu_items['all']['custom-nav'] = array(
'url' => get_the_permalink(),
'icon' => '<img src="http://lddashboard.local/wp-content/plugins/ld-dashboard/public/img/icons/tachometer-alt.svg">',
'label' => 'Custom Nav',
<?php
add_filter( 'ld_dashboard_user_profile_fields', 'add_custom_profile_fields' );
// Add custom field in the profile settings form.
function add_custom_profile_fields( $profile_fields ) {
$current_user = wp_get_current_user();
$profile_fields['custom_field'] = array(
'title' => esc_html__( 'Custom Field', 'ld-dashboard' ),
'tag' => 'input',
'type' => 'text',
<?php
/**
* bmpro_assign_manage_option_bp_moderator_pro
*
* @return void
*/
function bmpro_assign_manage_option_bp_moderator_pro() {
<?php
/**
* Bp_profile_views_member_loop_modification
*
* @return void
*/
function wbbp_display_profile_views_at_member_loop() {
global $wpdb;
$user_id = bp_get_member_user_id();
$component = bp_current_component();
<?php
/**
* Bp_profile_views_member_header_display
*
* @return void
*/
function wbbp_display_profile_views_at_member_header() {
global $wpdb;
$user_id = get_current_user_id();
$displayed_user_id = bp_displayed_user_id();