Forum Replies Created
-
I figured out another way to do it via the $bp object. Resolved!
Thanks @shanebp. This is the approach I eventually went with and all is working as it should!
Thanks @danbp!
Hi @shanebp, I was wondering if I could put the “add_action” within a function and have it work? I have tried but I have been having so many problems this morning I just need to make sure that it is truly not possible! Here is my function derived from your function above:
function is_right_user() { global $bp; $loggedin = bp_loggedin_user_id(); $displayed = bp_displayed_user_id(); if ( $loggedin == $displayed) { add_action( 'bp_setup_nav', 'custom_bp_subnav', 50 ); } } add_action( 'bp_ready', 'is_right_user' );
I would like to do a check to make sure that the user is only on their own page when being able to access a subnav item.
Thanks
Like the other poster, I have used css to hide the items for now. Hopefully that is not the only thing I can do because the items I want to remove from the list are only available for paid members. Changing the css is too simple to make this secure.
Thank you so much @danbp! Again that is 😉
I am abandoning trying to use the profile.php file by adding a case and just going with a new file in members/single/filename using this similar code (which works as intended):
function custom_bp_nav() { global $bp; bp_core_new_nav_item( array( 'name' => __( 'Site Settings', 'buddypress' ), 'slug' => 'site-settings', 'position' => 80, 'screen_function' => 'site_settings_screen', 'default_subnav_slug' => 'site-settings', 'parent_url' => $bp->loggedin_user->domain . $bp->slug . '/', 'parent_slug' => $bp->slug ) ); } function site_settings_screen() { //add title and content here - last is to call the members plugin.php template add_action( 'bp_template_title', 'site_settings_screen_title' ); add_action( 'bp_template_content', 'site_settings_screen_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/test' ) ); } function site_settings_screen_title() { echo 'Site Settings'; } function site_settings_screen_content() { echo 'Content here'; } add_action( 'bp_setup_nav', 'custom_bp_nav', 50 );
After finding this code
if ( '' != locate_template( array( 'groups/single/home.php' ), false ) ) { bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) ); } else { add_action( 'bp_template_content_header', create_function( '', 'echo "<ul class="content-header-nav">"; bp_group_admin_tabs(); echo "</ul>";' ) ); add_action( 'bp_template_content', array( &$this, 'edit_screen' ) ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', '/groups/single/plugins' ) ); }
I am assuming I need to simply load the profile page using the appropriate filter. Now, to find the filter!
That did it! Changed over to legacy files and now I can place and modify the profile.php in my child-theme (another not-so-nice name for describing a regular wordpress theme).
Small suggestion: make this knowledge (bp-legacy over bp-default) a BIG note in the theme development documentation of this site!
Thanks @danbp for your question which prompted me to dig further and @shanebp for confirming my improper use of bp-default.
Yikes! I will transfer all my custom work to the proper files then and see if that makes a difference.
Sorry, part of the above is not true. I am using bp-custom.php. The only function in there is to disable BP registration.
//EDIT
Oh my! I just found this post https://buddypress.org/support/topic/bp-legacy-in-bp-templates/ . Am I supposed to be using the files from bp-legacy as this post suggests? If so, what a terrible name for a folder!
Thanks for your reply @danbp! I got the profile.php from bp-default. I had previously placed bp-default custom edit.php and change-avatar.php inside the child theme at single/profile folder without a problem.
Yes, I use many custom functions in my functions.php file but I have not made use of bp-custom.php.
I also have a custom template titled plugin-buddypress.php in my child-theme folder above the buddypress folder.
I disabled all the profile plugins (pics, follow, cover, conditional field groups) and commented out all functions acting on Buddypress in my functions.php file. This did not make a difference! I still have a blank loop with the profile.php added to my child theme.
//EDIT
And I am running BP 2.3.2.1 on WP 4.2.4Thanks for the update Tom! This was exactly my problem as well. As soon as I included a title the error disappeared!
Thanks for the info. So there is no way that I can create a function that hooks into say…the page load and then check a user’s role and allow them to edit profile data?
I finally found the function that controls access (I think):
public function user_admin_load()
in bp-members-admin.php
Could I make a new copy in my theme folder so that I could hack the code? Not that I want to do that but according to the ticket, this issue has been outstanding for 2 years! My client needs to allow team members access to alter profiles but that is all they should be doing. And she needs this asap. There is no way she can wait 2 years! lol