NextGEN Gallery still pointing to local drive - wordpress

I recently moved a wordpress site from my C: drive to a pre-production environment, linux-based machine. The site works well-ish now.
I am using NextGEN galleries there and am using custom gallery theme. This is the problem: After moving, for some reason the galleries refer to the gallery with absolute path of the C: drive, which is obviously not working since this is another machine. I looked into the database to see if there's any value starting with C:\ and indeed I found out several of them and corrected them from C:\xampp\htdocs/wp-content/themes/subspace\nggallery\gallery-subspace.php to wp-content/themes/subspace\nggallery\gallery-subspace.php. However, after refreshing the page which used the gallery in WYSIWYG editor of WP and checking its settings, it stil referred to the template on the C: drive (namely, this is on the "display galleries tab", under "Customize the display settings", it is the value of the "Template" setting).
I checked the database again and there was no path like this in it. I refreshed the page, no difference. I got irritated and went to get a cup of coffee. When I returned, I ran the database query without any modifications again and found this in the wp_options table, option name "_transient_e4ae686b7454a142b0618b1ff15b38f4":
O:8:"stdClass":17:{s:2:"ID";i:4018;s:13:"post_password";s:0:"";s:10:"menu_order";i:0;s:16:"display_settings";a:20:{s:27:"override_thumbnail_settings";s:1:"0";s:15:"thumbnail_width";s:3:"120";s:16:"thumbnail_height";s:2:"90";s:14:"thumbnail_crop";s:1:"1";s:15:"images_per_page";s:2:"24";s:17:"number_of_columns";s:1:"0";s:15:"ajax_pagination";s:1:"1";s:20:"show_all_in_lightbox";s:1:"0";s:23:"use_imagebrowser_effect";s:1:"0";s:17:"show_piclens_link";s:1:"0";s:17:"piclens_link_text";s:14:"[Show PicLens]";s:19:"show_slideshow_link";s:1:"0";s:19:"slideshow_link_text";s:16:"[Show slideshow]";s:8:"template";s:73:"C:\xampp\htdocs/wp-content/themes/subspace\nggallery\gallery-subspace.php";s:19:"use_lightbox_effect";b:1;s:23:"display_no_images_error";i:1;s:18:"disable_pagination";i:0;s:17:"thumbnail_quality";s:3:"100";s:19:"thumbnail_watermark";s:1:"0";s:20:"ngg_triggers_display";s:5:"never";}s:8:"order_by";s:9:"sortorder";s:15:"order_direction";s:3:"ASC";s:10:"exclusions";a:0:{}s:13:"container_ids";a:1:{i:0;i:37;}s:22:"excluded_container_ids";a:0:{}s:9:"sortorder";a:0:{}s:10:"entity_ids";a:0:{}s:7:"returns";s:8:"included";s:20:"maximum_entity_count";s:3:"500";s:6:"source";s:9:"galleries";s:12:"display_type";s:35:"photocrati-nextgen_basic_thumbnails";s:4:"slug";N;s:8:"id_field";s:2:"ID";}
Which, as you can see contains the C:\ path again. I'm 100% positive this wasn't in the database a while ago and repeated the process with the same result (corrected this, waited a minute and it appeared again). Is it possible that this is pulled e.g. from some file?

You can follow the steps mentioned below:
In the wp-admin, go to "Gallery" -> "Other options" then, Click to "Lightbox effects" tab and Click "Show advanced settings" there, you'll find option to change the stylesheet and javascript urls. Change from 'localhost' to your baseurl or ( 127.0.0.1 ). Then save. Thats all.

Let me see if i can help.
Warning : do not try on production, get a dev or appropriate local version running. Also -- can't remember using NextGen, so my advice comes from a desire to do "best" practice in WP.
Easy try : kill cache if used such as JetPack or similar.
Regrading the _transient - should be able to kill -- this link Can I remove transients in the wp_options table of my WordPress install? seems to be dialed in. So if there is a cached element in the mix...bingo.
Next thing is the C:\...stuff rendered in the page source / html? If so, how is it rendered in the page (HTML please)? In other words, what part of the execution is writing C:\... to the page and why? WP has a bad habit of adding the site to the link (grr!). For example image src attribute will have the ``http://``` :
<img src="http://example.com/uploads/whatev..."
And this is written in the wp_posts table (fun migration issues esp if you change url) - so there is a slim possibility that the gallery info with the C drive ref is in the post or similar.
iD10t check: no config setting you missed in gallery? I hope there is not a 3rd party server/storage as #Hareesh mentioned!
Desperation (done this a few times) : dump the MySQL, get a large text editor and search for the string. Remember that weird stuff could be escaped as a " may turn into \" or the use of alternative "safe" quotes. See what can be learned.
Always an option : reinstall in a new WP site and see what/how things go.
If I think of anything else I will add it, but I just spilled how I would try to dissect the issue. GOOD LUCK.

