Skip to:
Content
Pages
Categories
Search
Top
Bottom

Block users from posting links

  • @maximemoisan

    Participant

    Hi, I would like to be able to block all users except admin to posts links url in a topic, a posts or even a reply. I’ve tryed this, the only one that I found: https://bbpress.org/forums/topic/how-to-prevent-users-from-posting-url-links/

    remove_filter( ‘bbp_get_reply_content’, ‘bbp_make_clickable’, 4 );
    remove_filter( ‘bbp_get_topic_content’, ‘bbp_make_clickable’, 4 );

    and this doesn’t seem to work when I add thoses lines in my functions php theme.

    Anybody have an idea on how to make this works?

    Thanks you
    Maxime

Viewing 12 replies - 1 through 12 (of 12 total)
  • @maximemoisan

    Participant

    Anybody have an answer to this?

    @maximemoisan

    Participant

    I finally got it too work! Is there a way to make admins be able to make working links? Or it has to be nobody/everyone? Hope you guys can answer.

    Thanks you

    @robin-w

    Moderator

    untested, but this should make the filter only removed if they are not a keymaster

    if ( !bbp_is_user_keymaster()) {
    	remove_filter( 'bbp_get_reply_content', 'bbp_make_clickable', 4 );
    	remove_filter( 'bbp_get_topic_content', 'bbp_make_clickable', 4 );
    }

    @maximemoisan

    Participant

    Did not work sadly.

    Any other idea?

    @robin-w

    Moderator

    did not work

    can you specify? any? all? admins?

    @maximemoisan

    Participant

    no one can post links, wich is good, but the code : !bbp_is_user_keymaster, did not let keymaster be able to do so.

    oh and by the way, bbpress links still works on my forum wich is normal I suppose?

    @robin-w

    Moderator

    ok, try

    $user_id = wp_get_current_user()->ID;
    if ( !bbp_is_user_keymaster($user_id )) {
    	remove_filter( 'bbp_get_reply_content', 'bbp_make_clickable', 4 );
    	remove_filter( 'bbp_get_topic_content', 'bbp_make_clickable', 4 );
    }

    @robin-w

    Moderator

    oh and by the way, bbpress links still works on my forum wich is normal I suppose?

    can you explain what you mean by that ?

    @maximemoisan

    Participant

    Thanks again Robin, i’ve tryed this but is doesnt work either: $user_id = wp_get_current_user()->ID;

    I think the problem is that website that doesn’t use the www. doesnt get blocked and still can be clickable.Exeple: bbpress.org is clickable. but http://www.google.ca isn’t. etc.

    @robin-w

    Moderator

    now confused – you seem to be stating issues with both admin access and www. vs non www

    can you state clearly what is and isn’t working

    @maximemoisan

    Participant

    Alright, when I block links with: remove_filter( ‘bbp_get_reply_content’, ‘bbp_make_clickable’, 4 );remove_filter( ‘bbp_get_topic_content’, ‘bbp_make_clickable’, 4 );

    it seems to work BUT admins can’t post links either even with the code you have sent me.

    Secondly, the links doesn’t work wich is good BUT site that doesn’t provide a “www” can still be clickable so when someone type:” https://bbpress.org ” this link is clickable and both admins and user can do that, and if you type: “www.google.ca” then both admins and user can do that and it WONT be clickable.

    I would like the admins to be able to send link, AND be able to block non www links too.

    Thanks you.

    @uriahs-victor

    Participant

    This is an old topic but the priority on the filters have changed so the remove filter code provided will not work.

    The new priority is 40, so the working code is:

    remove_filter( 'bbp_get_reply_content', 'bbp_make_clickable', 40 );	
    remove_filter( 'bbp_get_topic_content', 'bbp_make_clickable', 40 );
Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.
Skip to toolbar