Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hey folks, I’ve been using this plugin and thought I’d a couple of the recurring questions. The way the plugin works is, you have to manually add the class “multilanguage-input” to the text input element. For instance, if your original code/HTML looks like this:

    <div id="some_meta_field_div">
        <label for="some_meta_field_id">My Meta Field</label>
        <input type="text" id="some_meta_field_id" name="some_meta_field" value="" />
    </div>

    Then you would change it to this:

    <div id="some_meta_field_div">
        <label for="some_meta_field_id">My Meta Field</label>
        <input type="text" id="some_meta_field_id" name="some_meta_field" class="multilanguage-input" value="" />
    </div>

    What happens is, AFTER the page is rendered in your browser, a jQuery script looks over your page for any <textarea> or <input> text fields with that class name, and it applies all the magic at that point.

    (That actually causes some problems in a number of advanced cases, like when you’re using it on a field that gets created with Javascript.. but that’s a topic for another day.)

    By the way, I’ve added some cool styling to mine that you guys might appreciate. If it doesn’t work for you.. well, sorry. I’m not getting paid to support someone else’s plugin 🙂 haha.

    Found somewhere around line 76 of qtranslate-extended.php:

    <style type="text/css">
    			.multilanguage-element{position: relative;}
    
                .multilanguage-inputs{margin-bottom:5px; display:block;}
                .multilanguage-inputs *{display:none;}
                .multilanguage-inputs .current{display:block !important;}
                .multilanguage-flags{
    				padding-top: 2px;
    				display:block;
    				height: 17px;
    				overflow: hidden;
    				position:absolute;
    				top: -19px;
    				right: 1px;
    				background-color:white;
    				border: 1px solid #dfdfdf;
    				border-bottom-color: white;
    			}
                .multilanguage-flags img{margin: 0 3px; opacity:0.4;filter:alpha(opacity=40);cursor:pointer;border:1px solid silver; display: none;}
                .multilanguage-flags img.current{opacity:1 !important;filter:alpha(opacity=100) !important;border:1px solid black !important; display: inline !important; float: right;}
    
    			.multilanguage-element:hover .multilanguage-flags img {
    				display: inline !important;
    			}
    			.multilanguage-element:hover .multilanguage-flags img.current {
    				float: none;
    			}
    
            </style>

    PS — Modifying plugin files directly is generally not recommended. Future updates will almost certainly break your changes (if not your entire site). Use at your own risk!

    creatorbri

    (@creatorbri)

    Yes, I tried both to no avail.

    In an effort to troubleshoot further I managed to “hide” the error by changing this:

    // remove hook so tinymce doesn't load for content
    var hook = tinyMCEPreInit.mceInit['content']
    hook.elements='qtrans_textarea_content';
    delete tinyMCEPreInit.mceInit['content'];
    tinyMCEPreInit.mceInit['qtrans_textarea_content'] = hook;

    To this:

    // remove hook so tinymce doesn't load for content
    var hook = tinyMCEPreInit.mceInit['content']
    if (hook) {
      hook.elements='qtrans_textarea_content';
      delete tinyMCEPreInit.mceInit['content'];
    } else {
      hook = null;
    }
    tinyMCEPreInit.mceInit['qtrans_textarea_content'] = hook;

    Indeed eliminated the error; but I still can’t use them together.

    What seems to be happening is that qtranslate_textarea_content and the CKeditor div both get added at the same level in the Source. I’ll try and produce a screenshot at some point, because the resulting behavior is very strange:

    1. At the top I have my Language tabs (courtesy qTranslate), and my Visual and HTML tabs.
    2. Below that is the CKEditor, if I’m on the Visual tab, or the original ‘content’ textarea if I’m on the HTML tab.
    3. Below THAT is the qtranslate_textarea_content textarea. (Lately its been putting a
      in there, but that doesn’t seem consistent.)
    4. Clicking another language besides the default (English in my case) results in the CKEditor going away, but the English tab remains selected.
    5. As long as WP thinks I’ve selected another language for my editing language, there’s nothing I can do to restore the CKEditor; reloading the page, or adding a new page, makes no difference. Only by clicking the “English” link on the left-side Admin Menu can I restore things to their original state.
    6. Also, typing in the qtranslate_textarea_content textarea below the CKEditor box does nothing useful.
    7. Clicking the HTML tab, by the way, displays the following in the standard ‘content’ textarea:
      <!--:en--><br /><!--:--><!--:de--><!--:--><!--:zh--><!--:-->

    Note that I’m not looking at it now, I had to deactivate the CKEditor plugin and go back to TinyMCE; so I’m not guaranteeing 100% accuracy on anything I just said 😉

    Still, I really hope this helps; I really think my client would be better off using CKEditor than TinyMCE!

    creatorbri

    (@creatorbri)

    I’m using CKEditor 3.6.2.5 and qTranslate 2.5.2.8. I’m getting a Javascript error: “hook is undefined”

    This error occurs in the function qtrans_editorInit3(). Here’s an excerpt from the code where the problem is occuring:

    wpOnload = function() {
        for(var i in tinyMCEPreInit.qtInit) {
          var tmp = tinyMCEPreInit.qtInit[i];
          tmp.id = 'qtrans_textarea_'+tmp.id;
          try { quicktags( tmp ); } catch(e){}
          jQuery('#ed_toolbar').hide();
        }
        // remove hook so tinymce doesn't load for content
        var hook = tinyMCEPreInit.mceInit['content']
        hook.elements='qtrans_textarea_content';	// NOTE: ERROR OCCURS ON THIS LINE
        delete tinyMCEPreInit.mceInit['content'];
        tinyMCEPreInit.mceInit['qtrans_textarea_content'] = hook;
        // fix html for tinymce
        if('html' != getUserSetting( 'editor' )) {
          var ta = document.getElementById('content');
          var texts = qtrans_split(ta.value);
          var content = '';
          content = qtrans_integrate('de', switchEditors.wpautop(texts['de']), content);
          content = qtrans_integrate('en', switchEditors.wpautop(texts['en']), content);
          content = qtrans_integrate('zh', switchEditors.wpautop(texts['zh']), content);
          ta.value = content;
        }
        if(typeof(wpOnload2)=='function') wpOnload2();
      }

    One more thing: It’s rather odd but at first, CKEditor was loading just fine (though I was still getting the “hook” error mentioned above). But when I clicked the qTrans tab to switch to another language, the editor broke completely, and now — even when I switch to editing a new page — CKEditor doesn’t come up at all, and I still get the same “hook” error.

    creatorbri

    (@creatorbri)

    I’d like to know as well.. why is SOAP needed?

    Thread Starter creatorbri

    (@creatorbri)

    Update:

    After getting no response at all from this community, I posted the question on StackOverflow (for more exposure) as well as StackExchange’s WordPress Answers site (for WP expertise). Initially slow there too so I threw in a bounty, and got some really great, useful answers.

    So if you’re searching for similar answers and found this post, I suggest you check my links above. Good luck 🙂

    Thread Starter creatorbri

    (@creatorbri)

    Well, that helps a little.. it tells me how to retrieve a group of posts and iterate over them (I’m sure I can look further into WP_Query to get the pages I need):

    <?php
    $my_query = new WP_Query('category_name=featured&posts_per_page=1');
    while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;
      ?>
      <!-- Do stuff... -->
    <?php endwhile; ?>

    However, I’m still stuck on actually displaying them with my custom “block” template. I didn’t see anything in there about displaying posts with an explicit, alternate template?

    Thread Starter creatorbri

    (@creatorbri)

    You’re right, I misunderstood what you were saying. My mistake was that I missed the part about “subdomains” as well. Subdomains do not apply to my setup; the “client” in http://client.mydomain.com/ just happens to be the location where I store many of my projects, it does NOT point to a WordPress installation.

    So for posterity, let me clarify that my proposed setup was equivalent to the following:
    http://prefix.mydomain.com/subdirectory/wordpress/subsite

    Its the /subdirectory/wordpress/ part that messed me up, but it seems to be working just fine now using a “Subdirectory Install” (NOT a Subdomain install).

    Thread Starter creatorbri

    (@creatorbri)

    @ Ipsetenu — Just want to clarify/reiterate, for the benefit of others who might be trying to achieve something similar, that multisite / network support DOES work when the root WP installation is in a subdirectory of your domain root, so long as the configuration is correct in the first place.

    [Note: It does seem like the referenced passages from WP documentation imply that what I was trying to do was not supported — yet it seems like that is in fact NOT the case, as my installation is now working as desired. I had seen those passages previously, but when I read them before they seemed to refer to installation of WP in a subdirectory but running from your domain root, which is not what I was trying to do here. But my setup is working now, so it’s obviously possible. Go figure.]

    Thanks so much for everyone’s help! Helped me track down the problem, anyway.

    Thread Starter creatorbri

    (@creatorbri)

    Well, it seems to be working now. Or rather, new sites that I create seem to be working; so I just deleted the broken ones and recreated them.

    The only thing I know of that I changed was that I had forgotten to make the blogs.dir directory writable by the web server; however, I can no longer duplicate the problem, so I don’t know if that’s necessarily it.

    @ Jan Dembowski — thanks for the ideas. I can now affirm that this particular configuration DOES work, if everything’s configured correctly — though I don’t know for sure that the permissions problem was the original cause, since I can’t duplicate the issue.

    Thread Starter creatorbri

    (@creatorbri)

    Possible Bug in MultiSite?

    I think the real problem is that the .htaccess file the MultiSite installation generates is NOT correct — due to the fact that my WordPress installation is NOT at the domain root, like most “subdirectory” configurations I’ve seen, but instead the Main (Global/Network) Site is actually itself installed in a subdirectory, /clientname/blogname/!

    This seems like a scenario WP ought to handle, but unfortunately, it does not seem to. What I can’t figure out is: Can I fix this by tweaking my .htaccess file? Or is this a problem with the WordPress MultiSite code?

    Here are the additions to my wp-config.php:

    // Custom additions to enable Multisite support
    define('WP_ALLOW_MULTISITE', true);
    
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    $base = '/clientname/blogname/';
    define('DOMAIN_CURRENT_SITE', 'client.mydomain.com');
    define('PATH_CURRENT_SITE', '/clientname/blogname/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    
    /* That's all, stop editing! Happy blogging. */

    And here’s my .htaccess file:

    RewriteEngine On
    RewriteBase /clientname/blogname/
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+)?wp-admin$ $1wp-admin/ [R,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    Sure hope someone can help me figure this out!

    Thread Starter creatorbri

    (@creatorbri)

    @ davidsword — The users (i.e. japanadmin) were automatically added to their respective sites when I entered their E-mail addresses as the admin user of the site. I just confirmed this in the Network Admin dashboard — “japanadmin” is already associated with the “japan” site.

    @ Ipstenu — Yes, it happens on all the sites, however that problem only manifests itself with the links (although it may somehow be indicative of the larger issue). I have already tried typing the exact, correct URL into the address bar, such as:
    http://client.mydomain.com/clientname/blogname/japan/wp-admin

    This is what gives me the error I described.

    I also tried:
    http://client.mydomain.com/clientname/blogname/japan

    That takes me to the Main (Global, aka Network) website and says it can’t find the japan page. So its clearly not processing the sites correctly, somehow — but again, this is when I type the correct URLs!

    Still need help.. anyone?

Viewing 11 replies - 1 through 11 (of 11 total)