Skip Navigation

[Resolved] Split: How to add view and delete profile link

This support ticket is created 2 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2030547

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...)

#2031021

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

#2031137

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.