OMG 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);
Hi Ryan,
You can use Shortcodes for BuddyPress plugin to display BuddyPress activities on any page. You can find it here: https://wbcomdesigns.com/downloads/shortcodes-for-buddypress/
It also provides shortcodes for members and groups, allowing you to display member and group directories on any custom page.
Please let me know if you have any further questions!
Thanks Renato for the questions.
The API isn’t using a login or password, just the open API as it was the easiest way.
To assign a custom template to your BuddyPress registration page instead of using the standard blog post template, you can follow these steps:
Install a Page Builder: Consider using a page builder like Elementor along with the BuddyBuilder plugin. This combination allows you to create a custom registration template easily.
Create a New Template: Navigate to Templates > Add New in your WordPress dashboard. Choose “BuddyPress” as the template type and select the “Register page.”
Design Your Template: Add the necessary widgets such as “Account Details,” “Profile Details,” and a “Submit Button.” You can also customize the layout to fit your site’s design better.
Set the Template: Once your template is created, ensure it is set as the default for the registration page in the BuddyPress settings.
Test Your Changes: After saving your changes, visit the registration URL to confirm that the new template is applied correctly.
By following these steps, you should be able to assign a custom template to your BuddyPress registration page successfully. If you have any further questions or need assistance, feel free to ask!
Also, if youâre considering investing in real estate, check out Faisal Town Phase 2 for a prime location with modern amenities.
@whyknott I would have posted this sooner, but I was looking into the relationship between the BP_AVATAR_ORIGINAL_MAX_WIDTH
CONSTANT and cropping preview area, which requires a deeper dig into this process. Neither here nor there, as previously mentioned, I don’t recognize any of the filters that end in ‘_resize_args’ and AFAIK, there are technically 2 (two) but the one I used has the hook name of:
bp_after_attachment_avatar_edit_image_parse_args
To elaborate further, there is a bp_before_..._parse_args
and a bp_after_..._parse_args
, FWIW. Moving along, your custom_bp_avatar_quality
callback function should work with this hook, IOW use the following to set the resize quality for Avatar:
add_filter( 'bp_after_attachment_avatar_edit_image_parse_args', 'custom_bp_avatar_quality' );
This should remove any questions or concerns about the jpg/jpeg compression level, i.e., “quality”. assuming that a value of 100 is used for resize and crop. If the Avatar is still âhorribly blurryâ or utilizing your new term “lousy” then the issue resides elsewhere, e.g., scaling/zooming the Avatar to something greater than 100%. Since I don’t know your scenario/situation, I’ll stop at this point.
To display the current user’s menu outside of their profile in BuddyPress, you can use the bp_get_menu
function. This function retrieves the menu items for the current user and returns them as an array.
Here’s an example code snippet that you can use to display the current user’s menu in the header or footer:
`
<?php
$menu_items = bp_get_menu( array( ‘user_id’ => get_current_user_id() ) );
if ( ! empty( $menu_items ) ) {
echo ‘<ul>’;
foreach ( $menu_items as $menu_item ) {
echo ‘<li><a href=”‘ . $menu_item[‘url’] . ‘”>’ . $menu_item[‘label’] . ‘</a></li>’;
}
echo ‘</ul>’;
}
?>
`
This code retrieves the menu items for the current user using bp_get_menu
, then loops through the array and displays each menu item as a list item.
You can place this code in your theme’s header or footer file, or in a separate template file, depending on your site’s structure.
I hope this helps! Let me know if you have any further questions.
I need to limit the entry of characters in a multiline textarea at the user profile settings (frontend). There are several questions about this in this forum with no real solution. Most of them are several years old.
As far as I see is buddypress using the tinyMCe editor together with this field.
On the tinyMCe blog they provide a solution to “How to limit characters and set a maxlength with TinyMCE”
How can I use that in buddypress? I would need to use the wordcount plugin and edit the tini.init script.
If I can’t implement that in buddypress is there any other solution for this issue?
I do not have BuddyPress yet. I am researching the best way of hosting on my own site something that will work like Facebook Groups does. So far, I really like what I am reading about BuddyPress. However, it is important that I can assign badges to my members. For instance, if you are a guest looking around and asking questions (hey great) but I want others to be able to know that you aren’t a “member” of the group and you have not completed any of the training course around which the group is formed. Does BuddyPress have this capability. These are the needs:
âą I want to award the badges myself, I don’t want them awarded automatically (ie FB groups badges)
âą I want to be able to name the badges myself
âą The badge should appear next to the user’s name everywhere
Thanks for your help.
Hey.
I am looking into BuddyPress.
For a Norwegian Permaculture web site using the Site Editor and Twenty Twenty Three theme.
Should I have a subdomain with another installation of WordPress containing BuddyPress to not cloud up the default site?
Hjem
Should I just add it into the default site?
I am wondering if someone creates a kind of mini video tutorial going through BuddyPress? Kinda like twice a year there is a tips and tricks in beginning with BuddyPress. A kind of 7-10 minute video just going through the standard.
Should I add bbPress into BuddyPress?
Basically what would be helpful is to have some better visual documentation.
Btw I found this: https://github.com/buddypress/buddypress/tree/master/docs/user/getting-started
Thank you.
I have a BIG headache when using BuddyPress and wager many others do too. I have many users join my site every day which Iâve set to manually approve each user(membership). Many membership requests I quickly approve as I see from their answers to my varied signup questions they are genuine.
@epgb101 I can help you automate this manual approval process.
Hello,
I would like to remove the statement that shows on the registration page:
“Registering for this site is easy. Just fill in the fields below, and weâll get a new account set up for you in no time.â
I see there has been other questions about this, (for example, here: https://buddydev.com/support/forums/topic/hide-register-text-in-bp-regsiter-form/) but it has not been resolved for me. I am not using Buddypress Nouveau. I have BuddyPress 12.4.0.
Thank you
Ok, I am trying to set up a local community for goldfish enthusiasts. Yeah, sorry this is far out, but aren’t we all that, in some way or an other?
Anyway, I have been looking at forums, where I had planned to create categories for people to share projects, updates, ask questions, promote their social media posts etc. O couĂŠdnt find any that quite intergrated as well into wordpress as buddypress, but I am struggling to see if it has the functionality that I need.
As far as I can see, users can post updates (like a tweet update correct?) and they can (maybe?) write blog posts on the site? This will allow others to comment and run a discussion this way. This may be ok for most uses actually, especially if set up with categories.
But how could I fun administrator and moderator discussions, or get suggestions started from the users?
I really like how BuddyPress looks on the site, but I am aftraid that I may indeed need a forum (especially after finding one here!)
Hello! I have tried looking through other people’s questions but can’t seem to find an answer.
Is it possible to disable types of notifications from appearing in feeds? At the moment, a notification appears in the feed every time someone new joins a group. I am hoping that over the next couple of months a lot of people will join my clients community and start posting in the groups. If there is a notification every time someone joins a group, the conversations can quickly become lost.
Any help would greatly appreciated!
Thanks,
Claire
Hi all..
I have a BIG headache when using BuddyPress and wager many others do too. I have many users join my site every day which I’ve set to manually approve each user(membership). Many membership requests I quickly approve as I see from their answers to my varied signup questions they are genuine. However others require contacting and double-checking.
THE PROBLEM: I end up with pages and pages (and pages) of unapproved users I have already looked at and have to scroll through and often look at 2-3-4 times (having forgotten I already looked their signup/profile).
REQUIREMENT: I desperately way to mark and filter these viewed but unapproved signups and only see ones I have not checked (on this page: mysite.com/wp-admin/users.php?page=bp-signups). This is making it almost IMPOSSIBLE TO MANAGE THE SITE/ SIGNUPS. I’m sure others experience this.
If not possible – any suggestions welcome as to how I can mark as viewed and filter signups on this page: mysite.com/wp-admin/users.php?page=bp-signups
Thanks
Ed.
OK, so everything is setup WP, BuddyPress plus Youzify for styling.
I have Admin approval setup for new Members, but would like to setup additional admin users to manage the approvals and create groups etc. I will then act as the main admin for the website, updates etc. â but for what I think is an obvious security issue, I would like to not grant these user full admin roles.
I’ve searched here and online but cannot find any sensible solutions so would appropriate any help or advise on how this might be possible â perhaps a 3rd party plugin? đ
Gang, I looked for a plug-in and Iâm surprised I couldnât find one.
I want to set a group to visible but by request. When a user requests access I want to ask them questions.
In a perfect world, I would love to map these to custom profile fields Iâve already created.
But these answers would be viewable by the group mod.
Does this capability exist somewhere in the etherworld?
Daniel
Hi, I’m setting up BuddyPress 12.2.0 in WP 6.4.3. By default the BP url structure is at the root, e.g., http://www.mysite.com/members. I would like all BuddyPress pages to be in a subdirectory, e.g., http://www.mysite.com/community/members. I would also like indvidual user profiles to be in the members directory, e.g. http://www.mysite.com/community/members/user1 (not http://www.mysite.com/user1 as it is now). I found some similar questions about this but they were more than 10 years old and I think the old solution may have been deprecated. Should I use a rewrite function? Thanks for any help.
Thank you for bringing up the issue you’re facing with profile image uploads on the forum. I understand the frustration that comes with encountering difficulties after updating to the latest version of BP. It appears that the update might have introduced a bug or compatibility issue. To assist you, I suggest trying the following steps: Firstly, clear your browser cache and cookies to eliminate any potential interference from cached data. Secondly, temporarily disable any plugins or browser add-ons that may interact with the image upload process. This will help identify any conflicts causing the upload problem. Additionally, ensure that your image dimensions are set to 150 x 150 pixels in Photoshop before uploading, as you mentioned this workaround has been successful for you. By following these steps, you should be able to overcome the profile image upload issue. If the problem persists, I recommend reaching out to the forum’s support team for further assistance. Best of luck in resolving this matter, and please don’t hesitate to ask if you have any further questions.
I just finished building wordpress Cirkle buddypress website.
Being brand new, I am wondering how to get people to sign up.
The site is a FAQ about TV Sets -mainly answering questions on mounting and setups.
Do I wait it gains traction with Google Search.
Please help.
How did you get members/people to sign up?
@ingenxcomputers I am seriously stressing because my site is constantly being violated by Russian bots after this latest update and you are splurting out nonsensical questions … Seriously?
The plugin I mentioned is very well documented. I suggest that in the future you do a bit of homework first before jumping in without offering any advice or solutions
If you’re looking to add a background image and personalize the ‘Sign Up’ page further, you can use custom CSS. Here’s a simple example to get you started:
css
Copy code
#signup-form {
background-image: url(‘your-image.jpg’);
background-size: cover;
background-position: center;
background-repeat: no-repeat;
padding: 24px;
}
Replace ‘your-image.jpg’ with the URL of the image you’d like to use. You can customize the padding, background size, position, and other properties to suit your preferences.
To implement this:
Access your platform’s customization or theme settings.
Look for an option to add custom CSS.
Paste the provided code snippet.
Save your changes.
This should apply the background image to the ‘Sign Up’ page as per your specifications. If you have any questions or need further assistance, feel free to reach out.
Hi @priyam1234
Can you test the following code to see if that’s enough for ACF to load its fields UI?
function priyam1234_generate_post_type_ui( $args = array() ) {
$args['show_ui'] = current_user_can( 'manage_options' );
return $args;
}
add_filter( 'register_buddypress_post_type_args', 'priyam1234_generate_post_type_ui' );
About your questions on BP URL functions, you can read this developer documentation resource which includes some examples of use for most of the described functions:
https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md
The Codex mentions here that there is a page in Settings > Email but I don’t see it.
So I have 2 questions : by default, does sending a notice as an admin to all users triggers a mail to be sent?
And if so where do I configure/disable it? With 40000 users I’d like to be able to notify users but not send a load of email spam.
I’m a beginner at WP. I am trying to develop a listing directory with a social network integrated. I’m building the listings directory with the MyListings theme on main domain and want to develop the Social network with BuddyPress (maybe BuddyPress + Youzify) on a subdomain.
My idea is to have a platform where users can publish their listings on Mylistings and have their profile and interact with other members on BuddyPress.
My questions are:
How do I link each author on MyListing website to their BuddyPress profile?
How can I link each profile (BuddyPress) to the author on MyListings theme?
Thank you.
opps ] Let me provide you with an alternative approach that disables the activity form for users, making it more secure. You can achieve this by disabling the form functionality entirely. Here how you can modify the code to accomplish thi
php
Copy code
function disable_activity_form_for_non_admins() {
if ( ! current_user_can( ‘administrator’ ) ) {
remove_action( ‘init’, ‘function_that_creates_activity_form’ );
}
}
add_action( ‘init’, ‘disable_activity_form_for_non_admins’ );
In this code snippet, replace ‘function_that_creates_activity_form’ with the actual function name or hook that creates the activity form. This modification disables the activity form functionality for non-administrative users by removing the action that creates the form during the init hook.
This way the form wont be available in the HTML markup, making it more secure compared to just hiding it with CSS. Remember to place this code in your theme’s functions.php file or in a custom plugin file.
Again make sure to back up your site before making any changes, and test the modified code in a safe environment first to ensure it works as expected. If you encounter any issues or have further questions, feel free to ask!