bp_ps_directories()

Returns array of BuddyBoss Profile Search directories.

Description

Source

File: bp-core/profile-search/bps-directory.php

function bp_ps_directories ()
{
	static $dirs = array ();

	if (count ($dirs))  return $dirs;

	$bp_pages = bp_core_get_directory_page_ids ();
	if (isset ($bp_pages['members']))
	{
		$members = $bp_pages['members'];
		$dirs[$members] = new stdClass;
		$dirs[$members]->label = get_the_title ($members);
		$dirs[$members]->link = parse_url (get_page_link ($members), PHP_URL_PATH);

		$member_types = bp_get_member_types (array (), 'objects');
		foreach ($member_types as $type)  if ($type->has_directory == 1)
		{
			$dirs[$type->name] = new stdClass;
			$dirs[$type->name]->label = $dirs[$members]->label. ' - '. $type->labels['name'];
			$dirs[$type->name]->link = parse_url (bp_get_member_type_directory_permalink ($type->name), PHP_URL_PATH);
		}
	}

	if (!shortcode_exists ('bp_ps_directory'))  return $dirs;

	$pages = get_pages ();
	foreach ($pages as $page)  if (has_shortcode ($page->post_content, 'bp_ps_directory'))
	{
		$dirs[$page->ID] = new stdClass;
		$dirs[$page->ID]->label = $page->post_title;
		$dirs[$page->ID]->link = parse_url (get_page_link ($page->ID), PHP_URL_PATH);
	}

	return $dirs;
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.