Fork me on GitHub

The BuddyPress Simple Attributes Name Converter extension maps the AD attributes givenname and sn into a single Name field. You can use this extension as a base for your on converters.

Requirements

The BuddyPress Simple Attributes premium extension must be installed and activated.

Usage

  • Download and install the premium extension and follow the installation procedure.
  • Create a directory nadiext-simple-attributes-name-converter inside wp-content/plugins and create a new index.php with the following content:
<?php
/**
 * Plugin Name: Next Active Directory Integration: BuddyPress simple attributes - name converter
 * Plugin URI: https://www.active-directory-wp.com
 * Description: Converts the AD attributes 'givenname' and 'sn' into the BuddyPress field 'Name'.
 * Version: 1.0.0
 * Author: NeosIT GmbH
 * Author URI: http://www.neos-it.de/
 * License: Commercial
*/

function nadiext_buddypress_simpleattributes_name_converter($mappings) {
	$mappings['Name'] = array(function($name, $lastname, $raw) {
		return $name . " " . $lastname;
	}, 'givenname', 'sn');
	
	return $mappings;
}

add_filter('nadiext_buddypress_simpleattributes_filter_mappings', 'nadiext_buddypress_simpleattributes_name_converter');
  • Activate the plug-in in your WordPress plug-in view
  • Done :-)