/** * returns a set of buttons used on individual profiles in list view to enable saving * and removing profiles via ajax */ public static function wpp_profile_buttons($user_id, $profile_page_id, $cv_url = false) { $data_attr = sprintf(' data-user_id="%s" data-profile_page_id="%s"', $user_id, $profile_page_id); $buttons = sprintf('<a class="profile-button ajax-button" data-ajax_action="view" href="#" data-linkurl="%s"%s>View Profile</a>', get_permalink($profile_page_id), $data_attr); if (ltp_data::is_saved($user_id, $profile_page_id)) { $buttons .= sprintf('<a href="#" id="save_%s" data-ajax_action="remove" class="profile-button ajax-button"%s>Remove</a>', $profile_page_id, $data_attr); } else { $buttons .= sprintf('<a href="#" id="save_%s" data-ajax_action="save" class="profile-button ajax-button"%s>Save</a>', $profile_page_id, $data_attr); } if ($cv_url) { $buttons .= sprintf('<a href="#" id="download_%s" data-ajax_action="cv_download" class="profile-button ajax-button" data-linkurl="%s"%s>CV</a>', $profile_page_id, $cv_url, $data_attr); } return $buttons; }