/** * Renew the last directory cookie if the user is viewing a group's docs library. * * @since 1.9.0 */ public function set_directory_cookie() { if (bp_docs_is_group_docs()) { @setcookie('bp-docs-last-docs-directory', home_url($_SERVER['REQUEST_URI']), 0, '/'); } }
/** * Output data for JS access on directories. * * @since 1.9 */ function bp_docs_ajax_value_inputs() { // Store the group ID in a hidden input. if (bp_docs_is_group_docs()) { $group_id = bp_get_current_group_id(); } else { // Having the value always set makes JS easier. $group_id = 0; } ?> <input type="hidden" id="directory-group-id" value="<?php echo $group_id; ?> "> <?php // Store the user ID in a hidden input. $user_id = bp_displayed_user_id(); ?> <input type="hidden" id="directory-user-id" value="<?php echo $user_id; ?> "> <?php // Allow other plugins to add inputs. do_action('bp_docs_ajax_value_inputs', $group_id, $user_id); }