No announcement yet.

Phrases taken by AJAX and plugin system

  • Filter
  • Time
  • Show
Clear All
new posts

  • Phrases taken by AJAX and plugin system


    I cannot find how to change phrase value taken by AJAX. Exact example:
    I see in global.js that phrase please_enter_your_reason_why_you_want_to_flag_this_post is in precache table
    window.vBulletin.phrase.precache = D.merge(window.vBulletin.phrase.precache, ["admin", "admin_auth", "all_changes_made_will_be_lost_would_you_like_to_continue", MANY OTHERS HERE, "please_enter_your_reason_why_you_want_to_flag_this_post"]);
    I see there also that phrases are taken by AJAX:
        window.vBulletin.phrase.remoteGet = function (H, J) {
    ...SOME CODE HERE...
                    url: vBulletin.getAjaxBaseurl() + "/ajax/api/phrase/getPhrases",
                    async: false,
                    data: ({
                        phrases: I
                    type: "POST",
                    dataType: "json",
    I hooked into phrase.php getPhrases, put logs there but the phrase please_enter_your_reason_why_you_want_to_flag_this_post is not taken at all. I added logs into most od phrase.php methods (by plugin) and there is no sign where or when this phrase is taken. It is not taken by getPhrases method I hooked into. It is not included in HTML sources. Is it some bug and AJAX omits plugin system or I'm looking in wrong place? (I cleaned cache to be sure that it is not taken from cache). I checked also browser tools - I was looking for Network details and I don't see there any request for those phrases.

    How can I hook to those AJAX requests? Is it really AJAX request in this case? The text is used when you click "Flag" option for post.
    vBulletin Enterprise Translator (vBET) - your forum in 52 languages!

  • #2
    As far as I am aware, many phrases are cached in the user's local storage on the client. The retrieval accesses that to pull the phrase and display it. You would have to have your phrase cached with these. Not sure how it works specifically though. Will try to get a developer to review this topic for more information.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud customization and demonstration site.
    vBulletin 5 Documentation - Updated every Friday. Report issues here.
    vBulletin 5 API - Full / Mobile
    I am not currently available for vB Messenger Chats.


    • #3
      Which vB-version are you using? Looks like this Phrase is not used anywhere (in js-files) in vB 5.5.0. But it exists in the phrases.
      Last edited by delicjous; Mon 11th Feb '19, 12:27am. closed!


      • #4
        I'm using vb5.4.5 and the issue is not with this exact phrase (wchich is used anyway, because I see its text on page - you will see it too, when you click "Flag" under any post). The issue is with loading prases by AJAX and not working plugins in those cases. We have phrase.php where we can hook our code, but it seems that it is not always working and some phrases are taken ignoting plugins. This is the case here.

        vB 5.5.0 requires PHP7 and in lot of servers it is not available yet, but I can tell you that in vB5.5.0 the phrase is also used - I see it on your forum. I also gave you exact location where it is included in JS and I checked sources of 5.5.0 - It is there. So... Maybe simple search whole project will help you to find it. It is there.
        vBulletin Enterprise Translator (vBET) - your forum in 52 languages!


        • #5
          It is located in global.php, found it now.
          HTML Code:
          Use it in templates like:
          HTML Code:
          {vb:phrase please_enter_your_reason_why_you_want_to_flag_this_post}
          Don't know what you want to do, but you should not place code in core-files. You could use the API instead.


          • #6
            Please read with understanding. I'm writing all the time that I'm using plugins, I never wrote that I changed any ot core-files. But your plugin system works wrong, because vb5 code in unpredictable places omits plugin system. I want simple think - I want plugins to work as they should. Now those are not working, because your code ommits it in some places. I to not need to know jow to use the phrase. I'm writing you that when it is used by YOUR CODE then my plugin is not active, because you have bad code, which omits plugin system.
            For example (vb5 code):
                                    array($channelsInfo[$item['channelid']]['htmltitle'], $item['authorname'], $this->callvBDate($dateformat, $item['publishdate'])
            Omits plugin system so my hooked code is not working for phrase 'rss_91_forum_w_posted_by_x_post_time_y_at_z'. And it doesn't matter what I want to do in my hooked code. It matters that vb5 created plugin system which is not working correctly.

            And I still didn't get answer for my question. How I can hook to getting phrases by AJAX? You made phrase.php to hook there, but vb5 code is full of bugs and proper hook is not working here (I just gave you example of such bug, which makes plugins not working for designed finctionality).
            vBulletin Enterprise Translator (vBET) - your forum in 52 languages!


            • #7
              I'm not entirely clear on what you are trying to do. Remote get is only called if the phrase is not cached locally. This is cached in browser storage and that's not always cleared by clearing the browser cache. Updating the phrases in the site admincp (you can just save a phrase without changing it) should force the browser to reload all of the phrases.


              • #8
                How hard is to understand that your own product (vBulletin) has plugin system and I want to use it with predictable results, but vBulletin is buggy and has lot places where its code omits its own plugin system. All I want, is that your plugin system works correctly and when phrase is taken, my plugin code will execute. This has nothing to do with any cache. This is your wrong code, what I show you in exact vBulletin source code (the last example is used during RSS generation).

                What I'm trying to do? I'm trying to use your plugin system in phrase.php plugin, but your code has bugs and the plugin system is not always executed. Maybe there is some other plugin for special cases - like those described - maybe I'm not using right method from the plugin? Maybe... but as I see in vBulletin source code you just ignore plugin system in many places. Still I hope, that I'm doing something wrong, and someone can give me answer how to hook to AJAX requests for phrases, because plugin method I'm using is not executed for those.

                Also I hope that vBulletin team will make plugin system work correctly and not ommit it in any place, so plugins can work predictable.
                vBulletin Enterprise Translator (vBET) - your forum in 52 languages!


                • #9
                  If you tell us what exactly you're trying to do, that will help us identify what the problem is and how it can be fixed.

                  Are you trying to change the text in the "please_enter_your_reason_why_you_want_to_flag_this_post" phrase with your plugin?


                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.