freaking1 / wordpress-custom-content-type-manager

Automatically exported from code.google.com/p/wordpress-custom-content-type-manager
0 stars 0 forks source link

Add Import/Export functionality so users can easily backup or share their post and field definitions #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What functionality do you want to see?
I'm making a couple of content types &  some widgets that depend on them for my 
department website, but some other people at the university might be interested 
in having the same functionality.  I've created the content types using the 
CCTM interface, but would it be possible instead to register the type directly 
in php code that's called when a plugin is installed?  Then I could distribute 
the plugin to everyone who's interested; they would install CCTM first, then my 
plugin, and be able to administer the new content types from inside your 
interface (e.g. change custom field order, &c.).

thanks again...

Original issue reported on code.google.com by mopto...@gmail.com on 25 Feb 2011 at 3:37

GoogleCodeExporter commented 9 years ago
Wow, that's a great idea!  

What do you think would be the cleanest interface for this?  I could add a 
button to "Export Definitions" or something like that -- when you click it, it 
could force a download of a text file, or maybe email it to you.  Then you 
could upload it to the other site.  Basically, I could re-write the 
registration process so it looks for a definition file instead of just looking 
for what's defined in the database.

Should this export ALL custom content types and ALL custom fields?  Or would it 
be better to allow the ability to export them 1 at a time?  E.g. with my "View 
Sample Templates" links, you can see the sample templates for each content 
type, but I want to also make a link to "Download ALL Templates" so you can 
make your definitions, then download a single zip file with all the samples you 
need. 

What do you think?

Original comment by fireproofsocks on 25 Feb 2011 at 6:06

GoogleCodeExporter commented 9 years ago

Original comment by fireproofsocks on 25 Feb 2011 at 6:06

GoogleCodeExporter commented 9 years ago
I had not gotten as far as you did there! I was sort of asking, are there 
functions I cna reference in my plugin...  But an export button would really be 
incredible, for lots ofreasons.  For instance, if one of my students designs a 
site for an organiation that needs, say, a CCT for "archival documents", and 
another realizes she needs the same functionality, the first student could 
export the types and give that over to the second, without the second student 
needing to wok her way thrugh a myusqldump of the first student's work... this 
is great.  Yes, I'd say PLEASE implement it as an import/export function which, 
at least by default, exports *all* managed CCT's.  The importer could even 
offer a checkbox interface which allows you to import onl certain types from 
the archive -- something like that, anyway.  

this is becoming a pretty powerful framework.  thanks!

Original comment by mopto...@gmail.com on 26 Feb 2011 at 12:22

GoogleCodeExporter commented 9 years ago
I can give you a quick work-around if you need to implement this immediately.  
You'll need access to the database via phpMyAdmin or similar, and please, don't 
try this unless you have some familiarity with working with databases. 

The way this plugin works is it stores all the definitions for the post types 
and for all custom fields in a big serialized array stored in the wp_options 
table.  Run a query like this on the site where you want to copy the data from:

SELECT option_value FROM wp_options WHERE 
option_name='custom_content_types_mgr_data';

Then copy the results from that one cell to a text file and save it -- it'll be 
a huge value that starts with something like 
"a:8:{s:7:"product";a:23:{s:8:"supports";a:6:{i:0;s:5:"title";i:1;s:6:"editor";i
:2;s:6:"author";i:3;s:9:"thumbnail";i:4;s:9:"revisions";i:5; .......... " 

Then go over to the new site and paste that into the new site's database -- 
what I would recommend is to install this plugin on the new site, maybe 
activate a post type or something so that the option is created in the database 
(which is easier than making you create it).

Then you're gonna paste that value you saved into the option_value WHERE 
option_name='custom_content_types_mgr_data';  It's much easier to do this using 
a graphical interface (e.g. phpMyAdmin), but the corresponding update statement 
would be:

UPDATE wp_options SET 
option_value='a:8:{s:7:"product";a:23:{s:8:"supports".............' WHERE 
option_name='custom_content_types_mgr_data';

