Serialized data in Wordpress form is "serialized" again when saved in mysql - wordpress

I have a challenge with the way data is stored from Wordpress into mysql.
I'm new to Wordpress - but I'm trying to combine different plugins to achieve a specific functionality on a website.
Plugin #1 uses a specific type of post and some metadata - the plugin works great.
Plugin #2 can create posts of custom types and with custom metadata from the frontend. A flexible and great plugin.
My intention is to use plugin #2 to create posts from the frontend for plugin #1, which requires that some specific metadata contains specific values (otherwise the data are interpretted wrong). These values are saved with hidden inputfields in a form.
My challenge is that a value (which is serialized) is kind of serialized again. The value is a:1:{i:0;s:3:"198";}
Plugin #2 handles it well (as the data is shown correct in front- and backend of the plugin) - BUT in myPhpAdmin I can see that the data is saved differently s:20:"a:1:{i:0;s:3:"198";}"; - and hence that value cannot be understood by plugin #1.
I'm thinking of two options:
change something so s:xx: isn't added to the value(-s)
make the frontend form/plugin save the data in a serialized way so the value gets the correct format.
Any recommendations? - can I in anyway achieve my functionality?

Looks like
s:20:"a:1:{i:0;s:3:"198";}";
value is being serialized twice. You can check the plugin source code to see why the plugin serializing same value twice and if can prevent it than both plugin can share same data.

Related

Datatable creation with server side in wordpress using ACF plugin

I am having trouble using datatable in wordpress because my software and SQL knowledge is weak. As we know acf plugin data is stored in postmeta table. I want to create a datatable. I had problems with wp_query in array index. Not all data is available. Also, as you know, it makes more sense to use server side. But how do I pull the acf values ​​with server side and return it in a datatable. I couldn't find any good information on this. I also used the wpdatatables plugin. But it spills the whole table. I want to show the sample start_date and end_date custom fields of the post's id number. Also, some plugins create a special database for custom field values. This provides convenience. But although it makes sense for a new site, it is very difficult for someone like me who has entered a very special field value.
As I said above, is there a resource that will take the custom field values ​​from the postmeta and post tables and return them in a server side datatable? Thanks.
PS: Sorry for my bad english.

Importing excel files into Wordpress custom post

I'm starting work on a new Jobs website (where client can create new jobs through the WP backend). This is easy enough with setting up with a custom plugin like post-meta
Wordpress - post meta plugin
Which I've setup with custom post meta fields (location, sector, status etc.)
However when I create jobs and fill out the post meta fields and check the DB they all have array encoding:
E.g. a:1:{i:1;a:1:{i:1;a:1:{i:0;s:11:"Sydney City";}}}
How do I remove this so it simply says 'Sydney City' for the meta key value?
But even if I fix that, the client needs to send me a spreadsheet with all the jobs, how do I import something like that into the DB? For example how can a spreadsheet like this:
Job Name,Advertiser,Status,Start,Finish,Category,Suburb,State
Value 1,Hays Constr,Tender,12/3/13,12/4/14,....
Be imported into the meta_key, meta_value architecture? Is it even possible?
What do you think would be the way to proceed? I do want the client to be able to edit Jobs in the WP Admin... but I also need to import a ton of jobs and surely there's a quicker way to do this

Author of a particular field - which user modified the field

Is it possible in Drupal to find out which user modified a particular field? Not just the whole node. After saving the content I want to display the author name next to that field.
Not sure if this is possible or not.
This is not provided by Drupal core, and (As far as I know) it is not provided by any contributed modules on drupal.org.
So, in order to do that, you would probably need to create a custom module.
A simple module to achieve that would have a database table with (nid, uid, current field value) and hook_node_presave implementation (compare field values, then update/insert/ignore saving new data to your database table).

form in wordpress that writes to many tables (with different columns)

Currently, I'm using tablepress to output different info using a table format. I want users to be able to add to existing information. I need a form in wordpress that saves user posts to these different tables. How should I go about this? Sorry if I sound stupid but I'm soft on html.
Thanks.
If you want to insert in posts table using custom form, you can use wp_insert_post().
This function inserts posts (and pages) in the database. It sanitizes variables, does some checks, fills in missing variables like date/time, etc. It takes an object as its argument and returns the post ID of the created post (or 0 if there is an error).
Reference : http://codex.wordpress.org/Function_Reference/wp_insert_post

umbraco and custom system table

I have the following scenario:
My website db has a system table called "Companies", which includes an id field, companyName field, and companyImageUrl field.
How do I set up an umbraco document type for adding entries to this table ?
Maybe I shouldn't use a custom table at all ?
Thanks.
As far as I know, Umbraco doesn't support what you want to do out of the box (mapping a document type to a table that isn't part of the umbraco core).
One approach that might work is to create an action handler that syncs a Company doc type to your table when creating a node of that type.
It's a bit of a hack though. I've found that I've very rarely needed to create custom tables. What exactly are you trying to do with it? My guess is that you don't really need it and would be better off working with a doc type instead. Umbraco provides a variety of ways to get and act upon doc types from within custom C# code (check out the umbraco.NodeFactory namespace). You'll also get the added benefit of being able to easily interact with these nodes from XSLT/Razor.

Resources