J0k3R^
  • *****


      Reputation : 11
      Registered on : 2014-04-25
      Posts : 153
      Love Fmcodes
    Hi, i want to use a js code which replaces the content of the post that a user wrote with another one. if someone writes 'thanks' as post at any topic of my forum, i want to replace and say 'thank you very much'. how can i do that? thanks

    Anonymous
    • Guest

        Hi J0k3R^

        You don't need JS to do this :)

        Here are some screenshots (the forum used for the screenshot is in French but I think it works the same way)

        Admin panel > General > Censure

        Replace post content with specific text Tzl3rhS
        Replace post content with specific text TE6AoYj

        You just add your word and the replacement and it will be OK ^__^

        EDIT : You need to put "Thank*" and "Thank you very much". Actually it won't work with the same words :/



        Last edited by Nihil on Sat May 31, 2014 2:31 pm; edited 2 times in total

        J0k3R^
        • *****


            Reputation : 11
            Registered on : 2014-04-25
            Posts : 153
            Love Fmcodes
          why i get this error?

          Replace post content with specific text SOizCFf

          ddoesmc
          • Support Moderator

              Reputation : 9
              Registered on : 2014-03-11
              Posts : 299
              Helping on the forum
            So this is what the warning is telling you, if you put "Thanks" as the censored word you can not include "Thank,Thanks" etc. in the word you want it to come out to be. This may be a bit unclear.



            FMCodes Support Moderator

            I am very active now! Feel free to PM me anytime.
            J0k3R^
            • *****


                Reputation : 11
                Registered on : 2014-04-25
                Posts : 153
                Love Fmcodes
              ah i understood. but why they do that? :/ i needed to replace thank you with thank you very much xD

              Anonymous
              • Guest

                  Juste write : Thank* for the word (add the * at the end) :)
                  This way it will change thank and all other words starting by thank ^^ (including thanks).

                  Niko
                  • Administrator

                      Reputation : 319
                      Registered on : 2012-02-22
                      Posts : 2366
                      School of codes courses: coming soon
                    Try adding this javascript
                    Code:
                    $(function() {
                        var c = document.querySelectorAll('.entry-content')
                        for (i=0; i<c.length; i++) {   
                          c[i].innerHTML = c[i].innerHTML.replace(/thanks/g,'thank you very much');

                        }
                    });

                    it will replace thanks to thank you very much (only if it's thanks, with Thanks it won't work)



                    Niko wants you in the team Guest

                    Community manager and Administrator at Forumattivo.com

                    J0k3R^
                    • *****


                        Reputation : 11
                        Registered on : 2014-04-25
                        Posts : 153
                        Love Fmcodes
                      Niko your code didnt work.
                      Nihil thank u, im using this and it works.
                      my problem is solved unless Niko got an alternative js :)

                      Anonymous
                      • Guest

                          Cool :)

                          Just be sure to know that if you post "Thankfull", it can replace your word :/.

                          Niko
                          • Administrator

                              Reputation : 319
                              Registered on : 2012-02-22
                              Posts : 2366
                              School of codes courses: coming soon
                            ops

                            Code:
                            $(document).ready(function(){
                                var c = document.querySelectorAll('.entry-content')
                                for (i=0; i<c.length; i++) {   
                                  c[i].innerHTML = c[i].innerHTML.replace(/thanks/g,'thank you very much');

                                }
                            });



                            Niko wants you in the team Guest

                            Community manager and Administrator at Forumattivo.com

                            J0k3R^
                            • *****


                                Reputation : 11
                                Registered on : 2014-04-25
                                Posts : 153
                                Love Fmcodes
                              still nothing.. :P

                              J0k3R^
                              • *****


                                  Reputation : 11
                                  Registered on : 2014-04-25
                                  Posts : 153
                                  Love Fmcodes
                                as u see Niko, u tried it yourself and didnt work :)
                                (this js was also affecting other js codes)
                                but its okey if we cant do something for this, i will use the thing from the "General" tab...

                                ionuz
                                • ****


                                    Reputation : 4
                                    Registered on : 2012-05-05
                                    Posts : 58
                                  Try.
                                  Code:
                                  $(function() {
                                     $('.entry-content').each(function(a, c) {
                                        c.innerHTML=c.innerHTML(/your words/i, "replace text");
                                     });
                                  });

                                  ddoesmc
                                  • Support Moderator

                                      Reputation : 9
                                      Registered on : 2014-03-11
                                      Posts : 299
                                      Helping on the forum
                                    Hello,

                                    As anyone replied to this topic after 15 days from the latest comment's date, the problem is considered solved or abandoned.

                                    This topic is locked and moved to the appropriate section, thanks for the opening of another topic, of course be care of Respecting the rules. You can ask to open this topic again sending a private message to a team member

                                    See you on fmcodes



                                    FMCodes Support Moderator

                                    I am very active now! Feel free to PM me anytime.