Babak Fakhamzadeh (@mastababa)

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yeah, that should be fine, @neon67.

    In my point 4, above, you would add a tab for your private chats and then just include the shortcode via a print do_shortcode().

    I provide a workable solution in this thread:

    Add custom tab to profile page

    I provide a workable solution in this thread:

    Add custom tab to profile page

    Here’s my solution. It’s not as neat as it should be, but it works, without mucking around in bbpress or its core functions.

    In this example, I’m adding a tab/page for ‘events’. My theme is ‘rebalance-child’.

    1. Copy user-profile.php and user-details.php to /bbpress/ in your theme folder.

    2. Near the top of user-details.php, add something like this:

    $profile_sub = "";
    if (isset($_GET["sub"])) {
    	$profile_sub = $_GET["sub"];
    }
    if ($profile_sub != "events") {
    	$profile_sub = "";
    }

    3. Replace the code that displays the first bullet (‘Profile’) with something like this:

    			<li class="<?php if ( bbp_is_single_user_profile() && $profile_sub == "" ) :?>current<?php endif; ?>">
    				<span class="vcard bbp-user-profile-link">
    					<a class="url fn n" href="<?php bbp_user_profile_url(); ?>" title="<?php printf( esc_attr__( "%s's Profile", 'bbpress' ), bbp_get_displayed_user_field( 'display_name' ) ); ?>" rel="me"><?php esc_html_e( 'Profile', 'bbpress' ); ?></a>
    				</span>
    			</li>
    			
    			<li class="<?php if ( bbp_is_single_user_profile() && $profile_sub == "events") :?>current<?php endif; ?>">
    				<span class="vcard bbp-user-profile-link">
    					<a class="url fn n" href="<?php bbp_user_profile_url(); ?>?sub=events" title="<?php printf( esc_attr__( "%s's Events", 'rebalance-child' ), bbp_get_displayed_user_field( 'display_name' ) ); ?>"><?php esc_html_e( 'Events', 'rebalance-child' ); ?></a>
    				</span>
    			</li>

    4. Update user-profile.php to display something else, based on the value of the ‘sub’ query string parameter. So, something like this:

    <?php
    	if ($_GET["sub"] == "events") {
    		//stuff related to events//
    	}
    	else {
    		//regular stuff//
    	}
    ?>

    Above, ‘//regular stuff/’ would be the content that was in user-profile.php before.

    Shoutout for plugin bbPress2 shortcode whitelist.

Viewing 5 replies - 1 through 5 (of 5 total)