How to put link on my profil page that user can see their post ("profil")?
How can user delete their profil and post ("porfil")?
One question, if I create new ticket that you will answer or someone else? I ask because you are familiar with my project (user have post but that post are user profile...)
Waqar
Supporter
Languages:
English (English )
Timezone:
Asia/Karachi (GMT+05:00)
Hi,
To show the current user's profile post link and delete profile link, you'll need his/her "Projektanti" post's ID.
You can register a new shortcode, that can return this ID:
add_shortcode('current_user_post_id', 'current_user_post_id_fn');
function current_user_post_id_fn( $atts ) {
$a = shortcode_atts( array(
'type' => ''
), $atts );
$user_post = get_posts( array(
'post_type' => $a['type'],
'author' => get_current_user_id(),
'numberposts' => 1
) );
if(!empty($user_post)) {
$target_post = $user_post[0]->ID;
return $target_post;
}
}
Note: you can add this with the other custom shortcodes that were added earlier.
Next, please add "current_user_post_id" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.
After that, you'll be able to show the user's profile post link, using the "wpv-post-url" shortcode:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-url )
<a href="[wpv-post-url item='[current_user_post_id type='projektant']']">View Profile</a>
And delete profile link, using the "cred-delete-post" shortcode:
( ref: https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred-delete-post )
[cred-delete-post action='delete' onsuccess='self' item='[current_user_post_id type='projektant']']Delete profile[/cred-delete-post]
regards,
Waqar
My issue is resolved now. Thank you!