bp_is_user_profile()
will return true
if the current page is a profile page. Does that help?
Thanks for your help.
That’s for the profile component:
mysite.com/members/example-user/profile/
mysite.com/members/example-user/profile/edit/
mysite.com/members/example-user/profile/change-avatar/
I’m looking for a conditional for only:
mysite.com/members/example-user/
I call mysite.com/members/example-user/ the main profile page as that is what I’ve seen others call it but I think I’ll call it the users homepage from now on. So yeah I’m basically looking for the conditional for mysite.com/members/example-user/
bp_is_user()
might be what you need. It will return true
when there is a displayed user. For example, all of the following would return true
:
example.com/members/user
example.com/members/user/profile
example.com/members/user/friends
If not, then take a look here. That’s everything that’s currently available that relates to user pages.
I don’t think there is a conditional for it as I’ve looked everywhere for it.
bp_is_user()
won’t work because I need it only
for:
example.com/members/user
Not
example.com/members/user
and example.com/members/user/profiles
and example.com/members/user/friends
etc.
So far it appears there is no conditional for it.
So far it appears there is no conditional for it.
In that case you’ll need to use the &&
operator to exclude the pages you don’t want.
Hi Henry, I think he is referring to load profiles page conditionally.
Ex: if a user choose “male ” as option while sign-up, or else “female ” based on xprofiles (may be, but for example I’m informing ).
Then based on those conditions, he wants to load specific home/profile template ( each template is different).
So if one can use if & else statements to load different templates from BP home page template
Hi @fiush,
I’m not sure that is what @andy277 wants. @andy277 can you confirm?
You can achieve this by using, ‘if ‘ and ‘else ‘ statement.
You can do that in theme/members/single/home.php
You can modify the code,
<?php locate_template( array( ‘members/single/member-header.php’ ), true ); ?>
To,
1) if user have profile field ‘male ‘ then
<?php locate_template( array( ‘members/single/member-header-male.php’ ), true ); ?>
Else (eg: based on profile field selected,)
2) <?php locate_template( array( ‘members/single/member-header-female.php’ ), true ); ?>
Make sure to create two different templates in the same directory.
If this not the case, Henry can help you
I haven’t tested this code, got it from another site, lets say you wanted to display a link when you are viewing a users page:
global $bp;
if ( bp_is_user() ) {
?><a href="<?php echo $bp->displayed_user->domain; ?>" >This links back to users homepage</a> <?php
}
how would you write this so this code doesn’t show on the users homepage? as we don’t want this link to show when we are already on the homepage
global $bp;
if ( bp_is_user() && ! the_conditional_for_a_users_homepage() ) {
?><a href="<?php echo $bp->displayed_user->domain; ?>" >This links back to users homepage</a> <?php
}
My coding skills are very less but want exactly what @Flush said I saw the code in bp but I don’t now what exact code to use to modify the above said piece of code.
Will you guys provide the conditional statement to load two files based on created profile fields.
I don’t know weather @andy277 also wants same.
@andy277 your questions are so confusing.
I don’t think any one can understand what exactly you want to achieve.please be clear on the topic.
I Apologize for not being clear.
If I asked someone for the conditional for the homepage on a wordpress site, they’ll say home_url
If on a multisite and I wanted a conditional for both the multisite homepage and a user homepage, the’ll say network_home_url
for the multisite homepage and home_url
for a users homepage.
What is the homepage for a users homepage on buddypress? When I say users homepage, I’m talking about the page that displays as soon as you click on a member in the members directory, so for member chris the homepage is on mysite.com/members/chris
What is the conditional for when the page is on a users homepage like mysite.com/members/chris
I’m saying I don’t think there is a conditional for it, bp_is_user
displays on all users pages but I just want it for the users homepage.
So this will probably be the last time I ask a support question on my mobile.
I just wanted to know if a conditional for the URL mysite.com/members/user1 exists but I don’t think it does.
By the way, what do you call this page anyway:
mysite.com/members/user1
I’ve been calling it users homepage
To achieve this, just use a plugin for login or sign-up, and their you will get the options to set redirect url. So that after log in and log out you can re direct the user to his/her profile and to direct home page after sign out.
Sorry @sammjv, may be any moderator will help you, who has better knowledge of bp moderation.
Ask @Henry Wright for further development.