How to use IF Statement in WordPress?

Here you go.. add_action( ‘gform_after_update_entry_7’, ‘add_length_on_update’, 10, 2 ); function add_length_on_update( $form, $entry_id ) { if( !empty($_POST[“input_3”]) && !empty($_POST[“input_27”]) && !empty($_POST[“input_28”]) ){ // get input from form $date = $_POST[“input_3”]; $start = $_POST[“input_27”]; $end = $_POST[“input_28”]; // convert date and time arrays into datetime formats $startdate = DateTime::createFromFormat(‘m/d/Y@h:i a’, $date . “@”. $start[0].”:”.$start[1].” “.$start[2]); $enddate … Read more

Gravity forms – Can I have multiple custom spinners? [closed]

Without testing, this should work (still use the add_filter bit): function cwwp_custom_gforms_spinner( $src ) { global $post; if( $post->ID == $id ): // use whatever page identifier/conditional you like here: ID, template used, slug etc. // other identifiers would probably be better and won’t rely on global $post // for example is_front_page(), is_archive(), etc return … Read more

Update post using gravity forms 2019 solution

I found a solution to fix this issue on the plugin Github page. It’s not ideal, but a work around until Gravity Forms makes this a core feature. https://github.com/jupitercow/gravity-forms-post-updates To fix the error and allow the plugin to be installed, you have to change… row 1021 in file gravityforms-update-post.php from (version 1.2.17)… add_filter( ‘gform_field_value_’ . … Read more

Getting redirect to happen before header output

Your method is called too late. I don’t know how you call this method but you need to run it before output is sent to the browser– usually that means before get_header(). There are a number of hooks that can be used. For example (from https://wordpress.stackexchange.com/a/131210/21376): add_action( ‘template_redirect’, function() { if (is_single()) { wp_safe_redirect(home_url()); exit; … Read more

get_page_by_title() not returning anything [closed]

You are missing the second parameter in get_page_by_title. See get_page_by_title() reference. When you are testing without explicitly specified $output and $post_type, this function returns the post of type ‘page’ object by default. So you have to return $page->post_parent for patient’s parent page ID: add_filter(‘gform_field_value_parent_id’, ‘parent_id’); function parent_id() { // three parameters here $page = get_page_by_title(‘TESTID’, … Read more

Gravity Forms Submit form as another user

A solution I have found is to manipulate the entry after submission using the following: function submit_as_user_proxy( $form ) { $id = null; $proxy_user_meta = null; $user_role=””; $field_existing_users = null; $field_signed_up_as = null; foreach ( $form[‘fields’] as &$field ) { if ( false !== strpos( $field->cssClass, ‘existing_users’ ) ) { $field_existing_users = &$field; } if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)