How to hide an attribute from other hosts(users) in "requests" extension

So agents create requests from clients to keep track of their work.
I want only the phone number field to be hidden from other hosts/agents and only visible to the super admin and the agent who created the request.


Unfortunately, there’s no such feature, it would require a custom implementation. If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work Fiverr - Freelance Services Marketplace

Please help me find what Hivepress hooks should I use, or what Hivepress filters.
Where can I find them? Please have a look at the example below and correct me if you can.

// Add a function to modify the display of a specific attribute in the HivePress request extension
function hide_attribute_for_other_users($value, $request_id, $field) {
    // Check if the user is logged in
    if (is_user_logged_in()) {
        $current_user = wp_get_current_user();
        // Retrieve the request data
        $request = hivepress()->request->get_request($request_id);

        if ($request) {
            $author_id = $request->user_id;

            // Check if the current user is the author of the request
            if ($current_user->ID !== $author_id) {
                // Replace 'your_attribute_name' with the actual attribute name to be hidden
                if ($field === 'phone_number') {
                    // Modify the value to be displayed for the attribute (e.g., replace it with an empty string to hide it)
                    $value = ''; // Modify this according to your requirement

    return $value;

// Hook the function to modify the attribute value
add_filter('hivepress/v1/forms/request_update', 'hide_attribute_for_other_users', 10, 3);

Thank you for waiting. Please try this PHP code snippet

	function( $value, $field ) {
		if ( 'put your attribute field name here' !== $field->get_name() || current_user_can('manage_network') ) {
			return $value;
		$value = null;

		return $value;

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.