Create Dynamic User Profile Tabs for BuddyPress
If you are using BuddyPress User Profile Tabs Creator Pro, It allows you to create unlimited profile tabs/sub tabs for a BuddyPress user. It works well for most of the cases. You can create any type of content, use shortcodes and do a lot of things.
There is one case that our members have been asking(a few on forums and some on emails), they want to have user specific content for the tab instead of the same content being shown to each user. Even though it was feasible to use shortcode to generate dynamic content, there were no specific plugins that allowed for generating tabs specific content.
I created BuddyPress Dynamic User Profile Tab Content plugin to address the issue of content generation and association with tabs. When combined with BuddyPress User Profile Tabs Creator Pro, you can create unlimited tabs and have content specific to each user for your BuddyPress site.
Concept:-
Th idea is to use a combination of post type, a custom taxonomy term and a user to identify the content belonging to each tab for the user. We will:-
- Use post type for content
- Use post author field to associate content to a user
- Use a custom taxonomy that allows us to distinguish multiple posts by associating content to a term from this taxonomy.
- combine the combination of post type, author and term to create user specific content. We use a shortcode to specify this combination in the profile tab plugin.
Let us see it in action. Here is a example help page specific to each user.
Process:-
Step 1:- Decide the name for the user profile tab. In this example, we will use "Help".
Step 2:- Create a type(term) that we will use to show content for this tab. For simplicity, I will name it "Help Tab". You can name it anything you want. It is not public and only used internally, feel free to use any name. You only need to create it once.
Step 3:- Create User specific content. You will need to repeat this step for each user you want to have specific content. This is the only step that needs repetition.
From the User Tab Content Menu, you can add new post.
Add content specific to a user:-
Associate Content with a User:-
Associate Our Content Type:-
And publish the post.
Once you publish/save it, you will see the shortcode in the info box.
The shortcode is not specific to this post. It will be same for all post/term combination. It is there to help you use it easily.
Using shortcode in the profile tab:-
If it is the first time that you have added content for this post type/term combination, Please copy the shortcode and use it in the profile tab.
Save your tab details and visit the profile.
And you have it. If you visit some other user's profile, you will see content specific to their profile.
That's all. Have fun.
Links:-
Download:- buddypress-dynamic-user-tab-content-1-0-1.zip
Github Repo: https://github.com/buddydev/buddypress-dynamic-user-tab-content
BuddyPress User Profile Tabs Creator pro documentation:- link