Functions Php :
add_shortcode( 'membervip', 'memberviparea' );
function memberviparea( $atts, $content = null ) {
if( is_user_logged_in() ) return '<p>' . $content . '</p>';
else return;
}
Post :
[membervip]Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.[/membervip]
With this code I can show the links to only logged in members, but I want to only display the links for members who are logged in and have made a comment.
What code can do this?
Check if the user has left a comment
This function will check if the user has left a comment on the current post. If you want to check if the user generally left a comment (on any post), delete or comment out this line'post_id' => $pid, // get only comments from this post and
Update
Because such a function could be usefull, I rewrite the code a bit to make it easier to reuse it. Now it is possible to check if the user left a comment on any post or on a specific post by passing the post ID to the function.