Backwards engineering MySQL table (Wordpress) - wordpress

I found a Wordpress plugin called Extra Comment Fields that should work, but I'm having trouble with the database! Extra fields are not stored anywhere!
Table plugin uses (and should create) is called wp_comments_extra, but this table is nowhere to be found. Is there any way to manually crate correct table by backwards- engineering plugin's .php file?

You should never have to do that. In fact it would be a really bad idea to. Usually modifying plugins can cause a lot of problems if you don't know what you are doing. What are you trying to do? The table should be created automatically when you activate the plugin.
What makes you think that is the table that would be created, anyways? It could use Wordpress built in meta tables, rather than it's own. Not every plugin creates a table named after itself.
And besides, that plugin hasn't been worked on since 2008. It could be incredibly out of date. If I were you I would look for a different plugin.

Related

How to replace plugins in wordpress?

I am working on a website built on wordpress in which I want to replace some plugins. The reason behind the replacement of those plugins as it is no longer developed. The most important plugin which I want to replace is Accordion Shortcodes.
From the tutorial mentioned here,
Accordion Shortcodes is a simple plugin that adds a few shortcodes for adding accordion drop-downs to your pages.
The accordions should blend seamlessly with your theme. However, you may want to edit your theme’s main stylesheet in order to add some custom styling (see below for sample CSS).
Problem Statement:
I am wondering what best practice I need to follow in order to replace a plugin in wordpress. Also, what would be the best replacement for Accordion Shortcodes, Modify Attachments Meta ?
John, Your title says "How' and the above two answers describe "how". However reading the text implies you want people to tell what plugins are best to replace your existing plugins with. As the comment says, plugins do not always 'replace' each other exactly and may have many more features. Judging by the names of the plugins, I think you need to understand why and how those plugins are being used. An approach:
Discuss with the site owner what features they care about and what are 'nice to have'. They may not know which plugins are delivering which aspects of the website, so very important to know what are the absolutely important aspects. They may no longer need some of those plugins (eg: Modify Attachments Meta? might be a tool used to do something and no longer needed?)
Assess what features are being delivered by each of the outdated plugins, and which are important or non essential.
Research for alternate plugins that provide the features that are important
Review the best candidates and test them on test copy of main site.
Work out what if any conversion may be required. EG: if's access control, how is it doing the access control? how would you convert that?
Test the conversion, test the new plugins on converted data.
You can simple deactivate plugin and then remove the plugin.
Here is a plugin suggestion
https://wordpress.org/plugins/accordions/
You can use this plugin instead of that outdated version of the Accordion Shortocdes plugin.
Please let me know it helps to you.
Here's how I like to go about replacing plugins:
Identify any shortcodes it provides, and search your database (via either PhpMyAdmin, or a database search plugin like Better Search Replace) for that shortcode. This will identify all the posts & pages you'll probably need to update.
Save any custom CSS or other configuration data that might be relevant to the replacement.
Assuming there's no conflict between the old plugin and new one, install & activate the new plugin. Then you can begin replacing the usages of the old plugin one by one (and modifying the configuration of the new plugin to get it "just right").
After you've done all the replacements (which you might want to verify by another database search), deactivate and remove the old plugin.
This is how I do plugin migrations. In your case, in step 3, you could probably install each of the plugins you're considering, try them out, and only do the full migration for the one you like best.

Drupal know from where things are showed

I have a strange question but I don't find any hint about that (if it's possible), for a drupal 7 website I have to modify some content of a page in the backoffice, but I really don't know from where some content of this page is created (a table, similar to a view table but not a view table).
I just want to know if there is any way to show which php function the page use to finally be showed. I know there is something like that for the theme (drupal theme debug) but I don't find something for my case.
Any idea ?
You need PHP profiler to check all functions called on page, there's a module for Drupal7 for XHProf integration. But I would suggest you to use your browsers inspector as mentioned by 2pha before. For example if there's a form on the page just use the form ID to find it. Custom classes are very useful in these cases, parts of the html codes etc. In your case search for table headers...
The code you are looking for is most probably in custom modules and the
general suggestion is to keep you custom modules in separated folder from contributed ones.

Where should I be storing extra strings for Wordpress site

I have a wordpress site with a theme. But now I need to extend it.
For example, I want to make a custom section on the homepage. The section needs a header which is not a part of any post. I know how to code this, but I don't see where I should be storing the string which will be displayed.
Possible solutions:
Store in the PHP file itself, obviously not a good idea.
Store in the database as an option, using
get_option( 'my_custom_header', 'default_value' );
The issue with this is that there is no easy way to edit the value other than opening up the database directly.
Use an options plug in. The ones I have seen seem an overkill.
Write my own so I have a table specifically for such tables.
So the question is what is the best place to be storing such strings?
Greg
What I ended up doing was extending the existing theme options panel to add a few extra options.

Wordpress new setup old articles

We run several installations of Wordpress without using MU. The whole thing got a little out of hand code wise as there are really old plugin versions, legacy files and lots of potentially insecure data on the server. The core installation is out of date as well as the plugins. Some of those plugins do not work anymore. What we want to do is make a clean cut, install a new version with all plugins needed. We also want to use a different theme. But we do not want to loose the articles, comments, tags aso.
I tried exporting everything with Wordpress' own functionality and then import it into the new system. Works fine, except that the routine changes article id, which is bad for permalinks and has side effects when it comes to tweaks where we worked with those ids to display special extra content.
I think the best way is to use the old database. However, I think I cannot just use a dump of the old version. Does anybody know which tables I need for the whole content thing without systems settings? Or is there any other way?
I would not suggest that aproach, but if You like to try, then:
comments data:
wp_commentmeta,
wp_comments
posts data, categories, custom menus etc:
wp_postmeta,
wp_posts,
wp_terms,
wp_term_relationships,
wp_term_taxonomy
users:
wp_usermeta,
wp_users
As You can see, there are 10 mandatory tables and one more:
wp_options
which You dont want to copy.
All other tables are from plugins etc.

Hack-free Wordpress custom post type image upload?

How do you upload an image with a custom post type in Wordpress without hacking at core files or injecting that multipart thing with jQuery?
The answer depends on what you are going to use to manage those images once they are uploaded. If the upload-and-create-custom-post is all you care about, then you could do it with a trivial plugin.
However, if you want to do the whole management enchilada, then the simplest thing might be to copy the code in wp-admin/upload.php and wp-admin/includes/template.php and make your own changes to that. There are very few action/filter hooks in this code and some of the comments indicate that it goes way, way back. In upload.php there are several SQL statements that have post_type='attachment' hardwired. Changing those should be straightforward. Mercifully, you will probably have only a few changes to make in template.php. As the comment at the top of that file says, "A Big Mess. Also some neat functions that are nicely written." So true.
The one thing you must not do is hack the core files themselves. WP's one-click upgrade is critical to their security fixes.

Resources