Skip to:
Content
Pages
Categories
Search
Top
Bottom

Create new page (i.e. /user/mentions)

  • @abysshorror

    Member

    Hey ! I was wondering how can I create new pages for my users.
    The idea would be to add new pages such as user/mentions/ that would contain all mentions for that user.
    So far I’ve added the nav-item with no problems but I can’t seem to be able to create a new page, based on a php file.
    Thanks !

Viewing 4 replies - 1 through 4 (of 4 total)
  • @chrisclayton

    Participant

    @abysshorror – when you say “user/mentions” do you mean a page with a url structure like
    https://buddypress.org/community/members/abysshorror/mentions

    Assuming you set up the nav item with https://codex.buddypress.org/developer-docs/functions/core/bp_core_new_nav_item/

    The next part is to use the screen_function parameter, i learnt how to use it via the admin menu’s codex as the item navs are based off it… https://codex.wordpress.org/Administration_Menus

    Here’s a quick example i just wrote, (note: untested and i wrote it really quickly, so dont expect it to work out of the box) [Updated, see below]

    To use a php file in it, you would just replace the echos with a require(‘myfile.php’); (or get_template_part) to get the php file inside the screen function.

    @chrisclayton

    Participant

    edited the code as i had left out load template. see here – http://pastebin.com/Zy1bbZi3

    @abysshorror

    Member

    @ChrisClayton you are a genius, man !
    It worked out of the box :D

    Quick question:
    I’ve added your code to functions.php and it loaded perfectly, but I’d like to turn it into a function (so it’s a little less messy :)). What hook should I use ? (I mean which `add_action()` )

    Thabk you so much again !

    @abysshorror

    Member

    @ChrisClayton I’m still working on this :)

    An issue I’ve noticed is that for some reason I cannot find, some activity buttons like add to favorites or comment are not working. For example, if I try to add an activity update to my favorites, it actually sends me to the URL http://mysite.com/activity/favorite/218/?_wpnonce=a067fd9559

    I’ve checked and the URL is the exact same one that appears on other screens and the link works just fine (it applies some jQuery, I believe) but on this new page it takes me to that URL which is a 404.

    Thank you again :)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Create new page (i.e. /user/mentions)’ is closed to new replies.
Skip to toolbar