Skip to:
Content
Pages
Categories
Search
Top
Bottom

Create new tab within User Profile

  • @chopo87

    Participant

    Hi,

    I’m trying to make a plugin to allow users to upload documents to their buddypress profile. I’ve manage to setup the database, and the admin settings menu. Now what I need to do is add the code that generates a tab within the user’s profile where the user can upload/delete files and others can brows through them.

    I don’t really have a deep understanding of the inner workings of BuddyPress, all I’ve done so far is based on reading through other similar plug-ins and forum posts:

    The current code I’ve writer when activated brakes the individual members profile to the point that wordpress returns a blank page with not a single html tag. Here is the relevant code I’ve written so far. All I want to do at the moment is make the tab appear when I click on a users profile. I’ll deal with populating it later,

    // Create Slugs and global variables<br />
    if ( !defined( 'BP_PROFILE_DOCUMENTS_SLUG' ) )<br />
    define ( 'BP_PROFILE_DOCUMENTS_SLUG', 'profile_documents' );</p>
    <p> function bp_profile_documents_setup_globals() {<br />
    global $bp, $wpdb;</p>
    <p> /* For internal identification */<br />
    $bp->profile_documents->id = 'profile_documents';<br />
    $bp->profile_documents->table_name = $wpdb->base_prefix . 'bp_profile_documents';<br />
    $bp->profile_documents->format_notification_function = 'bp_profile_profile_format_notifications';<br />
    $bp->profile_documents->slug = BP_PROFILE_DOCUMENTS_SLUG;</p>
    <p> /* Register this in the active components array */<br />
    $bp->active_components[$bp->profile_documents->slug] = $bp->profile_documents->id;</p>
    <p>}</p>
    <p>/*/ add navigation item for user --<br />
    function bp_group_documents_setup_nav() {<br />
    global $bp, $current_blog, $group_object;</p>
    <p> bp_core_new_nav_item( array(<br />
    'name' => __( 'Chopo87' ),<br />
    'slug' => $bp->profile_documents->slug,<br />
    //'position' => 50,<br />
    //'show_for_displayed_user' => false,<br />
    //'screen_function' => 'messages_screen_inbox',<br />
    //'default_subnav_slug' => 'inbox',<br />
    //'item_css_id' => $bp->messages->id<br />
    ) );<br />
    }/**/

    As you can see the “bp_group_documents_setup_nav()” function definition is commented out. This is because as soon as I insert that piece of code I brake the user profile web page. I’ve added the other code based on the group documents plugin to see if it helped, but this may not be necesary or helpful. I’ve also commented out most of the bp_core_new_nav_item as i read (here http://codex.buddypress.org/developer-docs/functions/core/bp_core_new_nav_item/) that they are optional.

    You can find my full code at http://aitzol.com/buddypress_profile_documents.txt

    Any help would be apreciated

    Chopo

Viewing 1 replies (of 1 total)
  • @peteranselmo

    Participant

    If you’re seeing a blank page, that means a PHP error is being thrown, but not displayed.

    Try adding the following to your .htaccess file:

    php_flag display_errors on

    php_value error_reporting 7

    That will make debugging much easier.

    Alternately, if you have access to the Apache logs, it will probably be there.

Viewing 1 replies (of 1 total)
  • The topic ‘Create new tab within User Profile’ is closed to new replies.
Skip to toolbar