Forum Replies Created
-
In reply to: Block users
Hi,
I managed to find how to suspend users within buddypress.
It was under user profile (in admin area) and then “extended profile” (loosly translated from swedish). Then I can choose “spammer” and that account is then blocked.
So it was just hard to find. But seems to work π
In reply to: Block usersI am a little scared of usin plugins that seem to not be updated. But have anyone tested this: https://wordpress.org/plugins/bp-toolkit/
Or have other tips?
Thanks in advanced for any tips on this topic π
Thank you π (that was a desperate note – sorry)
@emaralive thanks and I am aware.
I thought perhaps someone kind would look at it and see what in the redirect goes wrong and perhaps its something easy for a coder.
All the other text is for context to make it easier to understand what I am trying to do.
I mean I can listen to the AI-models and just split the code and put a filter in the function file. But something in me says there must be some way to redirect to your own messages after login with prefilled “send to” value. It feels like something that buddypress would be able to handle nativly?
Hi,
did you manage to solve this? I am asking the same thing, but for a usertype (“employer” from WPJM plugin).
Best regards,
flamuren
I wrote this code in the child function file but it wont work. Any suggestion what might be wrong?
function my_custom_bp_employer_features_setup() { add_action( 'bp_members_directory_tabs', 'my_custom_members_directory_employer_tab', 10 ); add_filter( 'bp_pre_user_query_args', 'my_custom_members_directory_filter_by_role' ); add_action( 'wp_head', 'my_custom_members_directory_employer_tab_styles' ); } add_action( 'bp_loaded', 'my_custom_bp_employer_features_setup' ); function my_custom_members_directory_employer_tab() { error_log( 'my_custom_members_directory_employer_tab: Attempting to add "Arbetsgivare" tab.' ); if ( ! function_exists( 'buddypress' ) || ! bp_is_active( 'members' ) ) { error_log( 'my_custom_members_directory_employer_tab: BuddyPress or Members component not active.' ); return; } bp_members_add_tab( array( 'id' => 'employer', 'text' => __( 'Arbetsgivare' ), 'slug' => 'employer', 'link' => bp_get_members_directory_permalink() . 'employer/', 'position' => 35, 'css_id' => 'members-employer-tab', 'screen_function' => 'my_custom_members_directory_employer_screen', 'show_in_filters' => true, 'filter_id' => 'employer', ) ); error_log( 'my_custom_members_directory_employer_tab: Successfully called bp_members_add_tab().' ); } function my_custom_members_directory_employer_screen() { error_log( 'my_custom_members_directory_employer_screen: Screen function called.' ); bp_core_load_template( 'members/index' ); } function my_custom_members_directory_filter_by_role( $query_args ) { error_log( 'my_custom_members_directory_filter_by_role: Filter applied.' ); if ( bp_current_action() === 'employer' ) { error_log( 'my_custom_members_directory_filter_by_role: Filtering by "employer" role.' ); $query_args['role'] = 'employer'; } return $query_args; }go to wp admin/dashboard – settings – buddypress – settings – and here you should have settings to adjust how registrations are handled.
I cant confirm since I have official registration set to active. But if I remember you can set your settings to either manual or automatic here.
Please try and confirm π
In reply to: Apply user roles upon registrationOMG I am sooo happy! Chatgpt and some noob questions to it managed to tweak the code so now it works! π
If anyone would need it, this now works:
function assign_role_based_on_profile_field($user_id) { // Get the BuddyPress profile data for the registered user if (function_exists('xprofile_get_field_data')) { $role_value = xprofile_get_field_data('Roll', $user_id); // Replace 'Role' with the exact name of your profile field $user = new WP_User($user_id); // Assign the user role based on the profile field value if ($role_value == 'Arbetsgivare') { // Assign 'employer' role $user->set_role('employer'); // Replace 'employer' with the exact role slug } elseif ($role_value == 'ArbetssΓΆkande') { // Assign 'candidate' role $user->set_role('candidate'); // Replace 'candidate' with the exact role slug } else { // Default role if no specific selection is made $user->set_role('subscriber'); // Or any other default role } } } add_action('bp_core_activated_user', 'assign_role_based_on_profile_field', 10, 1);In reply to: Apply user roles upon registrationI would really prefer not to use extra plugins for this small feature. Its only this small detail I want to fix – might need to pay a developer to sort it out π
Thanks for your help π
In reply to: Apply user roles upon registrationThanks π It would work with a membership plugin to handle it. However it wont be able to use the WPJM roles: candidate or employer. WPJM plugins use these to allow different dashboards for the users depending on user roles.
If I would use a role/member plugin it would create new roles that would not be able to control this.
Thats why I would like for the code snippet to work and assign users the predesigned roles from WPJM for a more complete solution.
Hope this makes sense and that anyone would like to help. Its over my head π
In reply to: Does this honeypot code still work?I found it here:
In reply to: shortcodes and menus not working on new installfound the menu items if I edit the user profile menu from the theme customizer.
Perhaps the theme is not compatible with the latest 12.4.0.
So not really any issue – just strange.
In reply to: Can you please help me look in the login templateSolved it by coying the code from another install.
In reply to: shortcodes and menus not working on new installJust to clarify: when managing menues I dont have the “buddypress directories” or “buddypress-member” menu options.
So I cant add them to the menu.
They seem to have been removed on the latest 12.4.0. Since I have the exact same website installed a week before using 12.3.0 which have these menu options.
In reply to: Can you please help me look in the login templateI found the file here on github, but it does not look the same, only one row of code (latest update 3 months ago). I use the latest update and it has two rows.
https://github.com/buddypress/buddypress/blob/master/src/bp-core/blocks/login-form/index.asset.php
In reply to: Assigning PagesOk I see now that we use urls only. This is probably clever, but tricky to keep track of. Perhaps beginner time to adjust to it ππ
In reply to: Assigning PagesI can verify this. Has used buddypress before and when installing the installationguide created and assigned pages. Now I got nothing and was trying to figure out what to do. Found this thread so I am not alone.
In reply to: Can’t add Buddypress pages manuallyI can verify this. Has used buddypress before and when installing the installationguide created and assigned pages. Now I got nothing and was trying to figure out what to do. Found this thread so I am not alone.
In reply to: Hide pages/contentA quick update for others that are looking to do this.
I choose https://wordpress.org/plugins/lock-my-bp
Works great, easy to use and is 100% free. The only small issue as of now is a slight issue that the blog articales can be shown as not logged in – even if the blog page is locked. Hopefully the plugin creator will see this and make it work. But its a small issue really. Love the plugin.
In reply to: Hide pages/contentThanks for the code tip.
I also got this recommended for me: https://wordpress.org/plugins/lock-my-bp
I think with all these tips and plugins etc I will try some out and evaluate. I will try to remember to update this thread on what solution I go with and how it works.
In reply to: Hide pages/contentHas anyone tried any of these plugins?
6 Best WordPress Restrict Content Plugins π 2023 (Free & Paid)
In reply to: Hide pages/contentThanks alot Venutius. Except for the bad reviews on that plugin it seems to be a good fit to try.
I will try to keep on google and look in the support forum, to do some more research as you propouse.
If anyone else have anything to recommend I am all ears π
In reply to: How to create login and register pagesHi, this thread helped me fixed a question to get login page sorted – many thanks.
Just a follow up though. Is it possible to get a button/link to display on the login page to the “forgot password” page? π€