I am currently creating a website for students to access practice exams and study materials to help them pass their upcoming exams.  In doing this, I am using a combination of BuddyPress, Gravity Forms, and the Divi Theme (plus the plugins I will be naming throughout this post).  The reason I chose these plugins is because my client doesn’t have the extra finances to spend on numerous plugins, I already have a developer license with Gravity Forms and Divi, so we are planning to create the functions and call the data we need through the PHP. I am a Front-end Developer and I am training to become a fullstack, so if you see something that I could do better, comment below.

Warning: the following is an advanced method for doing the task of adding a custom menu option to the BuddyPress Menu and may be difficult for beginners.  

Creating Custom Menu Items for BuddyPress Profiles

The first issue I came across is that I have no user-friendly control over the BuddyPress Menu.  While researching, I was only able to find one free plugin that hasn’t been updated or tested in my version of WordPress called “BuddyPress Custom Profile Menu” and I am far too busy to mess with this plugin at the moment so I decided to take the custom code method.

I created a couple of changes to the functions created by WebDev Studios.  They were creating a custom menu item called “Portfolio” in BuddyPress that was simple and allowed for simple content to be added to the bp_custom_screen_content function.  I wanted to get page content from a page within my WordPress site, so I added the following code.

I created the following function:

function bp_custom_screen_content() {
	$my_id = 28; //Post ID can be found in URL when editing the page or post
	$post_id_28 = get_post($my_id); //swap out 28 for the id in the $my_id field
	$content = $post_id_28->post_content; 
	$content = apply_filters('the_content', $content);
	$content = str_replace(']]>', ']]>', $content);
	echo $content;
	
}

This function would pull the content from my page and show it when the user clicked on my custom menu item. Grab the code at on GitHub

Next I created the content within my Page Editor on WordPress:

Then I checked that the content is working on my Member Profile for BuddyPress:

Everything works perfectly.

Check if User is Logged In:

I need my profile pages to first check if a user is logged in.  This is when I found a plugin called BuddyPress Lock which sends the guest user a request to login or create an account in order to see the content they are trying to see.  Quick heads up, the plugin doesn’t have the greatest style sheet, so I will be editing it and adding a post about editing the style of the members page when the user is not logged in.

Next I am going to work on a function to only show the Gravity form if the user has paid for the quiz.  Then we need a function to show the entries for the content submitted when the user takes the quiz, a way to give the user feedback on the incorrect answers and what to study now, and then decide from there what other functionality is priority to finishing the project.

Thank you for reading, let me know if you have any questions about the information above.  If you need step-by-step simple instructions for using the code on GitHub, click here to read “The Basic Steps for Creating BuddyPress Custom Menu Item” or leave a comment below.