Forum Replies Created
-
@hnla appreciate the additional guidance on this! I was able to get it figured out thanks to your help.
@hnla thank you for the guidance. FWIW, I did try doing as much research as possible (and trying out a few things) before posting my question here.
I reviewed the information contained in the link you provided. Thanks for that. But after reading through that information, what I’m still unclear about is how/what template I should modify in order to affect ONLY the BP Registration page. (FYI, I’m not a php developer, so I do need a bit of hand holding for some of this kinda stuff.)
I read through the info on how to “Customize the layouts of BuddyPress pages within the WordPress Default Themes”. However, the instructions provided there seem to apply to scenarios where a site admin is wanting to make page template changes that apply to all BP pages on a site (i.e., by placing a customized buddypress.php file in the child theme folder).
In my case, I’m only wanting to change a single page (the Registration page) to remove the headers and footers. So I’m still unsure how I would go about doing that (even after reading through the info). Thank you very much for any specific guidance you can provide me with to accomplish this.
@danbp I appreciate you taking the time to provide me with the specific changes and also to point me to the exact file to download. I did exactly as you described above…
1. Placed your copy of the patched file in my bp-xprofile directory.
2. Copy/pasted your code snippet into my theme’s functions.php (since I don’t already have a bp-custom.php already created).But yet the chosen group id was not hidden upon going to Profile Edit page. I just don’t understand why this isn’t working for me! I even tried including multiple group id’s to hide in the filter to see if that would make a difference, but those weren’t hidden either.
Would it matter that I have my group_order (i.e., the order in which my field groups are displayed) arranged in a specific order?
@danbp unfortunately adding that additional conditional didn’t make any difference. Perhaps it could be some small parameter that I missed when manually modifying the code in the file. I’ll try again later to redo it when I’m not so tired.
On a separate note, I did notice that in the patch there is a reference to bp-xprofile-group.php. However, that’s a file that doesn’t appear to currently exist (at least not when I searched the BP 2.0.2 files installed on my server). I concluded (perhaps incorrectly?) that the patch developer kept that in there as a reference for the test case that was done to verify this patch works? Or am I perhaps suppose to add a new file with the name bp-xprofile-group.php and include the code that follows that section in the patch?
Here’s the part I’m referring to…
diff --git tests/phpunit/testcases/xprofile/class-bp-xprofile-group.php tests/phpunit/testcases/xprofile/class-bp-xprofile-group.php index 46f548f..699911b 100644 --- tests/phpunit/testcases/xprofile/class-bp-xprofile-group.php +++ tests/phpunit/testcases/xprofile/class-bp-xprofile-group.php @@ -67,4 +67,37 @@ class BP_Tests_BP_XProfile_Group extends BP_UnitTestCase {
@danbp OK, very good to know that BP 2.1 is 12 days away. Perhaps I will just wait until then and apply the upgrade and subsequently add your snippet to my functions.php.
And yeah, I must have done something wrong when trying to manually apply the patch to bp-xprofile-classes.php. Thanks again for your help and guidance.
@danbp thank you for the guidance on how to utilize a patch! Unfortunately, after I applied the changes (I believe correctly) to bp-xprofile-classes.php and also included your snippet inside my functions.php (and referencing the desired group number to be hidden), I was not successful in hiding the specific group that I want hidden.
How soon do you expect that BP 2.1 will be coming out? (Perhaps if it’s coming out hopefully soon, I could just wait for that BP 2.1 version instead of continuing to try and figure out how to get the patch to work.)
@danbp thank you very much for that helpful information! However, I’ve never applied a patch before. I’m not sure what to do with the patch once I download the file.
Would you be kind enough to provide me with some guidance on installing a patch?
Anyone?
@sagarjadhav that worked perfectly. Thanks!!!
@shanebp thanks for all of that VERY helpful info and guidance (including the links to code examples)! It is very much appreciated.
For now, I opted to go with not displaying the line for “N/A No Dog’ whenever a member has specified such.
Question… by using this type of code (i.e., the snippet you provided above) in my members-loop, will it result in performance issues on my database? Like if my site grows to thousands of users at some point, will I encounter any performance issues?
As an alternative solution, is it possible to exclude all members in the above list if they had selected ‘N/A’ for Dog Breed?
(And btw, in my code snippet above, I meant to type ‘Location’ instead of ‘Dog Weight’. Just wanted to clarify that to avoid any potential confusion about what I coded vs. the displayed results above.)
I really need to find a solution for the Activty text change ASAP.
I’m willing to pay $$ to the first person who can provide a working solution for BP 2.0.1 this week!
@flegmatiq, you can find my solution in this thread.
Anyone?
Great! Happy to help. 🙂
@8rizzi’s solution worked for me on a site running BP 1.9.1. However, I cannot get that same solution to work on a site running BP 2.0.1.
In BP 2.0.1, line 384 now reads as:
'post_title' => bp_get_directory_title( 'activity' ),
So that line 384 is obviously different than it used to be.
Does anyone have a revised method for BP 2.0.1 that will allow me to change the “Sitewide Activity” text?
I appreciate your advice and suggestions. I’ve got things working the way I want now.
I found another solution that was suggested by someone in a different thread I had opened. Instead of modifying the edit.php file, I simply put the following code inside my functions.php file in my child theme. (Or you could put it in bp-custom.php.)
Please be warned that this solution didn’t work when I tried it on my site running BP 1.9.1. (Even though my desired fields were successfully hidden by this solution, I still received a “required fields” error message after clicking the Save button.)
So, in order for this to work, you need to be running BP 2.0 +.
The below profile field ids 1, 32, and 48 correspond to the three fields I needed to hide from editing.
function simple_one_hide_some_profile_fields( $retval ) { if( bp_is_profile_edit() ) { $retval['exclude_fields'] = '32,48,1'; //field ID's separated by comma } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'simple_one_hide_some_profile_fields' );
Try inserting the following into your functions.php or bp-custom.php and see if it works. I modified my above code specifically to hide your profile field id 15.
function commoneasy_hide_some_profile_fields( $retval ) { if( bp_is_profile_edit() ) { $retval['exclude_fields'] = '15'; //multiple field ID's should be separated by comma } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'commoneasy_hide_some_profile_fields' );
OK, so this is interesting. When I tried inserting the code from @danbp in the functions.php file for another test site that I have, it worked! All 3 fields were successfully hidden during Profile Edit, and I no longer received the error message that all required fields must be filled in. Yippee!!!
Still not sure why I cannot get this to work on my first site, though. FYI, I’m running BP 1.9.1 on that one, and on the other test site (where I got this to work), I’m running BP 2.0.1. I even tried removing all code from my functions.php file on my first site and just leaving the above code, but that didn’t make any difference. So I’m still scratching my head trying to understand why this would work on one of my sites, but not the other.
NOTE: I did discover that this solution ONLY works if you do not have a required field set up in your base profile group. Otherwise, you will still receive the error message about needing to fill in required fields when you click the Save Changes button. I found a way to get around this by moving all required fields (like Display Username) out of the base profile group and putting those required fields in a different profile group.
Thanks. I tried inserting your suggested code into my functions.php, but it did not hide the desire fields. Also, I looked at the references in the links you provided for me to read through. Thanks for those too. However, I’m still stuck on how to resolve my problem.
Just to be clear… I think what I specifically need to figure out is how to add a filter to bp_the_profile_group_field_ids(), which apparently creates a list of the expected field names (for the specific group tab that I’m currently on) when I click “Save Changes” button on Profile Edit page. Until I can find a way to filter out my 3 desired “required” fields during the Save Changes button press, I will continue to receive the error message: “Please make sure you fill in all required fields in this profile field group before saving“.
Is there some other type of coding I can try to insert inside functions.php to resolve this?
I’d like to know how to do this too. Did you ever figure it out?
Correction to my last post. I meant to say…
I was able to successfully hide certain profile fields from being displaying (by modifying profile-loop.php). And I was able to hide the same fields from being displayed when a user goes to edit their profile (by modifying edit.php).
NOTE: Both files are located in: /bp-templates/bp-legacy/buddypress/members/single/
I still need help figuring out how to avoid the above-mentioned “required fields” error message upon clicking the Save Changes button.
Oops… I just found a problem.
The good news is that I was able to successfully hide certain profile fields from being displaying (by modifying profile.php). That part works great. Also, I was able to hide the same fields from being displayed when a user goes to edit their profile.
However, the problem I just discovered is that if any of those fields that I’ve hidden (using the above code changes) are “required” fields, then when a user goes to the Edit Profile page, the following error message appears upon clicking the Save Changes button: “Please make sure you fill in all required fields in this profile field group before saving.”
Even though I’m certain those hidden fields have values in them, that error message appears and there’s no way to save changes.
Any solution to this?
@shanebp, that worked perfectly! Thank you very, VERY much!!!
Anyone?