Changing a Hard Coded URL Creates and Error

When I try to change a hard coded URL using the Network Wide Text Change option I get the following error.

Warning: preg_replace() [function.preg-replace]: Unknown modifier 'p' in /home/my-site/public_html/wp-content/plugins/ultimate-branding/ultimate-branding-files/modules/site-wide-text-change.php on line 378

This is without the http:// being added to the URL. I get a similar error when I add the http://

Any suggestions for a work around to this error?

  • Emanaku
    • The Incredible Code Injector

    Hi orangethermal,

    I could reproduce this error on my system.
    The reason seems to be that the code for the replacement does not transform the slashes "/" in the text to search for into "secure" letters for a replacement pattern (the slash is one of the meta characters for the function preg_replace).

    Basically that has to be fixed in the code of the plugin.

    Workaround: you can put an "\" in front of every "/" in the search text (field "Find this text"). E.g.: "http:\/\/wordpress.org\/plugins\/" (instead of "http://wordpress.org/plugins/").
    Caveat: As soon as the plugin is fixed by the developer you have to remove the backslashes "\" from your search texts, otherwise your texts will not be found any more ...

    Have fun!!

  • aecnu
    • WP Unicorn

    Greetings orangethermal and Emanaku,

    @Emanaku thank you for your input, it is greatly appreciated.

    This plugin was never intended to be used to change URL's nor does it indicate that it will do so anywhere - it is designed to change text as the description implies Network Wide Text Change.

    However, as Emanaku has kindly pointed out that possibly with a bit of a coding change it can indeed be made to also successfully address URL's and this is what I am going to run by the lead developer of Ultimate Branding for his input on the likelihood of this happening.

    Though this may take a bit longer then a normal ticket, I will try to get his invaluable insight and comment in here asap.

    Thank you both for being WPMU Dev Members!

    Cheers, Joe

  • aecnu
    • WP Unicorn

    Greetings orangethermal and Emanaku,

    Thank you for your patience folks, it is greatly appreciated.

    Can either of you folks confirm or deny that this issue was addressed in the last update Version 1.0.3 which was released after this ticket was created?

    Please advise.

    Cheers, Joe

  • aecnu
    • WP Unicorn

    Greetings orangethermal and Emanaku,

    We have not heard back from you as to the status of this issue.

    If you are still having an issue please let us know so that we may try to get you fixed up as soon as possible by choosing to check mark this ticket as unresolved below and posting any new errors or symptoms you are noticing.

    This action will also bring your ticket up front back in plain view again within the ticket system.

    Thank you for being a WPMU Dev Community Member!

    Cheers, Joe

  • Sandor
    • WordPress Warrior

    Hi there,

    I asked if the workaround mentioned in this thread had worked for anyone - I'd still like to know...
    Do you know if it does?

    If the plugin replaces text - it should work with links as they are made of text (the "T" in HTML). A URL looks different because of how the browser renders it - but it's just plain text being sent over the interwebs...

    Let me rephrase the problem...

    The issue is that the plugin crashes when you try to replace the character "/".

    Can this be fixed?

    Thanks!
    -Sándor

  • aecnu
    • WP Unicorn

    Greetings Sándor,

    Thank you for the additional input, it is certainly appreciated.

    You are missing the point that this is not it's intended use, therefore it is not broken.

    Taken directly from the Ultimate Branding plugin's page:
    “Network Wide Text Change” is basically “search and replace” for the backend of your WordPress site. Automatically change the word “WordPress” to the name of your business – everywhere.

    Make note that the URL does not appear anywhere in this description, it clearly says Automatically change the word and obviously a URL is not a word.

    Of course URL changing can certainly be submitted as a feature request.

    Please advise where this is indicated as intended use, changing a URL, and I will certainly concede my position with apologies for being incorrect.

    Cheers, Joe

  • Sandor
    • WordPress Warrior

    Hi Joe,

    I think I was not clear... This has nothing to do with URL's specifically - let's move the conversation away from that completely...

    I'm saying that a single text character is causing the plugin to die, the "/".

    Also - I've asked a couple times, but I'm still not sure if anyone has seen the workaround work - that was really my main questions... Do you know if it worked?

    Thanks,
    -Sándor

  • aecnu
    • WP Unicorn

    Greetings Sándor,

    Thank you for your last reply and clarification which I am still trying to get my head wrapped around.

    I have used this plugin myself for changing many text items without an issue.

    It has never added or subtracted a "/" - can I have an example please of this issue so I may indeed try to replicate it?

    Please advise.

    Cheers, Joe

  • Sandor
    • WordPress Warrior

    It's been a minute since I've been focused on this issue - but if I recall, all you have to do to recreate the bug is put a "/" in the replacement request.

    If that doesn't produce the issue for you - I'll see if I can dig deeper... Thanks!

  • aecnu
    • WP Unicorn

    Greetings Sándor,

    Indeed that reproduces the issue and the only way to get my network back was to use ftp and rename the plugin.

    Warning: preg_replace() [function.preg-replace]: Unknown modifier 'o' in /home/aecnuwpm/public_html/wp-content/plugins/ultimate-branding/ultimate-branding-files/modules/site-wide-text-change.php on line 37

    And it crashes hard.

    Therefore I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • Barry
    • DEV MAN’s Mascot

    Any reason other things are being implemented while this bug remains?

    The 1.1 release is a fixed version of the old 1.0.5 release with the aim of fixing the issue that made us have to revert back to version 1.0.3. Now that it is out and there are no reports of the same issue we can move forward and get other bug fixes in the next few updates.

  • aecnu
    • WP Unicorn

    Greetings Sándor and Barry,

    @Barry thank you for the update Chief but even afterwards when I enable Ultimate Branding 1.1 I still get a mass of issues, certainly due to the "/" still being in the database somewhere. Error screen shot below.

    @Sándor Happy to see that you have managed to get this resolved with the latest update and thank you for being a WPMU DEV Community Member!

    Cheers, Joe

  • Barry
    • DEV MAN’s Mascot

    @aecnu - as I posted a few posts up

    The 1.1 release is a fixed version of the old 1.0.5 release with the aim of fixing the issue that made us have to revert back to version 1.0.3. Now that it is out and there are no reports of the same issue we can move forward and get other bug fixes in the next few updates.

  • aecnu
    • WP Unicorn

    Greetings @Barry,

    Can you please advise sir where to find the entry I made in the database?

    I cannot figure out where it is storing the info i.e. "/"

    I only inserted this to try to help another member confirming the issue and now I cannot use the plugin at all on my test installation. Of course I can always do a complete re-install - but that would take hours.

    Cheers, Joe

  • Barry
    • DEV MAN’s Mascot

    @aecnu - are you on single WP or multi-site? If multi-site, do you have the plugin activated as a single site plugin or network activated?

    You need to look in wp_options for single site / or single site activated and wp_sitemeta for multisite network activated.

    Delete the entries with the name / key beginning with translation_

  • xbladerunner
    • Syntax Hero

    1.1.1 isn't working for me, even after deleting tables in phpadmin mentioned above. 1.0.3 does work (after I delete tables), so I'd recommend reverting back to that until all this is straightened out. I use the / key for making replaced text italic or bold, as well as for creating links, so its a big deal to have lost that branding functionality in the recent updates. Thanks for all the work you guys do.

  • Barry
    • DEV MAN’s Mascot

    Can you write *exactly* what you are putting in each box on the form to cause the error, because I've tried a lot of test strings and can't duplicate it now.

    They are recreated when you reinstall the plugin. So, when 1.1.1 was reinstalled, the tables were recreated, but so was the bug.

    Can you we be clear here - you mean options or records, not tables yes?

    Can you do the following then -
    In phpmyadmin open the wp_sitemeta table and find the records with a meta_key starting with translation_ and delete them (the records *not* the table).
    Then open the wp_options table and find the records with an option_name starting with translation_ and delete them as well (again the records *not* the table).

    *THEN* install and activate version 1.1.1

  • xbladerunner
    • Syntax Hero

    Records, not tables, sorry for the confusion. (One of the records deleted is called the translation_table, but still my technical error). I deleted the records and reinstalled 1.1.2, again, and get the error again whenever I use the / character. Installing 1.0.3 does not produce the error.

    Specifically and </b>, when used creating a link or bold text in the replacement text field, I get <\/a> and <\/b> displayed in the output. See attached.

  • Timothy Bowers
    • Chief Pigeon

    Hiya, just going through some of the older threads here.

    As it's been a little while since we last heard from you I thought I'd check in to see how you're going?

    If you're still looking for some further assistance with this thread then please feel free to reopen the thread or of course for any new and related issues you are most welcome to open a new thread.

    Thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.