return false;
}
+/**
+ * Get the URL for the current (or specified) site
+ *
+ * @param int $site_guid The GUID of the site whose URL we want to grab
+ * @return string
+ */
+function elgg_get_site_url($site_guid = 0) {
+ if ($site_guid == 0) {
+ global $CONFIG;
+ return $CONFIG->wwwroot;
+ }
+
+ $site = get_entity($site_guid);
+
+ if (!$site instanceof ElggSite) {
+ return false;
+ }
+
+ return $site->url;
+}
+
/**
* Returns the current page's complete URL.
*
function current_page_url() {
global $CONFIG;
- $url = parse_url($CONFIG->wwwroot);
+ $url = parse_url(elgg_get_site_url());
$page = $url['scheme'] . "://";