Buddypress Members Directory Page - wordpress

I have buddypress installed in wordpress and Paid Membership Pro.
When someone registers they use the buddypress reg from with some additional profile fields I added to collect info then after registration they choose a paid or free membership level via the paid membership pro plugin.
So now I want to display a list of users that signed up for a free or paid membership. The default buddypress page domain.com/members shows all registered users whether they choose a membership level or not. Some spammers just registered so I don't want to display those, only users that continued and chose a membership level.
I would like to show ONLY users that have completed the checkout and chose a membership level (not just registered) and also display which level they purchased next to their name.
By default it appears that the members page shows an avatar, the users name and last activity.
I would like to also maybe remove the activity and add a couple of the custom profile fields I added to the buddypress registration form.
I assume I could maybe update the members-loop.php page ?
Or is there a better way?
thanks!!

There is a better way of doing it than updating members-loop.php. You can hook to the bp_ajax_querystring filter. For example:
function my_exclude_users_filter( $query = false, $object = false ) {
// manipulate the query however you like
return $query;
}
add_action( 'bp_ajax_querystring', 'my_exclude_users_filter', 30, 2 );
Hope this gives you a good example of how it can be done.

Related

Is there a WordPress plugin or a php code to insert a table that user can manipulate the data in it

Right now I am using the ultimate member plugin to register users. But the company asked me to change the form and allow users to insert their education qualifications in a table when registering. Users need to have a button that has the ability to insert more rows (If they have more qualifications).
As far as I know, I can't use the Ultimate Member plugin for that. I searched for many table plugins but didn't find anything that can do this task. I once had done this using code. But I don't know how to apply it to this registration form. If anyone can figure out a way to embed the code to Ultimate member (to save that table data) or any plugin that can do this, please let me know soon as possible.
Updated Question
I have tried that shortcode and got confused as it ruined the page. Now I'm trying a PHP method to solve this problem.
Thank You
Well you have many options to solve this problem. What you are actually looking for is Custom Fields.
WordPress has the ability to allow post authors to assign custom fields to a post. This arbitrary extra information is known as metadata.
Now, custom fields can be created in 2 ways.
Either you write php code in a plugin/theme
Or you you install plugin which helps you build custom fields.
What you are actually looking for is to create Repeatable Field Groups. These are the field which can be replicated. As many as you want.
Some plugins which provide facility to add them in no particular order are:
Advanced Custom Fields - Repeater Field : https://www.advancedcustomfields.com/resources/repeater/
Toolset - Repetable Field Group : https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/
Metabox - Meta Box Group : https://metabox.io/plugins/meta-box-group/
They all will give you ability to create repeater fields.
Repeater field can be made for both users and posts or Custom Post Types(CPT). You need them for Users. I am not sure which one of them allows you to create repeater field for Users but you can check on there website.
PS : These are all paid plugins. (They may have free version of them but repeater field comes with PRO).
Once you have created a field for users you can use that field in your registration form.
UPDATED ANSWER
As the question author wants to add the field using PHP, the field can be added as so.
After looking at all the hooks available to the user by UM (Ultimate Member) plugin. I found two hook that can be used to add fields and save in the backend.
um_after_form : Some actions after register form fields.
add_action( 'um_after_form', 'my_after_form', 10, 1 );
function my_after_form( $args ) {
// add your repetable fields here.
}
um_after_save_registration_details : Action on user registration after save details. This runs after the form is submited and user is registered. Use this to save data inside the user database.
add_action( 'um_after_save_registration_details', 'my_after_save_registration_details', 10, 2 );
function my_after_save_registration_details( $user_id, $submitted ) {
// Save field here.
// You have user_id and submitted data, do your thing here.
}

How can I allow a wordpress user to view, add, update or delete specific custom posts via the admin?

