• I try to use the Dashboard for the members of my site also for navigation. The logged in user has a own post where he can work on his data. This post is linked in the wp menu on the left site (see screenshot). I think is a dynamic link with the post number of the user. Now I would like to get rid of the left menu and link the user through the link in a custom Dashboard site under ?Meine Daten bearbeiten“ to his post.
    Does someone know how this can be done?

    Here is a link to a screenshot to explain it better: https://dein-sachsenheim.de/wp-content/uploads/2021/12/Bildschirmfoto-2021-12-08-um-10.26.46.png

    • This topic was modified 2 years, 11 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz

    (@bcworkz)

    What plugin or theme is responsible for this custom dashboard? It’s not the standard default WP dashboard. I recommend asking through the dedicated support channel of the responsible module. The expert users and devs there will have better knowledge of the code that’s involved to modify custom dashboard links and to add (or not add) items in the left menu.

    Thread Starter timolookingforanswers

    (@timolookingforanswers)

    The plugin for the dashboard is from divilife. But its a normal site build with the theme builder. The left menu is the normal WordPress menu. My problem is I want to have a link that dynamically leads to the members page. I have now set up a shortcode that deliver the url. But I can not find a solution how to use the shortcode in a link or button.

    Moderator bcworkz

    (@bcworkz)

    If you want the link in the left menu, that’s feasible, but the destination would need to dynamically deliver member specific content, whether by how the page is coded or by redirect, it doesn’t matter. But the menu scheme itself doesn’t generate individual specific links. For example, we cannot have a dynamic user based menu link like /member/bcworks/, but a generic menu link like /member/ could figure out I’m the current user and redirect me to /member/bcworks/, or generate dynamic content directly. A shortcode is of little use in the left menu, other than the menu item’s callback could call the shortcode handler and do something with the returned content.

    If instead you want to use the shortcode in the divllife dashboard, it could be done if there’s an available action hook. The action callback could then do something like
    echo do_shortcode('[your-shortcode-name]');

    Thread Starter timolookingforanswers

    (@timolookingforanswers)

    I have wrote a function for a shortcode that delivers the url I want to link at.

    function custom_shortcode_func1() {
    	ob_start();
    	$current_user = wp_get_current_user();
    	return 'https://dein-sachsenheim.de/wp-admin/post.php?post=' . $current_user->wwp3_contact_sponsor_id . '&action=edit';
    	$output = ob_get_clean();
        return $output;
    }
    add_shortcode('site_url', 'custom_shortcode_func1');

    But the Divi text modul does not translate the shortcode in the link url. This would be the best solution. Now I use a href link with the shortcode an it works.

    Moderator bcworkz

    (@bcworkz)

    It might help if your shortcode returned the entire anchor link instead of just the URL.

    FWIW you don’t really need the output buffer stuff in this situation for the shortcode to work.

    Shortcodes work in post content because the do_shortcode() function is hooked into “the_content” filter. The dashboard doesn’t do this, hence your shortcode doesn’t work as expected. If dashboard output is filtered, you could do something similar. Alternately, if an action hook is available (which is more likely), you could add a callback that directly outputs your desired link.

    We don’t have access to divilife source code so we cannot advise about specific hooks. Look through the source code for the dashboard elements where you want the link to appear and look for apply_filters() and do_action() calls.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP Admin menu for members’ is closed to new replies.