This function adds a shortcode that display a link if user is logged in.
[current_user_link]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * Current User link shortcode * Use like so: [current_user_link] This is displayed only if current user is logged in. */ add_shortcode( 'current_user_link', 'wppbc_current_user_link' ); function wppbc_current_user_link( $atts, $content ) { if ( is_user_logged_in() ) { $id = get_current_user_id(); // make sure to change the URL to represent your setup. return "<a href='http://website.com/user-listing-page/user/{$id}'>Your User Page</a>"; } return ; } |
Create beautiful front-end registration and profile forms with custom fields. Setup member directories, custom redirects, cutomize user emails & more using the all in one user management plugin.
Get Profile BuilderCombine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.
Get 25% off with the bundle