Once this user is created by an admin role.
My goal is to give this wordpress user only access to his/her posts - can view, add , update or delete in Wordpress admin.
My goal is to create a wordpress user that can view, add , update or delete in Wordpress admin.
I DO NOT want to use plugins
I want the user to be able to access only the ids it creates in multiple custom post types. say user x is setup, he can only work with his posts (ids) in custom post types (say: businesses, products, orders)
I don't usually do this, but you may be better off just using a Role Editor plugin like User Role Editor. The alternatives would be to give the Roles & Capabilities documentation a read, and decide if it's better to modify an existing role, or creating a new role and give it the select permissions you want.
For instance, you'd probably want to create a new role based on the editor role, and remove all of the {blank}_others_{blank} capabilities, such as edit_others_posts, delete_others_posts, etc.
If you do go the programatic way instead of plugin, note that the Roles & Capabilities are stored in the database, so you don't need to include the function that creates/modifies them on every load like the init hook. If you do put it on a hook like that, you'll probably want to set a flag of some sort (like with update_option()) and abort if the new role/cap hasn't been changed since it was last run.
You are able to do this using the Author role.
https://en.support.wordpress.com/user-roles/
Author
An Author can create, edit, publish, and delete only their own posts, as well as upload files and images. Authors do not have access to create, modify, or delete pages, nor can they modify posts by other users. Authors can edit comments made on their posts.
Within a CPT set the capability type to post.
'capability_type' => 'post'

adding different types of user accounts in wordpress

I want to add 2 types of users in my wordpress website.I've read this post , but it's not providing any free method.
Multiple User registration forms for different types of users in wordpress
It'll be like "Buyer and Seller" , seller can add auctions and post stuff while buyer can bid. They both would have different access.
I want to verify seller and let them wait until approval while buyer can simply register.
These functions are what "profile builder pro" provide but I don't want to spend on it.
I've tried to use "Ultimate Profile Builder" , but when I add custom fields they don't appear in form.
I've also tried WP registration , it provide very clean forms but problem is that it don't have option to manage different roles - is this possible that I can manage both type of users with single registration form by providing different fields based on role selection(may be i can use radio button for role selection).
It's easy you can learn about all wordpress users types, and whats roles given to all users, below screenshot

woocommerce assign roles in registration form

We are building a website for our project and using Wordpress/Woocommerce.
What we want is for the registration form to allow selection of the various user types (individual, SME, etc.) or roles and then offer the appropriate pricing options depending upon the choice when a product is selected.
I've been trying to research various plugins and there are quite a few it would seem, but am new to Woocommerce and am very unsure whether they can do that exactly as required.
Can anyone point me in the right direction?
Much appreciated,
Jim.
Here is a plugin WP Roles at Registration ,this plugin asks the user to choose his role in the website during registration from a list of selected roles.
And for pricing the products according to there roles you can use the plugins like
Woocommerce Role Pricing
Woocommerce Role Based Price
WooCommerce user specific pricing extension
Check these plugins and user which fits your requirement.
Let me know if this solves your issue.

User Role plugin to restrict editing to specific Categories for Pages

I need a plugin that would restrict registered users to only be able to add/edit pages in specific categories. Even though WordPress pages do not have "Categories" like posts do.
Like, if I have a category called "Robot Maintenance", I want to make sure that only specified users or roles can edit and create pages in that category.
I see that the Member plugin lets me create new roles with such capabilities as "edit only pages they own" but I was hoping I could create a role (for say, a department) and configure that role to be able to edit and create pages within the {department} category. Or even limit users to specific categories.
This is a fairly complex task, and you may want to engage a professional wordpress plugin developer to build this for you.
Having said that....
It is possible to add categories to a page. Check out the tutorial at http://shibashake.com/wordpress-theme/add-tags-and-categories-to-your-wordpress-page
Next, you will want to programatically create roles for each page category you have. You will want to hook into the create and remove category to create/remove your special role. Then, you can use the members plugin to grant proper permissions.
Then, you need to hook into the page edit flow to ensure that the current user has the permissions to edit the current page (based on your custom roles and the page's category).
Still a bit of work for you to research...but at least this should give you a fairly good starting point.

Resources