Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to Modify Content Before Saving if to DB

@vanleurth

Participant

Thank you for the help. Here is my code updated and working properly.

// Check the activity content
function mmAddLocationCategory($activity_content) 
{

    //get the category from POST
	$category = isset($_POST['bpp_ex_custom_dropdown']) ? $_POST['bpp_ex_custom_dropdown']:null;
	
	// Get the location from the user's profile	
	$bp_location = xprofile_get_field_data('Location', bp_loggedin_user_id());
	
	
	// Add category to the content
	if(!is_null($category))
	{
		//update the category to activity meta
		$activity_content = $activity_content . "<br>#" . $category . " #" . $bp_location;
		
	}
	
	return $activity_content;

}
add_filter('bp_activity_new_update_content', 'mmAddLocationCategory', 10, 2 );

The only problem I have to solve now is how to insert a <br> in the content. It seems the filter strips all break html code. Instead of getting;

content 
#singing #city

I get;
content #singing #city

The <br> that is added to the string in the code, gets removed for some reason.

Thank you for your help

V.

Skip to toolbar