Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Where in that function do you place the sub account’s ID?… let’s say it’s abc123

    Thread Starter doverlord

    (@doverlord)

    Couldn’t get item 1 to work: this ‘author’ field seems redundant!

    Got item 2 working eventually, and am using this to write my own author data:

    [fu-upload-form post_id="2" title="Submit your paper"]
    [input type="file" name="photo" id="ug_photo" class="required" description="Your File" multiple=""]
    [input type="text" name="author_name" id="author_name" description="Name of Author"]
    [...other fields added here...]
    [input type="submit" class="btn" value="Submit"]
    [/fu-upload-form]

    (had to check ‘Suppress default fields’ in Settings and add my own, eg submit )

    Then, in Theme Functions (functions.php):

    function my_fu_after_upload( $attachment_ids ) {
    		foreach( $attachment_ids as $att_id ) {
    			$title = $_POST['title'];
    			wp_update_post( array( 'ID' => $att_id, 'post_title' => $title ) );
    
    			$content = $_POST['post_content'];
    			wp_update_post( array( 'ID' => $att_id, 'post_content' => $content ) );
    
    			$excerpt = 'Author: ' . $_POST['author_name'] ;
    			wp_update_post( array( 'ID' => $att_id, 'post_excerpt' => $excerpt ) );
    		}
    	}
    	add_action( 'fu_after_upload', 'my_fu_after_upload' );

    (I’m saving everything to the default fields in wp_post – post_content and post_exerpt)

    Item 3 remains a mystery.

    Thread Starter doverlord

    (@doverlord)

    Thanks, I see that. But what I want to do is set the image to attach to a post other than the one the form’s attached to; I don’t wan to have to go in and change it manually. This seems to be possible from what’s said on the FAQs page, but it’s not clear how to do it: item 6 under Shortcode Parameters reads…

    'post_id' => ID of the post the image should be attached to. Defaults to current post id

    I want to set it to a post other than the current post.

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