Created
August 23, 2021 07:43
-
-
Save champsupertramp/20f738c6bc3f5017dc19fdb2ed950b95 to your computer and use it in GitHub Desktop.
Display Specific Profile with a Shortcode on a Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sample usage: [um_embed_profile user_id="123" form_id="3"] | |
*/ | |
add_shortcode("um_embed_profile","um_082321_embed_specific_profile"); | |
function um_082321_embed_specific_profile( $atts ){ | |
$atts = shortcode_atts( array( | |
'user_id' => get_current_user_id(), | |
'form_id' => 0, | |
), $atts ); | |
extract( $atts ); | |
UM()->user()->target_id = $user_id; | |
$value = "[ultimatemember form_id='{$form_id}']"; | |
if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) { | |
return do_shortcode( $value ); | |
} else { | |
return apply_shortcodes( $value ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi i tried the code, but not working form me showing multiple profiles in profile tab.
here the code i added, i don't know its wrong or right? because i am new in this field. if my code is wrong please guide me the right code or just give me modified code with my user & profile id. many many thanks
/**
Sample usage: [um_embed_profile user_id="um_card-holder" form_id="1383"]
*/
add_shortcode("um_embed_profile","um_082321_embed_specific_profile");
function um_082321_embed_specific_profile( $atts ){
$atts = shortcode_atts( array(
'user_id' => um_card-holder(),
'form_id' => 1383,
'user_id' => um_mumayizat-black(),
'form_id' => 12003,
), $atts );
extract( $atts );
UM()->user()->target_id = $user_id;
$value = "[ultimatemember form_id='{$form_id}']";
if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
return do_shortcode( $value );
} else {
return apply_shortcodes( $value );
}
}
and i putted both profile shortcode in profile tab.