Help With Saving Draft Feature

This topic contains 10 reply and 3 voices, and was last updated by Tareq Hasan 10 years, 11 months ago
Viewing 10 Posts - 1 through 10 (of 10 total)
Author Posts
May 22, 2013 at 1:15 am 3949
Tareq Hasan Tareq, I am having trouble getting the save draft feature to work. I submitted a post earlier today describing my problem. When I try to save a post as a draft in the front end before submitting it, and then go back to edit it, only the title and category are saved - the body of my post is not saved. Please let me know how to fix this problem. Thanks.
May 22, 2013 at 4:46 am 3951
Tareq Hasan Tareq Hasan

You don’t have to create same topics to catch attention.

If you site is live, can I have a look? Post the details as private reply.

May 22, 2013 at 5:20 am 3955
btf122 btf122 This reply has been marked as private.
May 22, 2013 at 5:37 am 3956
Tareq Hasan Tareq Hasan

Seems like I overlooked the rich textarea when doing the draft post feature, it needs some special care to grab the contents from rich textarea.

You’ve to add this JavaScript code to the /js/frontend-form.js, after line 57. This will fix the problem.
[js]
var rich_texts = [], temp, val;

// grab rich texts from tinyMCE
$(‘.wpuf-rich-validation’).each(function (index, item) {
temp = $(item).data(‘id’);
val = $.trim( tinyMCE.get(temp).getContent() );

rich_texts.push(temp + ‘=’ + encodeURIComponent( val ) );
});

// append them to the form var
form_data = form_data + ‘&’ + rich_texts.join(‘&’);
[/js]

May 22, 2013 at 5:41 am 3957
btf122 btf122

Ok I will give that code a try. Thanks for your help once again Tareq.

May 22, 2013 at 12:18 pm 3996
paperweight paperweight

Hi tareq: quick question about updates and the code above. How do you notify paid users of updates to the plugin and how often do you add updates? And when you do update it will contain code above right?

May 22, 2013 at 12:30 pm 3997
Tareq Hasan Tareq Hasan

The plugin gets update as you get updates to the free plugins. You know them by the standard plugin/theme/wp update notification. License key is required to get plugin updates obviously.

See the changelog and the dates. Today I pushed an update with some fixes, but can’t remember if I’ve included this in the update or not 😆

May 22, 2013 at 1:33 pm 4001
btf122 btf122 This reply has been marked as private.
May 22, 2013 at 1:40 pm 4002
Tareq Hasan Tareq Hasan

may be the placement is wrong, see this:

[js]
var self = $(this),
form = $(this).closest(‘form’),
form_data = form.serialize() + ‘&action=wpuf_draft_post’,
post_id = form.find(‘input[type="hidden"][name="post_id"]’).val();

var rich_texts = []
temp, val;

// grab rich texts from tinyMCE
$(‘.wpuf-rich-validation’).each(function (index, item) {
temp = $(item).data(‘id’);
val = $.trim( tinyMCE.get(temp).getContent() );

rich_texts.push(temp + ‘=’ + encodeURIComponent( val ) );
});

// append them to the form var
form_data = form_data + ‘&’ + rich_texts.join(‘&’);

self.after(‘ <span class="wpuf-loading"></span>’);
[/js]

May 22, 2013 at 2:10 pm 4004
btf122 btf122

I tried that spacing as well and I still can’t seem to get it to work.

May 22, 2013 at 4:34 pm 4011
Tareq Hasan Tareq Hasan

I tested it and it works. So make sure you put that code in right place and clear your browser cache.

Viewing 10 Posts - 1 through 10 (of 10 total)