0

Terribly sorry for the vague title I'm not full sure how to describe what I want.

The general gist.....

I have BuddyPress and BBPress install on a website, and I'm trying to change the members page around a bit.

I have a page that displays my forum index, and when a user goes to their own profile, the default view is my forum page. I did this because navigating to the forums can be a bit tedious for none website savvy users. I just wanted to give them the forums straight away.

I've done this by defining a custom slug, and changing the BuddyPress DEFAULT_COMPONENT as instructed on their website.

The issue I have now is that when I click on another members profile, it displays the forum index. What I would like to do is make it so that when a member clicks on another members profile, it defaults to their activity or profile page. If that member clicks on their own, they see all the forums.

I have something like this

function lg_pick_menu ()
{
    if (! bp_logged_in_user() ) 
    {
        define ( "BP_DEFAULT_COMPONENT", "social");
        //$user = bp_is_user();
        //echo $user;
    }

    else 
    {
        define ( "BP_DEFAULT_COMPONENT", "profile");
    }

}

The commented lines (6 and 7) were just for my own testing and don't do anything as such.

Unfortunately I'm not a php magician, and the BuddyPress documentation is quite vague. Could someone help? or point me in the right direction at least? if I can crack this then I can get on with the rest of the site!

Many thanks,

Phil

closed as off-topic by Howdy_McGee Sep 13 '16 at 14:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

It sounds like you are using a bp_has_members loop on some page. I don't think you can change a define while in a loop.

In that loop, do you have this code?

<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>

And / Or:

<a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>

Then you could do something like this:

<?php if ( bp_get_member_user_id() == bp_loggedin_user_id() ) : ?>

     <a href="<?php bp_member_permalink() . 'activity'; ?>"><?php bp_member_name(); ?></a>

<?php else : ?>

     <a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>

<?php endif; ?>

Not the answer you're looking for? Browse other questions tagged or ask your own question.