(I've truncated the string there so you can see the statement, but it's 
probably gonna be a huge amount of data that gets written there).

The end result will be that the 2nd WordPress site will have the same 
post-types and custom fields defined as the original site.

Original comment by fireproofsocks on 26 Feb 2011 at 11:33

GoogleCodeExporter commented 9 years ago
The import/export option should reference an informational field that 
summarizes data about the site the made the export.  I'm thinking something 
along the lines of an array of data that would include the following:

1. The site name
2. The URL or domain name of the site
3. The datestamp of when the export was made
4. The username of the person making the export
5. A name of the export
5. An optional description or note by the user to explain what is in the 
package.

Only the name and description would be immediately visible... the other options 
would be primarily for logging purposes, but they should be visible via an 
"inspect" link of some sort.  Man, I gotta wireframe this.

I'm seeing some great use-cases for this... e.g. the community could share 
their own setups.  If I enable a customizable icon directory, for example, then 
the export script could zip up that directory and include it with the export.  
Actually... in the case of icon URLs, there is the possibility that the icons 
would break when the new site imports a CCTM definition because the icons 
weren't included.  But this type of implementation is a phase-2 thing.

Original comment by fireproofsocks on 2 Mar 2011 at 12:10

GoogleCodeExporter commented 9 years ago
Not to be over-effusive, but I honestly think the export feature would be a 
major boon to wordpress.  It would help to promote a kind of second-order open 
source ecosystem for the platform, allowing semi-technical users like myself to 
contribute back to the user community more effectively.  So in addition to 
plugins and themes, there'd be bazaar of content-types too.  This makes the 
custom post type feature way more robust than it is in the current 
implementation.  

So, wow, keep going man!

Original comment by mopto...@gmail.com on 2 Mar 2011 at 12:36

GoogleCodeExporter commented 9 years ago
Heheh... no problem.  No, I can see where this is going, and I agree with you: 
it could be a great way to unify sites and share architectures etc.  I'm even 
thinking of integrating this with Facebook and Twitter so devs can literally 
share their settings via a social network.

Consider this flow: 
1. Exporting has an option to post to FB or Twitter
2. Clicking the link posts the definition string to http://pastebin.com/api.php
3. The resulting public download link is posted to FB or Twitter, e.g. 
http://pastebin.com/download.php?i=MUvjydmq
(Maybe that needs to be run through a URL shortener).

Any chance you have a paying gig that needs this type of thing so I could 
devote more time to developing it?  I'm enjoying developing this, but I gotta 
balance it against what pays the bills.

Original comment by fireproofsocks on 2 Mar 2011 at 10:48

