adding new user sub page with custom profile design
-
Hey there,
I am in need to create a new subpage of a users profile but having its own template being completely different to the normal one. I have written a plugin for this which kind of works but it looks like I have some mistake in it. Hopefully you can tell me what the issue is.
I need the URL to be: xxx/username/links which I archived with:
add_action( 'bp_setup_nav', 'add_linksite_nav', 100 ); function add_linksite_nav() { global $bp; bp_core_new_nav_item( array( 'name' => 'Links', 'slug' => 'links', 'screen_function' => 'linksite_display_function', 'position' => 99 ) ); }
after that I have added the custom template like so:
function linksite_display_function() { load_template(plugin_dir_path(__FILE__) . 'template.php'); }
While the template is having this code:
<?php $user_id = bp_displayed_user_id(); $is_my_profile = bp_is_my_profile(); $username = bp_core_get_username( bp_displayed_user_id() ); $logged = is_user_logged_in(); get_header(); ?> <article id="content" class="index-page-frame position-relative"> <div class="content-limiter pt-3"> <div id="post-<?php the_ID(); ?>" class="position-relative" style="z-index: 10"> <div class="container text-center mt-8"> <div class="row"> <div class="col"><?php echo($username); ?></div> </div> </div> </div> </div> </article>
Issue is that my page is showing the username but also shows a 404 page not found error. Not only the content, also for the tab name and so on. So the page really seems to be a 404 but with my added content.
Do you have any idea how I can archive this custom template having this page slug but working fine?
Thank you,
Mike
- You must be logged in to reply to this topic.