Skip to:
Content
Pages
Categories
Search
Top
Bottom

Stopping html codes and more…

  • @goakes

    Participant

    Hello

    WordPress 4.3.1 running Weaver Xtreme Child theme. Buddypress Version 2.3.3.

    Activity

    I have 3 questions and apologies for having adding these questions separately elsewhere. Refer to the link above.

    1. Under members, I have a lot of spam messages. This question is in two parts: a) If I click to “View” the message (not the html link), in the majority of cases I’m taken to the error page. I’m not clear why this is the case? b) Is there a way to disable html coding in these message boxes?

    2. How do you get the edit facility to appear under Profile? I have Extended Profiles checked. I can only see “View” and “Change Profile Photo”.

    3. Is there a way to disable the html coding for all of the message boxes i.e. site-wide, private, public, groups and members?

    Hope you can help

    Gary

Viewing 5 replies - 1 through 5 (of 5 total)
  • @henrywright

    Moderator

    a) If I click to “View” the message (not the html link), in the majority of cases I’m taken to the error page. I’m not clear why this is the case?

    Did you happen to delete those activity items? The reason I think you are getting the error page is because those activity items don’t exist.

    b) Is there a way to disable html coding in these message boxes?

    Yes. You need to filter the text so that all HTML tags are stripped out. There are WordPress functions that can do this for you. See wp_filter_nohtml_kses().

    Ref: https://codex.wordpress.org/Function_Reference/wp_filter_nohtml_kses

    2. How do you get the edit facility to appear under Profile? I have Extended Profiles checked. I can only see “View” and “Change Profile Photo”.

    This could be a theme issue. Try activating TwentyFifteen to see if you get the edit facility appear.

    3. Is there a way to disable the html coding for all of the message boxes i.e. site-wide, private, public, groups and members?

    Yes, but it isn’t as straightforward as updating a setting. You’ll need to filter each one, using wp_filter_nohtml_kses() to strip out the tags, as mentioned above.

    Hope this helps!

    @goakes

    Participant

    Hello

    Thank you for your response. I feel I’m being a pain. I’m struggling to get this function to work. Is it possible to give an example of the coding for say the site-wide comment box and the strings to be inserted for the other comment boxes.

    I would really appreciate your help. Note it is the links I’m trying to prevent working.

    Gary

    @henrywright

    Moderator

    Here’s an example which strips all HTML from the text of activity comments:

    function filter_activity_comment_text( $content ) {
        $content = wp_filter_nohtml_kses( $content );
        return $content;
    }
    add_filter( 'bp_activity_comment_content', 'filter_activity_comment_text' );

    Note, this won’t strip HTML from activity items that already exist.

    @goakes

    Participant

    Hello Henry

    Just to check the code is inserted in the child theme functions.php? If not where is the code inserted?

    Gary

    @henrywright

    Moderator

    Hi @goakes

    Yes that’s right, you can copy and paste the code into your child theme’s functions.php file.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Stopping html codes and more…’ is closed to new replies.
Skip to toolbar