Tagged: EDD, feedwordpress, not saving, publish, update
- This topic has 26 replies, 2 voices, and was last updated 5 years, 9 months ago by
wdrescher.
-
AuthorPosts
-
-
April 27, 2016 at 1:35 pm #6369
wdrescherMemberI am not sure if this is a Piklist issue but I figured I would explain it and see if I have any help or suggestions as I am really stuck.
I used FeedWordpress to pull an RSS feed item in and place it in a metabox inside the post. I am using a theme called “Musik” that uses Piklist and East Digital Downloads to allow music files to be bought and played in a mp3 player.
Right now FeedWordpress sends the mp3 url to the correct field called “preview mp3” and then it publishes the post. When I go to the post it doesn’t find any mp3 url. If I hit update on the post it fixes it and the mp3 can be previewed.
It seems that the field is not saving when it is published and only when it is updated.
I am wondering if this is an issue with how the theme dev wrote the piklist field in or not. Any help would be much appreciated!
-
April 27, 2016 at 1:42 pm #6370
wdrescherMember<script> var api = 'https://api.soundcloud.com/resolve.json?url=', clientid = '&client_id=<?php echo get_theme_mod( "soundcloud-clientid")?>'; jQuery(document).ready(function(){ var el = jQuery('._post_meta_soundcloud_trackurl'); el.parent().append('<a class="button get_sc_id" style="margin-top:25px">Get</a>'); jQuery(document).on('click', '.get_sc_id', function(){ var url = el.val(), _url = api+url+clientid, that = jQuery(this); if(that.hasClass('disabled')) return; that.addClass('disabled'); if(url == '') return; jQuery.ajax({ url: _url, method: "GET" }).done(function( obj ) { jQuery('._post_meta_soundcloud_trackid').val(obj.id); that.removeClass('disabled'); }).fail(function( jqXHR, textStatus ) { that.removeClass('disabled'); alert( "Request failed: " + textStatus ); }); }) }); </script> <?php /* Title: Music Fields Description: this is the description Post Type: download Order: 1 Collapse: false */ piklist('field', array( 'type' => 'select' ,'field' => 'music_type' ,'label' => esc_html__('Type','musik') ,'description' => esc_html__('Default is single, select bundle when this is a bundle product.','musik') ,'choices' => array( 'single' => 'Single' ,'bundle' => 'Bundle' ) ,'value' => 'single' ,'on_post_status' => array( 'value' => 'lock' ) )); piklist('field', array( 'type' => 'select' ,'field' => 'preview_type' ,'label' => esc_html__('Preview','musik') ,'choices' => array( 'local' => 'Local' ,'remote' => 'Remote' ) ,'conditions' => array( array( 'field' => 'music_type' ,'value' => 'single' ) ) ,'on_post_status' => array( 'value' => 'lock' ) )); piklist('field', array( 'type' => 'file' ,'field' => 'preview' ,'scope' => 'post_meta' ,'label' => esc_html__('Preview file','musik') ,'description' => esc_html__('Preview audio file, you can add mp3, ogg, mp4 file(s).','musik') ,'conditions' => array( array( 'field' => 'preview_type' ,'value' => 'local' ), array( 'field' => 'music_type' ,'value' => 'single' ) ) ,'on_post_status' => array( 'value' => 'lock' ) )); piklist('field', array( 'type' => 'group' ,'field' => 'preview_url' ,'label' => esc_html__('Preview file','musik') ,'add_more' => true ,'fields' => array( array( 'type' => 'select' ,'field' => 'preview_media_type' ,'label' => esc_html__('Format','musik') ,'columns' => 2 ,'choices' => array( 'mp3' => 'mp3' ,'m4a' => 'mp4' ,'m4v' => 'm4v' ,'oga' => 'ogg' ,'webma' => 'webm' ) ) ,array( 'type' => 'text' ,'field' => 'preview_media_url' ,'label' => esc_html__('URL','musik') ,'columns' => 10 ) ) ,'conditions' => array( array( 'field' => 'preview_type' ,'value' => 'remote' ), array( 'field' => 'music_type' ,'value' => 'single' ) ) ,'on_post_status' => array( 'value' => 'lock' ) )); piklist('field', array( 'type' => 'group' ,'label' => 'Soundcloud' ,'description' => esc_html__('Input the soundcloud url and click the get button','musik') ,'fields' => array( array( 'type' => 'text' ,'field' => 'soundcloud_trackid' ,'label' => 'trackid' ,'columns' => 3 ) ,array( 'type' => 'text' ,'field' => 'soundcloud_trackurl' ,'label' => 'url' ,'columns' => 7 ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'year' ,'label' => esc_html__('Publish year','musik') ,'attributes' => array( 'class' => 'regular-text' ,'placeholder' => '2015' ) )); piklist('field', array( 'type' => 'text' ,'field' => 'time' ,'label' => esc_html__('Duration','musik') ,'attributes' => array( 'class' => 'regular-text' ,'placeholder' => '00:00' ) )); piklist('field', array( 'type' => 'text' ,'field' => 'itunes' ,'label' => esc_html__('iTunes','musik') ,'attributes' => array( 'class' => 'regular-text' ,'placeholder' => 'http://' ) )); piklist('field', array( 'type' => 'text' ,'field' => 'googleplay' ,'label' => esc_html__('Google Play','musik') ,'attributes' => array( 'class' => 'regular-text' ,'placeholder' => 'http://' ) )); piklist('field', array( 'type' => 'group' ,'field' => 'links' ,'label' => esc_html__('Links','musik') ,'add_more' => true ,'fields' => array( array( 'type' => 'text' ,'field' => 'link_text' ,'label' => esc_html__('Text','musik') ,'columns' => 4 ) ,array( 'type' => 'text' ,'field' => 'link_url' ,'label' => esc_html__('URL','musik') ,'columns' => 8 ,'attributes' => array( 'class' => 'regular-text' ,'placeholder' => 'http://' ) ) ) ,'on_post_status' => array( 'value' => 'lock' ) )); piklist('field', array( 'type' => 'checkbox' ,'field' => 'hide_play' ,'label' => esc_html__('Hide play btn','musik') ,'choices' => array( 'first' => '' ) ,'on_post_status' => array( 'value' => 'lock' ) )); piklist('field', array( 'type' => 'checkbox' ,'field' => 'download' ,'label' => esc_html__('Allow download music','musik') ,'description' => esc_html__('Download the preview file','musik') ,'choices' => array( 'first' => '' ) ,'on_post_status' => array( 'value' => 'lock' ) )); piklist('field', array( 'type' => 'text' ,'field' => 'plays' ,'label' => esc_html__('Play count','musik') ,'attributes' => array( 'class' => 'regular-text' ) ,'capability' => 'administrator' )); ?> -
April 27, 2016 at 2:43 pm #6371
SteveKeymaster@wdrescher– Welcome to the Piklist community!
You have
preview_media_urlset as a field within the group fieldpreview_url. This is going to be very hard to set automatically.Suggest you either break up the group field into individual fields, or remove the line
,'field' => 'preview_url'which will do the same thing.Also, you can probably remove this in all your fields:
,'on_post_status' => array( 'value' => 'lock' ) -
April 27, 2016 at 3:22 pm #6372
wdrescherMemberSteve thanks for the help on this. I removed
,'field' => 'preview_url'and replaced the original file inside the theme and it did not fix the issue.By the way I really do appreciate the support so far, I am at a dead end and you have been awesome in response.
Website: http://www.optinondemand.com.php56-29.ord1-1.websitetestlink.com/
-
April 27, 2016 at 3:29 pm #6373
SteveKeymasterWhat field are you trying to save the data to?
-
April 27, 2016 at 3:31 pm #6374
wdrescherMemberpreview_media_url is what I use right now and the RSS Syndication plugin throws the url in there perfectly, just seems like it doesn’t stick until I hit update on the post.
-
April 27, 2016 at 3:50 pm #6375
SteveKeymasterBefore updating the post, if you look in the database, is the field filled in?
-
April 27, 2016 at 4:04 pm #6376
wdrescherMemberYup it shows up in the database
-
April 27, 2016 at 4:06 pm #6377
SteveKeymasterDoes the value/format in the database change once you update the post?
-
April 27, 2016 at 4:31 pm #6378
wdrescherMemberWell now I feel embarrassed and happy all at once haha!
It changed from:
https://audioboom.com/boos/4481292-13-take-a-lovely-journey-to-westeros.mp3?source=rss&stitched=1
to
https://audioboom.com/boos/4481292-13-take-a-lovely-journey-to-westeros.mp3?source=rss&stitched=1
audio/mpeg
-So what it looks like it’s doing is adding audio/mpeg below that line with a space. I am going to try to replicate that using feedwordpress and send that to the field and see if that works. You might of just helped me over my roadblock.
-
April 27, 2016 at 4:46 pm #6379
wdrescherMemberAlright obviously if I add a “space audio/mpeg” to the end of the url that FeedWordpress sends it puts it in the field AND in the database. I only would like it to send to the database. Is there a way to append audio/mpeg to the field that it will send a couple return lines and audio/mpeg to the database? I did run a test by adding a couple return lines and then audio/mpeg inside ones that weren’t updated yet and then saved the database and it worked so I believe I am very close.
Maybe it already does add audio/mpeg to the field and is only getting triggered upon update?
-
April 27, 2016 at 6:08 pm #6380
SteveKeymasterYou’ll have to play with it but it looks like you’re close.
-
April 28, 2016 at 9:26 am #6383
wdrescherMemberI have tried a few things in FeedWordpress to send some line break to the PikList field and the database doesn’t render these as new lines, just renders it as code.
Is there a way to make the output of Piklist append a couple return lines then my audio/mpeg text in to the database?
-
April 28, 2016 at 9:41 am #6384
SteveKeymasterSo, just to be clear:
-When FeedWP automatically saves it to the db, it’s just the FILE.
-When you press save in the post, “audio/mpeg” gets appended to the file.Is that correct?
-
April 28, 2016 at 9:43 am #6385
SteveKeymasterAlso, try removing your custom JS and see if that fixes it.
-
April 28, 2016 at 10:34 am #6386
wdrescherMemberAlright so I noticed when looking in the DB there’s preview_media_url and enclosure below it. I was clicking on enclosure by accident and that is where I was seeing that it was appending audio/mpeg to the end of the preview media url.
Now I found something that does change in the DB after publish. At the very end of the DB once published it adds another meta value with the same key name but does it in I believe a serialized way.
I added some pictures of what I mean from the first preview media url to what the update adds in…
Attachments:
You must be logged in to view attached files. -
April 28, 2016 at 10:46 am #6389
SteveKeymasterThis is happening because
preview_urlis a GROUP field, and everything is saving WITHIN a group. Make these individual fields and everything should work fine. -
April 28, 2016 at 11:09 am #6390
wdrescherMemberI see so when I detach that from the group it will then correctly add the field like the screenshots I sent.
I will have to figure out how to do that since I never touched Piklist until this project and this is another devs theme. Is it as easy as grabbing that field info and putting it after said group?
Music.php file for reference: https://drive.google.com/file/d/0B6gTiZfhhWDDRlBPbTJmc25LZzQ/view?usp=sharing
-
April 28, 2016 at 11:12 am #6391
SteveKeymasterDo you need to convert old data, in those fields, or not worry about it?
-
April 28, 2016 at 11:17 am #6392
wdrescherMemberNo I have been trashing all the posts and resyndicating the feed to publish them again so they are all fresh everytime so not worried about old post meta.
-
April 28, 2016 at 11:26 am #6393
SteveKeymasterpreview_url is a repeater field (add_more). Do you want to have multiple files per post?
-
-
April 28, 2016 at 11:30 am #6394
wdrescherMemberNope just one remote file url – essentially that field is used by the themes music player to play an mp3 (podcast) from that field
-
April 28, 2016 at 2:44 pm #6400
SteveKeymasterChange them to this. You may have to play with the conditions, or you can remove them:
piklist('field', array( 'type' => 'select' ,'field' => 'preview_media_type' ,'label' => __('Format','musik') ,'columns' => 2 ,'choices' => array( 'mp3' => 'mp3' ,'m4a' => 'mp4' ,'m4v' => 'm4v' ,'oga' => 'ogg' ,'webma' => 'webm' ) ,'conditions' => array( array( 'field' => 'preview_type' ,'value' => 'remote' ), array( 'field' => 'music_type' ,'value' => 'single' ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'preview_media_url' ,'label' => __('URL','musik') ,'columns' => 10 ,'conditions' => array( array( 'field' => 'preview_type' ,'value' => 'remote' ), array( 'field' => 'music_type' ,'value' => 'single' ) ) )); -
April 28, 2016 at 3:12 pm #6401
wdrescherMemberSo I swapped the code out with that section and then noticed the published databases look the same and nothing could play. Then I updated one of the posts and watch as it added another post meta field but this time just did the url without that structure it had before. It must need that structure to read the url because it doesn’t work even if you update the post now.
-
April 29, 2016 at 6:52 am #6403
SteveKeymasterIf it added another post meta field please check your form to see if you have two fields saving data to the same key. That would cause errors.
-
April 29, 2016 at 9:18 am #6404
wdrescherMemberI am sorry with my phrasing – it added an entry to the database like it normally does when I hit update but this time not in the same style that the theme needs.
Before code change: preview_media_url
a:2:{s:18:"preview_media_type";a:1:{i:0;s:3:"mp3";}s:17:"preview_media_url";a:1:{i:0;s:97:"https://audioboom.com/boos/4481292-13-take-a-lovely-journey-to-westeros.mp3?source=rss&stitched=1";}}After code change: preview_media_url
https://audioboom.com/boos/4450141-12-all-aboard-the-e3-hypetrain.mp3?source=rss&stitched=1 -
April 29, 2016 at 10:32 am #6405
wdrescherMemberFYI
I just tried making FeedWordpress schedule all posts as drafts. I then set up a draft to publish scheduler plugin to grab all drafts and schedule them from that post type thinking maybe it will save anything in that field correctly.
This did not work like I was expecting and instead it only worked when hitting update like usual. I wanted to rule out FeedWordpress as the culprit, that means FeedWordpress sent the info to the fields and marked it as draft correctly just the fields never saved in that format in my previous post.
The theme author got back to me and said this:
There are two preview types. local media and remote url. the local media(preview field) is a ID of the media from Media Library.
and remote url(preview_url field) is a json data eg.
a:2:{i:0;a:2:{s:18:”preview_media_type”;s:3:”mp3″;s:17:”preview_media_url”;s:52:”http://www.jplayer.org/audio/mp3/Miaow-02-Hidden.mp3″;}i:1;a:2:{s:18:”preview_media_type”;s:3:”oga”;s:17:”preview_media_url”;s:52:”http://www.jplayer.org/audio/ogg/Miaow-02-Hidden.ogg”;}}
Use the Feedwordpress can not save the data as json format.
-
-
AuthorPosts
- You must be logged in to reply to this topic.