You can use a search and replace tool to replace all C:/... instances with the correct ones.
But be sure to make a full DB backup beforehand, in case something breaks...

Related

Absolute external links bug, url of the current page added at the beginning of the url

I have a very strange external links behavior on this page:
https://dev.switchonpaper.site/en/daniel-g-andujar-the-artist-as-a-thinker-and-augur-of-what-happens/
There is a list of external links visible by clicking on "Go Deeper".
On some links, the address of the current page is added at the beginning of the external link.
E.g.: iSAM™ (1997)
E.g.: TTTP Photo Collection - 1997
All external links are absolute links.
When you look at the source code, the links are correct.
This site runs under Wordpress, the links are contained in a Gutenberg block built with the ACF plugin.
I tested the following things:
Disable all plugins.
The browser or something else continues to add the current page address on some links only.
I emptied the server cache, removed all the .htaccess rules except the wordpress part.
I made sure that the PHP file that writes these links is in UTF-8.
By recreating the links, it is always the same ones who are affected.
Does anyone have any idea what could cause this?
Thank you for your time and help!
You have the so called "hidden characters" before your link start. I suggest you to check it by yourself with some online tool like this: https://www.soscisurvey.de/tools/view-chars.php. If you try to paste there the link copied by your source code you will see you have hidden stuff before "https:..."
The solution to this issue is that you delete all the characters and you write them all over again by yourself, w/o copy/pasting them from another source or in alternative paste them inside some non-HTML text editor before pasting them to your website

What wordpress plugin generates '<meta http-equiv="imagetoolbar" content="no">' line of code

This line of code appears in the html of my wordpress website.
<meta http-equiv="imagetoolbar" content="no"><!-- disable image toolbar (if any) -->
It is some legacy code relating to images on IE6, and is no longer needed.
It's invalid html, in fact.
I want to remove it, but I cannot find where this line of code was generated.
It does not appear to be in any theme files.
Does anyone know what plugin might have produced that line of code?
In my case the plugin "All In One Wordpress Security" added the code as part of it's "Copy Protection" security setting.
It is located under:
Dashboard -> WP Security -> Miscellaneous -> Copy Protection..
[ ] Check this if you want to disable the "Right Click", "Text Selection" and "Copy" options on the front end of your site.
As pointed out by #sparky It is not necessary to hunt down references to this line of code or remove it from one's website.
In my case I became obsessed in achieving 100% HTML validation.
As #sparky noted in comments to his question "...It's only applicable to IE version 6 and all other browsers will ignore it."
He also updated his answer to indicate that IE8 and IE7 no longer reference it.
While HTML validation notes it as an "Error", in practical use it is not harmful, and does not necessarily need to be removed.
If you do want to remove this code, there are a couple of methods you can use to find where it is being added to your website (assuming WordPress - modify as needed)
search your /wp-content/plugins folder for the term imagetoolbar (suggested by #anmari)
disable plugins one by one (or via divide and conquer), empty all caches (including CDN), View Source (or run validator) ... until the code goes away. Or do the same in reverse: Disable everything, then enable to find the culprit.
On my site there were two plugins that could add that code were:
"CornerStone"
"All In One WP Security & Firewall" (as labeled in the WordPress.org plugins repo),
("All In One WP Security" as listed under your site Plugins, and
"WP Security", as labeled in your Dashboard)
AnMari notes that "gravityforms" and some themes may also use this code.

Display images in template file

I have one template file for the main page, after creating home page I have added text to check if it reflect changes on my home page or not and it was successfully displaying text. But when I try to add image by clicking on add media option then image is uploaded but not displaying on my page. What piece of code should be used to get this image on my template file or any other suggestions?
i'am pretty sure u need to SETUP CHMOD to 744
because its randomly set to 600.
This means it is not public visible.
1.You just need to get an FTP Programm,
2.Connect to your Webspace,
3.Go to your Uploadfolder,
4.Choose Your Image to Show with an RightClick,
5.and set CHMOD to 744.
I'll show u here (FLASHFXP)
(Attribute set = READ)
I need to do this for every picture, so u will need to do it too.
Okay i didnt knowed that ;)
You can also try to set the file permissions via rightclick on the File in your Windows-System.
Like This:
http://i.imgur.com/wBptC7s.png
make sure you have Admin-Privileges and the File is allowed to be read, change and execute, then it should work.
There is another Option
i recommend to Setup Wordpress to "DONT SORT UPLOADED FILES" to seperate folders like "per month", "per year" and this kind of Stuff, its better to have them Uploads all in ONE-Directory.(Thats my experience)
In the past i also had my Problems with the Uploads, and it all occurred just because of the "Multiple Folder Uploads" that Wordpress makes.
To change that go to:
Settings -> Media -> Sort Uploads by...
I recommend you to get a Free-Webspace for testing purposes, in my opinion its more comfortable to work online, and you can access it from everywhere you are :) Work never stops
you can add any custom field with this module https://wordpress.org/plugins/advanced-custom-fields/. And can easily add it to your pages and posts.

