This seems to be the better help resource than buddypress itself, therefore I hope someone might help me with that issue.
I want to make users able to insert numeric or bullet lists on their user profile. I worked out to save it as list items in the database but they were not shown on the user profile.
Buddypress removes list items and inserts a <br> tag instead.
I checked the wp author page which shows lists correctly so it must be a buddypress issue.
How can I make that work?
Hi Alex,
Welcome to BuddyDev.The problem is BuddyPress escapes html for all fields except the following:-
1. Multiline text area
2. WordPress Biography and any of the(first name, last name, url)The simple solution is to use multiline text field with rich text area enabled. The other solution will be to disable
bp_xprofile_escape_field_data
from hooking to field value(not recommended unless you can not do without it).
Regards
BrajeshThanks Brajesh,
I would not have such a problem if WordPress would use the latest tinymce one but instead integrates tinymce 4.9 which is very old.I am using the biography field already. This is currently the only solution to me using the cdn-tinymce version 7 – with the problem that it changes bullet lists to words line by line separated by an <br> on the profile view page. The edit page looks fine.
Furthermore I only can use it on the biography field with this code:
function antipole_remove_rich_text() {
return false;
}
add_filter(‘bp_xprofile_is_richtext_enabled_for_field’, ‘antipole_remove_rich_text’);Another solution might be use it on the rich multiline textarea as you wrote.
BUT with using the above code I am only able to integrate tinymce 7 cloud on the biography field and not on the multiline xfield.
Without the code I cannot load it either on the bio nor on the multiline text field.Do you have a solution to make it running on the multiline-textarea field? I would need to get rid of the integrated one and then load the cloud one.
Otherwise I only can prevent buddypress from changing the bullet lists on biography profile view page where I also have no idea how to.
Ok, thanks to GPT I made it work for the multiline xprofile field as well.
But again, I still have the problem that all lists were moved to one line after saving. See screenshots.
https://ibb.co/LpSMyy9
After saving
https://ibb.co/rxY8JqqEditor Source view
https://ibb.co/r2FNKBWWhat do I need to do to avoid this?
Long story short:
1. If using the biography field. How can I prevent buddypress from stripping off html on these field? On user profile edit and view page.
2. If using the rich multiline textarea field. How to use the tinymce 7 cloud version which currently conflicts with the old 4.9 implemented one.Tinymce 4.9 which WordPress and Buddypress uses has security issues. Maybe someone should tell the buddypress dev team for a solution on that??
See this: https://core.trac.wordpress.org/ticket/47218Hi Alex,
Thank you for the replies.I went through the entire thread about the security issues. It is not going to affect when you use it with WordPress.
All the content gets sanitized with kses and only allowed tags get pass, so the issue does not have impact on WordPress.Still, here is a way to disable the kses stripping your tag(It is even more insecure to do it).
add_action( 'bp_init', function () { remove_filter( 'bp_get_the_profile_field_value', 'bp_xprofile_escape_field_data', 8 ); } );
Regards
BrajeshSorry for asking again:
And there is no way to load just the tiny 7 cloud one with wp_editor()?https://www.tiny.cloud/docs/tinymce/latest/editor-and-features/
If I could use the cloud version without switching off rich text options with the code below, no HTML would be stripped off on the frontend profile page.
function antipole_remove_rich_text() {
return false;
}
add_filter(‘bp_xprofile_is_richtext_enabled_for_field’, ‘antipole_remove_rich_text’);- This reply was modified 3 months, 3 weeks ago by Alex.
Hi Alex,
I am sorry, I lack the time to invest into getting tiny 7 work with WordPress.I would suggest opting for one of the solutions from above for now.
Regards
BrajeshHello Brajesh,
Thanks again for your answer. To change the editor might be to much effort indeed because of all the wordpress dependencies which have to be considered.
Therefore I tried your code and added this just for testing. I also tried to disable kses at all:
add_action( ‘bp_init’, function () {
remove_filter( ‘bp_get_the_profile_field_value’, ‘bp_xprofile_escape_field_data’, 8 );
} );
remove_filter(‘pre_user_description’, ‘wp_filter_kses’);But at the profile page, li elements still stripped off. See image.
https://postimg.cc/qzMPggTmFor the biography field richtext is not enabled. How to enable it?
But does BP checking the bio field for richtext possibilities at all?
If not, enabling richtext will make no sense. Any more ideas to solve this on the profile page?The backend shows the tags
https://postimg.cc/dDX2ZxMz- This reply was modified 3 months, 2 weeks ago by Alex.
You must be logged in to reply to this topic.