Forum Replies Created

Viewing 9 Topics - 1 through 9 (of 9 total)
Author Posts
March 29, 2014 at 1:06 pm in reply to: Jquery Datepicker Customization 17508
jman057 jman057

I added this to make sure I could select an appropriate date range

yearRange: '-90:+1'

Thanks for the solution!

October 24, 2013 at 2:23 pm in reply to: Maps in front end form not working 9374
jman057 jman057

That worked!

Next time I’ll just try that first… thanks!

September 23, 2013 at 2:50 pm in reply to: Keep text address in address cf 8463
jman057 jman057

okay found where it went wrong, the single quotations weren’t the right kind of single quotations so it wasn’t reading it as a string (if you look closely you can see they are different), so I went over those and solved it 🙂

Cheers,

Jamie

September 22, 2013 at 3:41 pm in reply to: Keep text address in address cf 8423
jman057 jman057

Any suggestions on the previous?

I’ve also tried setting the priority to “1” with:

add_action( ‘wpuf_add_post_after_insert’, ‘wpufe_inesrt_address’, 1 );
add_action( ‘wpuf_edit_post_after_update’, ‘wpufe_inesrt_address’, 1 );

I’ve deactivated all other functions that I’ve added that use these action hooks

Would be great if I could echo the address without having to ask the user to enter it twice. I’m open to other ideas (is there a way to convert the coordinates to text address?)

Many thanks in advance!

Jamie

jman057 jman057

Hi Tareq,

I can’t seem to get that function to work. I want to retain the written address to show in the post.

I’ve tried sending to to a different custom field other than “address”, I’ve tried embedding it in a different function that I know executes, and I’ve tried removing the “if” conditional. None of the options seem to work.

Any ideas? It doesnt need to go back to the address field if that helps?

Thanks!

Jamie

September 5, 2013 at 4:18 pm in reply to: Does 'Post Expiration' work? 7828
jman057 jman057

Hi exsite,

I needed this functionality (the ability to set expiry dates on posts) and found a solution. Tareq, I hope this is useful to your other users.

Download and install the plugin “Content Scheduler”. It is crucial that you get version 0.9.8, not the current version, so click the “Developers” tab when viewing it on the wordpress repository. Check the setting of the plugin, it seems to work well with all features, although I had multiple email notifications when attempting a 7-day advanced notice email, so disabled that.

I have this working two ways for my site, so I will share both methods. First, I let the users set the expiry date. To do this create a “date” field, and set the meta key to “_cs-expire-date” (without the quotations). In the “date format” option, enter “yy-mm-dd 00:00:00” exactly. This will let the user set the date, however you also need to enable it, so create a radio button option custom field and set the meta key to “_cs-enable-schedule” and the options to be “Enable” and “Disable” (you could probably get away without the disable option and use a checkbox).

The second way was to automatically set the posts to expire a given number of days from the listing date. Here is how I did that.

[php]function wpufe_set_default_cat( $post_id, $form_id ) {

$expdate = date("Y-m-d H:i:s", strtotime("+2 days")); //change this to suit
$willexpire = get_post_meta( $post_id, ‘_cs-enable-schedule’, true ); //returns if an expiry date has been set already so the user doesnt reset it just by editing the post

if ( 1366 == $form_id ) { // this is the form for which I want to auto-set expire

if( ‘Enable’ <> $willexpire ) {// check if it is already enabled
update_post_meta( $post_id, ‘_cs-enable-schedule’, ‘Enable’ );
update_post_meta( $post_id, ‘_cs-expire-date’, $expdate );
}
}
}

add_action( ‘wpuf_add_post_after_insert’, ‘wpufe_set_default_cat’, 10, 2 );
[/php]

I’m sorry for the messy code, I’ve only been coding for a few weeks so there is no doubt a better way around this, but it seems to work for me, so hopefully it will for you too.

August 16, 2013 at 4:12 pm in reply to: Multiple Custom Post Types in Dashboard 7017
jman057 jman057

Thanks for the function Tareq, was an easy solution for me too. Helped me to display multiple custom post types in the dashboard.

Cheers!

July 6, 2013 at 1:58 pm in reply to: Auto-assign custom taxonomy? 5631
jman057 jman057

Hi Tareq,

Thanks again, Although I have realised that it would be better if I could auto assign a tax based on the user (so I’m not creating a new forms for each user) so I tried the following but it doesn’t work (works when I substitute $user_id for $form_id)

function wpufe_set_default_cat( $post_id, $user_id ) {
  
    if ( 3 == $user_id ) { // change the number to your user ID
        wp_set_post_terms( $post_id, array( 49 ), 'ctax_instution' );  // the number is category ID
    }

    if ( 2 == $form_id ) { // change the number to your form ID
        wp_set_post_terms( $post_id, array( 39 ), 'ctax_instution' ); // the number is category ID
    }
}
  
add_action( 'wpuf_add_post_after_insert', 'wpufe_set_default_cat', 10, 2 );

Again, realise this is beyond the normal level of support, so understand if you don’t reply, but if it’s a quick fix then any advice would be appreciated. Thanks!

July 4, 2013 at 8:04 am in reply to: Auto-assign custom taxonomy? 5569
jman057 jman057

Thanks Tareq, worked perfectly!

Viewing 9 Topics - 1 through 9 (of 9 total)