a.blok
Forum Replies Created
-
I think that this topic is resolved, as no change in Types is required.
I also disagree. I don’t see interoperability as a luxury feature.
Sorry, there was an error in the above code. Do not use it!
This works:function make_types_variables_controlled() { global $wpdb; $q = "SELECT option_value FROM {$wpdb->prefix}options WHERE option_name='wpcf-fields'"; $rr = mysql_query($q); $old_value = mysql_result($rr, 0); $u = unserialize($old_value); if (!$u) $u = array(); foreach (array_keys($u) as $key) { $u[$key]['data']['controlled'] = 1; } $new_value = serialize($u); $q2 = "UPDATE {$wpdb->prefix}options SET option_value = '$new_value' WHERE option_name='wpcf-fields'"; $rr2 = mysql_query($q2); return $rr2; }
Well, after some research I found a way to remove the wpcf- prefix to all fields.
This is useful i.e. if you use Types to create the custom fields, but you don’t want to have the wp_post_meta table (and your php code) cluttered with the wpcf- prefix.
Just run this function whenever you want to remove the prefix from all fields:function make_types_variables_controlled() { global $wpdb; $q = "SELECT option_value FROM {$wpdb->prefix}options WHERE option_name='wpcf-fields'"; $rr = mysql_query($q); $r = mysql_result($rr, 0); $u = unserialize($r); foreach (array_keys($u) as $key) { $u[$key]['data']['controlled'] = 1; } $ret = serialize($ret); $q2 = "UPDATE {$wpdb->prefix}options SET option_value = '$ret' WHERE option_name='wpcf-fields'"; $rr2 = mysql_query($q2); return $rr2; }
I tried it and it seems to do the job.
I don’t know if there are any downsides to this.
Use it at your own risk and backup the database before trying to use it (if something goes wrong you might lose all of your Types fields).
Cheers!Hi applegateian,
there is an error in your script:
global $post;
must be the first line after
function scripts() {
Just move the line of code and it should work.
f1mktsol, the easy way is to insert the shortcode in the page/post and not in the template file.
If that is not possible, you will have to hack the lib/attachment.php and do something along the lines of
substitute (2 times in the script)
has_shortcode( 'wpuf_addpost' )
with
$post->ID == 11111 || has_shortcode( 'wpuf_addpost' )
and add
global $post;
in a new line under
function scripts() {
Replace 11111 in the code above with your post/page ID.
This code is not tested. Hope it helps!Hi folks!
if nothing happens when you click on the add image button, and you get no js error at all (like it happened to me) this is probably because you are loading the shortcodes from a php file using a page template.For example, I was using this in my template file:
<?php echo do_shortcode('[wpuf_addpost]'); ?>
But, the attachment.php has this logic for loading the scripts:
if ( has_shortcode( 'wpuf_addpost' ) || has_shortcode( 'wpuf_edit' ) || has_shortcode( 'wpuf_dashboard' ) )
and I found out that it returns false if you load the shortcode from php.
I think this is a bug and should be fixed.
Cheers!Hi. It would be nice to know how to fix this issue! Can you guys please give me some insights?
Thanks
AlexanderForum: Plugins
In reply to: [MailChimp Widget] [Plugin: MailChimp Widget] Form not workingHi James,
thanks for checking out. I deactivated the plugin that created the JS errors.
Now both Chrome’s Dev Tools and Firebug for Firefox tell me the JS is ok. But the problem still remains.
Cheers!
Alexander