Hi, there
Thanks for the helps before and I’m very appreciated about that.
I just met an issue that in my site, for the purpose of safety, external links shouldn’t be allowed to post into the activity. But currently, by default, when users copy and paste any external links into the activity, the system will recognize the hyperlinks and for Youtube links, it can display videos directly.
I’m wondering that is there any way to don’t allow users to type in hyperlinks in the activity?
Thank you very much.
Hi Dandy,
Thank you for asking,.
There are two things involved here.
1. Oembed:- The generated content you see
2. Hyperlinked:- All other links that don’t support oembedDo you want to disable both?
Hi, Brajesh
Yes, I want to disable both of them.
Thanks.
Hi Dandy,
Please put this in your bp-custom.php and let me know it works for you or not?add_filter( 'bp_use_oembed_in_activity', '__return_false' );
Thank you
BrajeshHi, Brajesh
I tested this code. However, it only disables the embed content, but the hyperlink still be clickable. Can you find a way to disable the external hyperlinks as well?
Thanks.
- This reply was modified 7 years, 8 months ago by Dandy Jefferson.
Hi Dandy,
Thank you.
yes, that was only for oembed.Please add this to the bp-custom.php
function buddydev_disable_activity_links() { remove_filter( 'bp_get_activity_action', 'make_clickable', 9 ); remove_filter( 'bp_get_activity_content_body', 'make_clickable', 9 ); remove_filter( 'bp_get_activity_content', 'make_clickable', 9 ); remove_filter( 'bp_get_activity_parent_content', 'make_clickable', 9 ); remove_filter( 'bp_get_activity_latest_update', 'make_clickable', 9 ); remove_filter( 'bp_get_activity_latest_update_excerpt', 'make_clickable', 9 ); } add_action( 'bp_template_redirect', 'buddydev_disable_activity_links' );
Please do let me know how it goes.
Thank you
BrajeshHi, Brajesh
Thanks for your solution.
I tested it, however, it seems like the hyperlinks still can be posted in the activity.
And the first time it’s still clickable, when I click it, then, it becomes pure text.
Thanks.
Ahh, sorry. I forgot about the first time ajax posting part.
Please change ‘bp_template_redirect’ to ‘bp_init’
That will do it.
Hi, Brajesh
Sorry to reply you late. I used the updated code and it worked perfectly.
Thank you very much.
You must be logged in to reply to this topic.