Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Forum: Plugins
    In reply to: [Regenerate Thumbnails] 404

    I had the same issue – turns out I was missing my .htaccess file. Hope this helps at least one other person ??

    Thread Starter codevelop

    (@codevelop)

    What’s the easiest way to share my code? I’m used to doing this through Github

    Thread Starter codevelop

    (@codevelop)

    Thanks! If ever I get around to adding my plugin to www.remarpro.com, I’ll be sure to update the thread.

    Thread Starter codevelop

    (@codevelop)

    Having separate field groups works, but isn’t really a viable option

    What I meant about the clone field, is that I explored the following idea before opening a ticket:

    – Create a group of all fields minus the reCAPTCHA
    – Create another group with 2 fields. One field a clone of the above field group (so as to include all of those fields, without needing to manage 2 sets of the same fields in parallel) and the other field being the reCAPTCHA.

    In the end, I wrote a quick plugin that adds some field settings to any field:
    – show only for: (ignore / all logged in users / all logged out users / [select role(s)]
    – hide for: (ignore / all logged in users / all logged out users / [select role(s)]

    Thread Starter codevelop

    (@codevelop)

    
    /**
    	 * Create entry when form is submitted
    	 *
    	 * @since 1.0.0
    	 *
    	 */
    	function create_entry( $form ) {
    
    		// Make sure entries should be created
    		if ( ! $form['create_entries'] ) {
    			return;
    		}
    
    		// Create entry post
    		$post_data = array(
    			'post_type' 		=> 'af_entry',
    			'post_status' 		=> 'publish',
    			'post_title'		=> '',
    		);
    
    		$entry_id = wp_insert_post( $post_data );
    
    		if ( ! $entry_id ) {
    			return;
    		}
    
    		// Update post title
    		$updated_title_data = array(
    			'ID' 			=> $entry_id,
    			'post_title' 	=> sprintf( '#%s', $entry_id ),
    		);
    
    		wp_update_post( $updated_title_data );
    
    		// Save general entry info
    		update_post_meta( $entry_id, 'entry_form', $form['key'] );
    		update_post_meta( $entry_id, 'entry_submission_date', date( 'Y-m-d H:i:s' ) );
    		update_post_meta( $entry_id, 'entry_ip_address', $_SERVER['REMOTE_ADDR'] );
    
    		// Transfer all fields to the entry
    		af_save_all_fields( $entry_id );
    
    		// Save generated entry ID to submission object
    		AF()->submission['entry'] = $entry_id;
    
            apply_filters( 'af/form/entry', $entry_id );
            apply_filters( 'af/form/entry/id=' . $form['post_id'], $entry_id );
            apply_filters( 'af/form/entry/key=' . $form['key'], $entry_id );
    
    	}
    
    Thread Starter codevelop

    (@codevelop)

    Correction, I think it would be best to hook into create_entry (not entry_saved)

    Thread Starter codevelop

    (@codevelop)

    I just realized it’s not so simple – since it’s in the constructor, the defaults get created before any chance to hook from one’s functions.php

    I think the best way would be to add a settings page. I’ll work that out and get back to you.

    Thread Starter codevelop

    (@codevelop)

    I’d tried the same thing as well (great minds think alike!) but it sounds like we came to the same discovery about the Clone field.

    I totally see where you’re coming from about the slippery slope. I think a more versatile solution would actually be if, there were more Conditions for fields in the ACF core, including User Role.

    Since my form is on the front, I’d want to use the “exclude” argument for acf_form – but it’s not the cleanest solution, plus I’m actually using Advanced Forms plugin for this set of fields, as it’s a contact form :/ The circumstances are making this tricky!

    I realized my code modifications are not quite as complete as I thought… the JS is throwing an error since the div with the corresponding ID is missing. I’ll see if I can advance this some more. On that note – it would actually be great if the JS / CSS dependencies only get loaded after verifying whether there’s a form on the page that has a Captcha field. I noticed, at least the JS, is loaded on every page when the plugin is installed. Although, I guess once the script gets cached that no longer matters.

    Thread Starter codevelop

    (@codevelop)

    Thanks for the quick response.

    The problem with my current use-case is that the only field in the entire group that I’d want to disable for logged-in users is the captcha field. I don’t want to create one set of fields for logged-in users, and other for logged out, where the only difference is that one captcha field.

    I dabbled in the code and have managed to add this setting within the admin, and have the field not appear if set to “true” and the user is logged in.

    The only part that’s not quite right is that I’m still left with the label, which I end up needing to hide by adding a class to the field.

    If you’re interested, I can share my work through github?

    codevelop

    (@codevelop)

    I was about to ask the same in regards to adding a class to the form – which, by extension, would also allow you to customize the submit button.

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