• Resolved spikespiegel

    (@spikespiegel)


    Hello, this code is supposed to get the post’s author url, using Advanced Custom Fields, but this gets the default wordpress url that goes to the user profile. How can I adapt it for getting Ultimate Member User profile?

    <div id="meta-coauthor">
    	<span class='metacoauteur'>
    	<?php 
    		$values = get_field('post_autor'); 
    		if($values) { 
    			foreach($values as $value)	{
    				$author_ID = $value['ID'];
    				$author_url = esc_url( get_author_posts_url($author_ID) );
    echo ', <a href="'.$author_url.'">' . $value['display_name'] . '</a>';
    			}	
    		};
    	?>
    	</span>
    </div>

    I know it has something to do with um_user_profile_url( get_current_user_id() );, but I don’t know to call um_user_profile_url from inside ACF function.

    [ Please do not bump. ]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @spikespiegel

    Please try this code snippet:

    <div id="meta-coauthor">
    	<span class='metacoauteur'>
    	<?php 
    		$values = get_field('post_autor'); 
    		if($values) { 
    			foreach($values as $value)	{
    				$author_ID = $value['ID'];
                                    um_fetch_user( $author_ID) ;
                                   echo ', <a href="'.um_user_profile_url( ).'">' . um_user("display_name") . '</a>';
    			}	
    		};
    	?>
    	</span>
    </div>

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @spikespiegel

    ..This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

    Thread Starter spikespiegel

    (@spikespiegel)

    Hello, I didn’t get back to you before because I was still learning, but I’m still am, how to use Advanced Custom Fields.

    I implemented your code like this, inside my custom functions plugin, but it’s returning a blank page:

    // Adiciona algo após o conteúdo da postagem
    function wpb_after_post_content($content){ if (is_single()) { $content .= 'Contributors:' . '<div id="meta-coauthor"><span class="metacoauteur">' .
    		$values = get_field('post_autor'); 
    		if($values) { 
    			foreach($values as $value)	{
    				$author_ID = $value['ID'];
                                    um_fetch_user( $author_ID) ;
                                   echo ', <a href="'.um_user_profile_url( ).'">' . um_user("display_name") . '</a>';
    			}	
    		}; 
    	'	</span>
    </div>';
     }
        return $content;
    }
    add_filter( "the_content", "wpb_after_post_content", 9999 );
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 100, 50, true );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get Ultimate Member user profile url with advanced custom fields’ is closed to new replies.