How to make sure changes to a Wordpress plugin won't be lost on plugin update?

I'm pretty sure I've read somewhere that you can actually move the main plugin *.php file to somewhere else (I assume under your theme directory) to have it safe in case you made changes to it and your plugin updates. I tried Google but I can't find anything. Google page with good results will suffice.
I've just experienced a situation where my 2 plugins which had its layout changed and accommodated my needs and I want to make sure it doesn't happen again. Apart from having the main file in another location, is there a way to move along any CSS and JS files as well?
In Concrete5 CMS there is a nice way of doing this, by creating a new folder inside a block of an addon (may be regarded as a WP plugin), inside of which you can create copies of main file, any CSS and JS files and then you can simply edit them and choose that template for a page location you are using that block in.
I assume there is no such thing in Wordpress but how close can I get?
UPDATE: I found where I applied that advice on creating a new instance of the file then moving it to the theme directory.
The plugin in question was HL-Twitter. These are the plugin files:
admin.php
archive.php
functions.php
hl_twitter.php
hl_twitter_archive.php
hl_twitter_widget.php
import.php
widget.php
Now, this is the top contents (commented out) of the hl_twitter_widget.php:
Widget Theme for HL Twitter
To change this theme, copy hl_twitter_widget.php
to your current theme folder, do not edit this
file directly.
Available Properties:
$before_widget
$after_widget
$before_title
$after_title
$widget_title
$show_avatars
$show_powered_by
$num_tweets: how many tweets to show
$tweets: array of $tweet
$tweet: object representing a tweet
$tweet->twitter_tweet_id
$tweet->tweet
$tweet->lat
$tweet->lon
$tweet->created
$tweet->reply_tweet_id
$tweet->reply_screen_name
$tweet->source
$tweet->screen_name
$tweet->name
$tweet->avatar
$user: represents the Twitter user (ONLY SET IF SHOWING A SINGLE USERS TWEETS!)
$user->twitter_user_id
$user->screen_name
$user->name
$user->num_friends
$user->num_followers
$user->num_tweets
$user->registered
$user->url
$user->description
$user->location
$user->avatar
So I was wrong about copying the main file (in this case hl_twitter.php), but still - this enabled me to edit the file outside the plugin directory and the system somehow checks for its existence and picks it up if exists.
If this behavior something that is natively supported by Wordpress or it has been integrated in the plugin itself?
With themes, Wordpress has a concept of "child themes" which allows exactly that: to keep changes separate from main theme, in case it changes.
I haven't yet found a way to do this with plugins.
I'm using a few tactics myself:
I bump plugin version to a very high number like 99.9. This way Wordpress won't ever update the plugin.
Store my plugins in version control (i use git, but it doesnt matter), this allows you to update the plugin, run the 'diff' tool and see what changes happend. If you don't like you just revert like it would be a bad code you've written. But this approach requires a bit of skill.
Are you talking about running parts of a modified 3rd party plugin, and an updated version, at the same time?
That's not going to be possible. There is no magical method of "preserve my changes and transfer them into the new version automatically". The way to go here is doing a diff between the edited version and the update, and integrating the changes in the actual source files.
The bottom line is, if you manually edit a third party plugin, you're in for manual review (and possibly rework) once an update takes place. That's why it's usually not a good idea to extensively modify third party plugins.
Well in fact, yes! There is some kind of way.
You have to remove the to be modificated plugin's original actions/filters and then add your altereted actions/filters.
If the desired plugin is even coded in OOP you can just inherit the whole class and rewrite the wanted functions (oh sorry: "methods". we're talking about OOP ;) ). Instantiate your inherited class and rest as above.
Maybe there are better ways! I already search for a method so that the original class won't even get loaded but our altered one instead but I'm no John Carmack.

Wordpress - Images not showing up in the Media Library

I have a huge problem with my Wordpress. My uploaded images don't list in the Media Library.
It is weird tho, it says I have 75 images, but display none. Take a look yourself.
Even weirder, if I go into gallery (the images you uploaded in the page itself), the images list just fine.
I already tried deactivating all my plugins, didn't work. Cache can be easily put out of the question, because it happened on at least 4 different computers, with Macs, PCs, and navigating with Safari, Firefox and Chrome.
Another interesting fact is that if I upload the image directly trough the computer (with the "From Computer" tab), everything goes fine. Another website on the same server works just fine too. And just to add to the complexity, when I go to the media page in the Wordpress Admin, all images show up just fine.
Oh, and before I forget... applying any filters, or doing a research in the media will always come up with the same problem.
So there... that's where I'm at.
I had a same problem just now, with missing media library images for my blog. The images appeared to be right there in the media library and were definitely on the actual web server (checked via FTP).
As Allen Z advised I did "check Settings → Media and make sure that Uploading Files folder is set to wp-content/uploads"
Mine were set to the default blank. I altered this to an absolute path http://www.example.com/wp-content/uploads
THIS DIDNT SOLVE THE PROBLEM when I refreshed the site in browser. However, I immediately changed the path back to blank (the default setting again) and everything came back! Woop
Everyone having this problem might want to try this before getting into the more technical fixes!
it was your permalinks... you must have changed to labeled-name... switch back to default.
that worked for me.
Check Screen Options (dropdown tab in the upper right hand corner of the page), and make sure there are sane settings for what to show on screen. All the column settings should be checked, and there should be a positive number of media items being shown on screen.
If that is ok, then check Settings → Media and make sure that Uploading Files folder is set to wp-content/uploads.
I believe these are the only settings that can be changed from the administrative screens.
Here's something a guy on Wordpress forum showed us. Add the following to your functions.php file. (remember to create a backup of your functions.php first)
add_filter( 'wp_image_editors', 'change_graphic_lib' );
function change_graphic_lib($array) {
return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}
...it was that simple.
Well, Seems like there was a bug when creating custom post types in the function.php file of the theme... which bugged that.
I had this problem with wordpress 3.8.1 and it turned out that my functions.php wasn't saved as utf-8. Re-saved it and it
I faced same issue on my wordpress site. After the lot of debugging i fixed my problem step by step like this.
First add given below code your db-config.php
define('SCRIPT_DEBUG', TRUE);
define('WP_DEBUG', TRUE);
define( 'WP_DEBUG_LOG', true );
Then goto /wp-includes/js/wp-util.js files and find the code $.ajax(
options ) on line number 100 insert given below code into your file
deferred.jqXHR = $.ajax( options ).done( function( response ) {
try {
response = JSON.parse(response);
} catch (Exception) {
response = response;
}
Please check your may be resolved.
if you Removed constant from db-config.php
define('SCRIPT_DEBUG', TRUE);
define('WP_DEBUG', TRUE);
define( 'WP_DEBUG_LOG', true );
Then compress your /wp-includes/js/wp-util.js file code and put your compressed code into /wp-includes/js/wp-util.min.js
*change your own risk if your update your wordpress version your changed may be lost.
Did you ever change the directory of your Wordpress install?
I had a problem with not finding my uploaded images after changing the Wordpress location on my server. In Wordpress, I went to Dashboard-> Settings -> Media and changed the uploads folder in the "Store uploads in this folder" field.
Considering the files were not uploaded via media uploader, they are present in the server but there's no reference to them in your database (in a little more detail).
In order to fix it, install the Media Sync plugin. Once it's active, under Media > Media Sync > Scan Files and select the files you want to import by click the checkbox next to them. Make sure also you untick the selectbox Dry Run (test without making database changes).
Then, when the time comes for you to be ready, just click "Import Selected" and you should see something like this
Once it is finished, you can visit Media > Library and you'll see all your imported files there.
How did you upload those images; via FTP or through WP uploader? You have to upload images THROUGH WP uploader in order to show them in the image library.
Ubuntu stores uploads in /var/lib/wordpress/wp-content/uploads . So what you need is to have this directory within your wordpress installation. Something like:
sudo ln -s /var/lib/wordpress/wp-content/uploads /var/www/www.mysite.com/wp-uploads
(replace mysite.com with your domain, the file should exist) should do the trick.
(Note that I've not tested this with multiple wordpress installations on one server.)
Further note that to make upload work at all (but this wasn't the question), you need to change Settings / Media / Store uploads in this folder to
wp-content/uploads
(no leading slash).
check .htaccess file in root of wordpress, maybe there is a rule for /uploads directory.
if so, remove it. but be careful and check which plugin did it, so disable the plugin, first.

Resources