GoogleCodeExporter commented 9 years ago
This might be a better service as an alternative to pastebin: 
http://www.quickshareit.com/ (???)... of course their site is failing right now 
(downloads don't work), but ideally I'd like a pastebin type service that 
allows for readonly posts with tags for easy searching.  I don't particularly 
want to accept random posts on MY site since it's such a crazy security risk.

Original comment by fireproofsocks on 3 Mar 2011 at 12:14

GoogleCodeExporter commented 9 years ago
Another good candidate is GitHub: 
http://develop.github.com/p/gist.html 
https://gist.github.com/

This has an API, it's forkable, and I could post these in a dedicated account 
for this project.

Original comment by fireproofsocks on 3 Mar 2011 at 6:31

GoogleCodeExporter commented 9 years ago
wow, lots of ideas.  I tend to think github is a great choice -- though maybe 
it will seem intimidating to the average wordpress user?  A nyway for me it 
works great, even though my knowledge of git is about a millimeter thick.  

re: paying gig -- not at the moment.  I'm building this proof-of-concept site 
to see if it makes sense to use wordpress in the long run for our department.  
If that's what we go with, there'll be a (small!) budget, and it would be nice 
to use some of that to pay the people who make the tools (like you).  I really 
truly don't know the parameters yet, though.  I'll keep you posted?  e

Original comment by mopto...@gmail.com on 3 Mar 2011 at 2:36

GoogleCodeExporter commented 9 years ago
Cool.  The GitHub/Pastebin ideas would be transparent to the users -- I just 
need someplace to post the configuration data to make it public.  If I can post 
it all to a single GitHub account, then I can write an interface to display all 
of those configurations.  Again, it's nothing that even the WP managers would 
see directly.

WP is not the best solution for every project.  This plugin is my attempt to 
make it suck less, but its architecture is categorically poor in my opinion.  
The best case scenario with the data model used by WP and by this plugin is 
awkward: it extends columns in one table with rows in another... it's a common 
solution used by a lot of CMS's, but it's not good if you need to report on 
that data or import data from 3rd parties (e.g. CSVs).  The other solutions are 
typically more complex and require some development, so I'm hoping that this 
plugin (or others like it) can help bridge the gap.

Original comment by fireproofsocks on 3 Mar 2011 at 4:34

GoogleCodeExporter commented 9 years ago

Original comment by fireproofsocks on 13 Apr 2011 at 2:41

GoogleCodeExporter commented 9 years ago
Hmm... QuickShareIt has pulled the plug and they are turning the lights out on 
their business..

http://getcloudapp.com/ and its API might be viable 
http://developer.getcloudapp.com/ but you have to authenticate with an email 
address... boo.

The GIT gist stuff looks the most promising, but they don't have pull requests 
documented in their API yet: http://develop.github.com/p/gist.html

Original comment by fireproofsocks on 23 Apr 2011 at 1:26

GoogleCodeExporter commented 9 years ago

Original comment by fireproofsocks on 23 Apr 2011 at 1:28

GoogleCodeExporter commented 9 years ago
GIT gist doesn't have push commands either... but some people are doing them, 
e.g. https://gist.github.com/4277

Original comment by fireproofsocks on 23 Apr 2011 at 1:38

GoogleCodeExporter commented 9 years ago
Man, although I like the idea of GIT for this (forking, et al), their API is 
not documented.  I think the best option here will be to create a dedicated 
PasteBin user for CCTM and then use that as the backend to store the 
definitions: http://pastebin.com/api

Original comment by fireproofsocks on 23 Apr 2011 at 4:10

GoogleCodeExporter commented 9 years ago
Ok, basic import/export is working now with revision 377177.  

I still have to get the relative image urls translated back to absolute (see 
issue #64).

More detailed import/export functionality will come in a future version.

Original comment by fireproofsocks on 26 Apr 2011 at 2:14

GoogleCodeExporter commented 9 years ago
Just worth noting this discussion here:

http://support.github.com/discussions/gist/336-api-functions-for-creating-and-li
sting-gists

Original comment by fireproofsocks on 26 Apr 2011 at 5:12

GoogleCodeExporter commented 9 years ago
And here: https://github.com/github/develop.github.com/wiki/v3

"We limit requests to API v3 to 5000 per day."

Original comment by fireproofsocks on 26 Apr 2011 at 12:51

GoogleCodeExporter commented 9 years ago
I think my hopes of building an online, searchable database of CCTM definitions 
needs to be reconsidered.  We can paste to pastebin or to Gist or whoever, but 
perhaps the searchable component of this ought to be handled by a URL 
shortening service.

Bit.ly
http://code.google.com/p/bitly-api/wiki/ApiDocumentation  
We could have a CCTM pref where users who want to share can enter in their 
bit.ly username to authenticate.

Goo.gl
http://code.google.com/apis/urlshortener/v1/getting_started.html

Google is attractive because they don't limit API requests (hell, I'd be lucky 
if this thing got hit 5000 times a day), and they do offer stats on how many 
times a URL has been clicked through, but you can't search based on top 
performers.

So the flow here might just be to post to pastebin, shorten the URL, and let 
the users bookmark it.

Original comment by fireproofsocks on 26 Apr 2011 at 1:26