BP_Compatibility_Integration::action_links( $link,  $file )

Change the Third party plugin setting link.

Description

Parameters

$link

(Required)

$file

(Required)

Return

(array)

Source

File: bp-integrations/compatibility/bp-compatibility-integration.php

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
public function action_links( $link, $file ) {
 
    // Return normal links if not BuddyBoss Platform plugin or it's does not have a setting links
    if (
        plugin_basename( 'buddyboss-platform/bp-loader.php' ) == $file
        || empty( $link['settings'] )
    ) {
        return $link;
    }
 
    $htmlDom = new DOMDocument;
 
    // Parse the HTML of the page using DOMDocument::loadHTML
    $htmlDom->loadHTML( htmlentities( $link['settings'] ) );
 
    // Extract the links from the HTML.
    $links = $htmlDom->getElementsByTagName( 'a' );
 
    $extractedLinks = array();
 
    if ( ! empty( $links ) ) {
        foreach ( $links as $link_obj ) {
            $extractedLinks[] = $link_obj->getAttribute( 'href' );
        }
    }
 
    if (
        ! empty( $extractedLinks )
        && in_array( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ), $extractedLinks )
    ) {
        // Add a few links to the existing links array.
        return array_merge( $link, array(
            'settings' => '<a href="' . esc_url( bp_get_admin_url( add_query_arg( array(
                    'page' => 'bp-integrations',
                    'tab'  => 'bp-compatibility'
                ), 'admin.php' ) ) ) . '">' . esc_html__( 'Settings', 'buddyboss' ) . '</a>',
        ) );
    }
 
    return $link;
}

Changelog

Changelog
Version Description
BuddyBoss 1.2.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.