Skip to:
Content
Pages
Categories
Search
Top
Bottom

Block users from posting links


  • maximemoisan
    Participant

    @maximemoisan

    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

    @maximemoisan

    Anybody have an answer to this?


    maximemoisan
    Participant

    @maximemoisan

    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

    @robin-w

    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

    @maximemoisan

    Did not work sadly.

    Any other idea?


    Robin W
    Moderator

    @robin-w

    did not work

    can you specify? any? all? admins?


    maximemoisan
    Participant

    @maximemoisan

    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

    @robin-w

    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

    @robin-w

    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

    @maximemoisan

    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

    @robin-w

    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

    @maximemoisan

    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

    @uriahs-victor

    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