• Resolved redearthdesign

    (@redearthdesign)


    Hello!
    Great plugin. Wanted to ask if you have plans to support user_meta fields down the road? Right now it calls posts, and fantastic to have the options to narrow in on post types and custom fields.

    I’ve got Advanced Custom Fields set up in user profiles (not posts) and would love to also be able to select one of those field values from a user’s profile. Since it’s not associated with a post id though, instead a user meta id / meta value, I don’t have the option to pull that meta value and process.

    I do see that ACF is supported, but looks like only if the fields are in a post, not user data.

    Thanks again for a great plugin!

    Best wishes!

    http://wordpress.org/plugins/video-thumbnails/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter redearthdesign

    (@redearthdesign)

    Or, is there a way to pass a function a link to the video directly instead? Then I could pull the URL(s) from the user meta field and pass that URL to a function to generate the thumbnail and then echo it out in a template.

    Plugin Author Sutherland Boswell

    (@sutherlandboswell)

    If you’re comfortable with a little bit of coding you could write a little bit of code to find and store the thumbnail for your specific needs, but since it seems to be an unlikely situation it probably won’t have official support anytime soon.

    But a basic idea of what you’d need to do is below.

    function save_my_user_meta_video_thumbnail( $user_id ) {
    	// Need to include the global var
    	global $video_thumbnails;
    
    	// Set what we're going to scan
    	$markup = get_user_meta( $user_id, 'whatever_field', true )
    
    	// Now scan  for a thumbnail
    	foreach ( $video_thumbnails->providers as $key => $provider ) {
    		$new_thumbnail = $provider->scan_for_thumbnail( $markup );
    		if ( $new_thumbnail != null ) break;
    	}
    
    	// Save thumbnail URL to user meta if we've found one
    	if ( $new_thumbnail != null ) {
    		update_user_meta( $user_id, 'user_video_thumbnail', $new_thumbnail )
    	}
    }
    
    add_action( 'profile_update', 'save_my_user_meta_video_thumbnail', 50, 1 );
    Thread Starter redearthdesign

    (@redearthdesign)

    Thanks so much! scan_for_thumbnail() was what I was looking for – appreciate the code example!

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

The topic ‘user_meta / Advanced Custom Fields support’ is closed to new replies.