From: https://wpgeodirectory.com/support/topic/my-account-in-supreme-directory/

For the author page

[php]
add_filter(‘geodir_dashboard_links’, ‘dt_geodir_dashboard_links_custom’);
function dt_geodir_dashboard_links_custom($dashboard_link) {
if (!is_user_logged_in()) {
return $dashboard_link;
}
$post_types = geodir_get_posttypes(‘object’);

$user_id = get_current_user_id();
$author_link = get_author_posts_url($user_id);
$author_link = geodir_getlink($author_link, array(‘geodir_dashbord’ => ‘true’), false);

$show_listing_link_user_dashboard = get_option(‘geodir_listing_link_user_dashboard’);
$user_listing = geodir_user_post_listing_count($user_id);
$my_listings_link = false;

$show_favorite_link_user_dashboard = get_option(‘geodir_favorite_link_user_dashboard’);
$user_favourite = geodir_user_favourite_listing_count($user_id);
$my_favorites_link = false;

foreach ($post_types as $key => $postobj) {
if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
if (!$my_listings_link) {
$listing_link = geodir_getlink($author_link, array(‘stype’ => $key), false);

$dashboard_link .= ‘<li>’;
$dashboard_link .= ‘<i class="fa fa-user"></i>’;
$dashboard_link .= ‘<a href="’.$listing_link.’">’;
$dashboard_link .= __(‘My Listings’, ‘gdbuddypress’);
$dashboard_link .= ‘</a>’;
$dashboard_link .= ‘</li>’;

$my_listings_link = true;
}
}
}

foreach ($post_types as $key => $postobj) {
if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
if (!$my_favorites_link) {
$post_type_link = geodir_getlink($author_link, array(‘stype’ => $key, ‘list’ => ‘favourite’), false);

$dashboard_link .= ‘<li>’;
$dashboard_link .= ‘<i class="fa fa-user"></i>’;
$dashboard_link .= ‘<a href="’.$post_type_link.’">’;
$dashboard_link .= __(‘My Favorites’, ‘gdbuddypress’);
$dashboard_link .= ‘</a>’;
$dashboard_link .= ‘</li>’;

$my_favorites_link = true;
}
}
}

return $dashboard_link;
}
[/php]

For the dashboard area

[php]
add_action(‘sd_my_account_logged_in_extras’, ‘dt_geodir_dashboard_links_custom’);
function dt_geodir_dashboard_links_custom() {
if (!is_user_logged_in()) {
return;
}

$dashboard_link = ”;
$post_types = geodir_get_posttypes(‘object’);

$user_id = get_current_user_id();
$author_link = get_author_posts_url($user_id);
$author_link = geodir_getlink($author_link, array(‘geodir_dashbord’ => ‘true’), false);

$show_listing_link_user_dashboard = get_option(‘geodir_listing_link_user_dashboard’);
$user_listing = geodir_user_post_listing_count($user_id);
$my_listings_link = false;

$show_favorite_link_user_dashboard = get_option(‘geodir_favorite_link_user_dashboard’);
$user_favourite = geodir_user_favourite_listing_count($user_id);
$my_favorites_link = false;

foreach ($post_types as $key => $postobj) {
if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
if (!$my_listings_link) {
$listing_link = geodir_getlink($author_link, array(‘stype’ => $key), false);

$dashboard_link .= ‘<li>’;
$dashboard_link .= ‘<i class="fa fa-user"></i>’;
$dashboard_link .= ‘<a href="’.$listing_link.’">’;
$dashboard_link .= __(‘My Listings’, ‘gdbuddypress’);
$dashboard_link .= ‘</a>’;
$dashboard_link .= ‘</li>’;

$my_listings_link = true;
}
}
}

foreach ($post_types as $key => $postobj) {
if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
if (!$my_favorites_link) {
$post_type_link = geodir_getlink($author_link, array(‘stype’ => $key, ‘list’ => ‘favourite’), false);

$dashboard_link .= ‘<li>’;
$dashboard_link .= ‘<i class="fa fa-user"></i>’;
$dashboard_link .= ‘<a href="’.$post_type_link.’">’;
$dashboard_link .= __(‘My Favorites’, ‘gdbuddypress’);
$dashboard_link .= ‘</a>’;
$dashboard_link .= ‘</li>’;

$my_favorites_link = true;
}
}
}

echo $dashboard_link;
}
[/php]

Please log in to rate this.
2 people found this helpful.


Category: Supreme Directory Theme

← FAQs