[buddypress-dev] Suggestion to add filter when rendering profile field values

Andy Peatling andypeatling at automattic.com
Sun Sep 14 23:37:46 GMT 2008


Great stuff, I haven't really added any BP hooks or filters yet.  
Definitely need to go through and add ones where they make sense. I'll  
add this one, and if anyone else has good suggestions for hook and  
filter locations feel free to submit a patch or reply to this thread.

Cheers
Andy

On 12-Sep-08, at 11:18 PM, phlux0r wrote:

> Hey Andy,
>
> a bit of background for the suggestion: one of our profile fields is  
> a URL to an external website. Currently there's no way to render  
> this field with a link when someone enters a URL so I thought that  
> if would be cool if the bp_the_profile_field_value() function would  
> add a filter whereby users could add their own filter processing  
> functions to mangle the output (like I've done in my hack below...).  
> So I've added the filter as shown:
>
> ....
>   // HACK added filter here for custom processing
>   $field->data->value = apply_filters('bp_render_field_value',  
> $field->data->value);
>   // end HACK
>   if ( BP_FRIENDS_IS_INSTALLED )
>       echo stripslashes($field->data->value);
>   else
>       echo stripslashes($field->data->value);
> }
>
>
> This allows me to run a custom function and render my URL nicely...
>
> Regards,
> Robert
> _______________________________________________
> buddypress-dev mailing list
> buddypress-dev at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/buddypress-dev


---------
Andy Peatling | Social Engineer | Automattic
http://apeatling.wordpress.com






More information about the buddypress-dev mailing list