Search Results for 'display user role on profile page'
-
Search Results
-
Hi folks, I’ve tried searching for this but perhaps I can’t find the correct words to search.
I’m looking to make it possible, in edit profile, to add a profile field that allows the user to select other users of a certain role type or member type, and then they will display at their profile page with an avatar.
So if my users were all shops and products, with role or member type shop, and role or member type product, and I would like to allow shops to perhaps type into a multi-select box to pull up from the user database, the users in the role or member type products, and select them, and they would display on their page.
It’s kind of similar to a ‘relationships’ plugin but a bit more basic I guess. Can anyone point me in the right direction?Kind regards
Hi,
I have been using the below code, So when someone clicks on the profile of an association it will redirect to the products tab.
All is well and I can use the other tabs to navigate around except when I click on the activities tab. It takes me to the products tab users cannot see the associations (role) activity stream.I removed this code and it worked fine so it is some where here. I have this in the child-theme/buddypress-nouveau/members/single/home.php page
WP Version 5.7.2 PHP 7.4.12
$displayed_user = new WP_User( bp_displayed_user_id() ); if ( ( in_array( 'associations', $displayed_user->roles, true )) && (strpos($_SERVER['REQUEST_URI'], "my-products") == false) && (strpos($_SERVER['REQUEST_URI'], "front") == false) && (strpos($_SERVER['REQUEST_URI'], "profile") == false) && (strpos($_SERVER['REQUEST_URI'], "activity") == false) && (strpos($_SERVER['REQUEST_URI'], "friends") == false) && (strpos($_SERVER['REQUEST_URI'], "my-donations") == false) && (strpos($_SERVER['REQUEST_URI'], "notifications") == false) && (strpos($_SERVER['REQUEST_URI'], "messages") == false) && (strpos($_SERVER['REQUEST_URI'], "groups") == false) && (strpos($_SERVER['REQUEST_URI'], "location") == false) && (strpos($_SERVER['REQUEST_URI'], "invite-anyone") == false) && (strpos($_SERVER['REQUEST_URI'], "settings") == false) && (strpos($_SERVER['REQUEST_URI'], "w-my-account") == false) && (strpos($_SERVER['REQUEST_URI'], "store-manager") == false) && (strpos($_SERVER['REQUEST_URI'], "articles") == false) && (strpos($_SERVER['REQUEST_URI'], "media") == false) && (strpos($_SERVER['REQUEST_URI'], "item-header-content") == false) ) { //is assoc and is not already redirected to products or other profile links $currenturl = $_SERVER['REQUEST_URI']; $urlto = $currenturl."my-products"; ?> <script> window.location.replace("<?php echo($urlto); ?>"); </script> <?php } else { // just load ?>
Thank you for helping with this
Project Details :
– WordPress version : 5.5.3
– BuddyPress version : 6.3.0
– Website Link : https://microfarmap.dev-local.com/
– Other plugins I use : Advanced Custom Fields PRO, Advanced Custom Fields: JSON, bbPress, bbPress – Moderation Tools, BuddyForm Premium, BuddyForm Advanced Custom Fields, BuddyForm Hook Fields, BuddoForm Members Premium, BuddyPress Username Changer, Custom Post Type UI, LoginPress, Paid Memberships Pro, Progress Map, List & Filter, User Role Editor …Hello,
I have been updating a WordPress website that was made by others, I might lack some information.BuddyPress works like a charm except for a few features :
– From the user profile, we can send friendship requests. As a new user, I sent a friendship request to my admin account. I did receive the notification on my admin profile, but the Friends tab says there is no friend requests pending. It just doesn’t display theme on my customized Understrap theme.
– Switching to WordPress Twenty Twenty One theme does solve the issues. Switching to Understrap parent theme does switch the issue. There seems to be a problem with my custom theme.
Under this custom there, there is a /buddypress/ directory with template pages and loops. The buddypress/members/single/friends/requests-loop.php file was not modified, it’s the default one. That’s where I checked first.
I also checked in the plugin files directly, under plugins/buddypress/bp-friends/bp-friends-functions.php but did not find a clue.
After some research, I found out that only users that have an active ‘ Paid Memberships Pro ‘ subscription can send friend requests, or atleast their friend requests appear.
I also installed the ” BuddyPress Integration ” plugin from Paid Memberships Pro website, in which there is an option to allow non-registered users to send friend requests, but it did not solve the issue.
Please if you need more details or even an access, do not mind asking.
Hello,
I have buddyforms and Buddypress and the extended profile.
When I want to modify the profile on front-end :
– if I am admin ==> I can modify all fields
– If am the member ==> I have a blank page on modifySo, I would like to know how to display the fields when the member connect please ?
Is this link to user role ? To an another extension ?
Hi, i feel like im doing this properly but i never get the right result. i have a custom meta called “featured” in activity meta. For testing purposes the meta values are 1,2,3,4 my goal is to have an activity loop order activities by the meta value. i’ve checked the documentation and i came up with this.
<?php get_header(); ?> <?php get_template_part('page-parts/general-title-section'); ?> <?php get_template_part('page-parts/general-before-wrap'); $atts = array( 'title' => 'Latest Activity',// title of the section. 'pagination' => 1,// show or not. 'load_more' => 0, 'display_comments' => 'threaded', 'include' => false, // pass an activity_id or string of IDs comma-separated 'exclude' => false, // pass an activity_id or string of IDs comma-separated 'in' => false, // comma-separated list or array of activity IDs among which to search 'sort' => 'DESC', // sort DESC or ASC 'page' => 1, // which page to load 'per_page' => 5, // how many per page. 'max' => false, // max number to return. 'count_total' => true, // Scope - pre-built activity filters for a user (friends/groups/favorites/mentions). 'scope' => false, // Filtering 'user_id' => false, // user_id to filter on 'object' => false, // object to filter on e.g. groups, profile, status, friends 'action' => false, // action to filter on e.g. activity_update, new_forum_post, profile_updated 'primary_id' => false, // object ID to filter on e.g. a group_id or forum_id or blog_id etc. 'secondary_id' => false, // secondary object ID to filter on e.g. a post_id. // Searching 'search_terms' => false, // specify terms to search on. 'use_compat' => bp_use_theme_compat_with_current_theme(), 'allow_posting' => false, // experimental, some of the themes may not support it. 'container_class' => 'activity',// default container, 'hide_on_activity' => 1,// hide on user and group activity pages. 'for' => '', // 'logged','displayed','author'. 'role' => '', // use one or more role here(e.g administrator,editor etc). 'for_group' => '',// group slug. ); $atts['meta_query']= array( array( 'key' => 'featured', 'value' => '0', 'type' => 'numeric', 'compare' => '!=', ), 'meta_type' => 'numeric', 'orderby' => 'meta_value_num', 'meta_key' => 'featured', 'order' => 'DESC' ); ?> <div id="buddypress"> <?php do_action( 'bp_before_activity_loop' ); if ( bp_has_activities( $atts ) ) : ?> <div class="<?php echo esc_attr( $atts['container_class'] ); ?> <?php if ( ! $atts['display_comments'] ) : ?> hide-activity-comments<?php endif; ?>"> <ul id="activity-stream" class="activity-list item-list"> <?php while ( bp_activities() ) : bp_the_activity(); ?> <?php bp_get_template_part( 'buddypress/activity/entry' ); ?> <?php endwhile; ?> <?php if ( $atts['load_more'] && bp_activity_has_more_items() ) : ?> <li class="load-more"> <a href="<?php bp_activity_load_more_link() ?>"><?php _e( 'Load More', 'buddypress' ); ?></a> </li> <?php endif; ?> </ul> <?php if ( $atts['pagination'] && ! $atts['load_more'] ) : ?> <div class="pagination"> <div class="pag-count"><?php bp_activity_pagination_count(); ?></div> <div class="pagination-links"><?php bp_activity_pagination_links(); ?></div> </div> <?php endif; ?> </div> <?php else : ?> <div id="message" class="info"> <p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ); ?></p> </div> <?php endif; ?> ?> </div> <?php do_action( 'bp_after_activity_loop' ); ?> <?php get_template_part('page-parts/general-after-wrap'); ?> <?php get_footer(); ?>
everything here works except for the order. for some reason it always orders by activity ID. am i missing something here? Thanks in advance im going crazy with this.
Hi guys 🙂
My users have many custom fields in their profile.
I’m trying to create a member page, with different loops, because I need to split them in different groups with different criteria.I’m using the my_custom_ids function, but I’m getting crazy…
<?php if ( bp_has_members( my_custom_ids( 'Nome', 'testB' ) ) ) : ?>
is working. The loop displays only one user, named “testB”<?php if ( bp_has_members( my_custom_ids( 'Nickname', 'web9' ) ) ) : ?>
is working. The loop displays only one user, with the nickname “web9”<?php if ( bp_has_members( my_custom_ids( ‘Role’, ‘iscritto’ ) ) ) : ?>
is NOT working. Also Administrators are displayed.
This is not the only problem. It happens also with other fields, but I can’t understand why…Topic: Rol in cover page of profile
Hi!
I saw this code for add the role in the profile of the User.
I want show it in the cover page of his profile, can you help me?
Thanks very much!add_action( 'bp_before_member_header_meta', 'devb_show_role_on_profile' ); function devb_show_role_on_profile() { global $wp_roles; $user_id = bp_displayed_user_id(); $user = get_userdata($user_id); $roles = $user->roles; if ( !$roles ) return; if ( !isset( $wp_roles ) ) $wp_roles = new WP_Roles(); $named_roles = array(); foreach ( $roles as $role ) { $named_roles [] = $wp_roles->role_names[$role]; } if ( $named_roles ) echo '<span class="user-role activity">' . join(', ', $named_roles) . '</span>'; }
hi, i am searching everywhere but i cannot find a way to hide a subnav element (‘Bookings’,’Calendar’) on a profile page when the displayed user does NOT have a certain role (Author).
Hi!
I’m having some hard time with the following:
I want to place my profile avatar (item-header-avatar) from the header to the left from my item-nav and eventually delete the header section.
I’m editing the member-header.php file through my child-theme ( using Kleo-theme ). I thought it would be as easy as copying the div from item-header-avatar and pasting it after <ul class=”responsive-tabs”> but after loading the webpage it does not work.
So my code looks like this:
<?php/**
* Fires after the display of a member's header.
*
* @since 1.2.0
*/
do_action( 'bp_after_member_header' ); ?><?php if ( sq_option( 'bp_nav_overlay', 0 ) == 1 ) : ?>
<div id="item-nav">
<div class="item-list-tabs no-ajax" id="object-nav" aria-label="<?php esc_attr_e( 'Member primary navigation', 'buddypress' ); ?>" role="navigation">
<ul class="responsive-tabs">
<div id="item-header-avatar" class="rounded">
"><?php bp_displayed_user_avatar( 'type=full' ); ?>
<?php do_action('bp_member_online_status', bp_displayed_user_id()); ?>
</div><!-- #item-header-avatar --><?php bp_get_displayed_user_nav(); ?>
<?php
/**
* Fires after the display of member options navigation.
*
* @since 1.2.4
*/
do_action( 'bp_member_options_nav' ); ?></div>
</div>
<!-- #item-nav -->
<?php endif; ?>
Thankyou!!
I am using Buddypress and the BuddyBoss theme. I have 2 user types contributors and subscribers I made using BP Member Types and user profile fields. Everything is working except.
When a contributor is logged in and goes to a tab say members/username/messages the subnav tabs show perfectly little grey boxes next to each other.
But…
when a subscriber goes to a tab say members/username/messages the css for the subnav tabs does not show as if it’s not pulling the css. I check and the file that controls this css section is buddyboss/css/buddypress-main.min.css and I checked this file is being used in the source code of this page. So for some reason the subscriber account is not pulling this style sheet even though it’s shown as included in the source. I tried to hard code the entire css into my page and it still didn’t show.
the other thing I noticed was the code for the nav section was setup like this for contributor
<div id=”buddypress”>
<div id=”item-header” role=”complementary”>
<div id=”item-nav”>
<div id=”item-body”>but the subscriber one only shows like this
<div id=”buddypress”>
<div id=”item-nav”>
<div id=”item-body”>why would the section <div id=”item-header” role=”complementary”> not be showing for subscribers? Could this be my problem
Anyone have any ideas?
2)I wanted to ask if there was a function code that could print a word such as Website associate to display beside, users profile photo in the profile page when given a certain role.
3) Finally wanted to ask if it was possible to have a function where a green light dot is placed at side of a user profile page when the user is logged in, an example is
https://postimg.org/image/ym0tuaoy3/
as presently its grey there because the user is offline.Thanks you
Topic: Role on Profile Page
On some forums and social networks, you will see a badge or for example Admin next to the username of the member of the network that is an admin, or MOD next to their name if they are a moderator.
Do you know how we can display roles in WordPress next to usernames, use a badge or image, or know of a plugin that can accomplish custom roles or tags for staff members within buddy press?
(Latest version of WP/BP; non-bundled custom theme, using child theme.)
When adding a custom index & members-loop to /members/ in my child-theme, to make some adjustments to the members directory layout, individual profile pages break completely, I think defaulting to the pages.php but loaded without any content.
childtheme/members/members-loop.php
<?php //global $members_template; //$reset_members_template = $members_template; do_action( 'bp_before_members_loop' ); ?> <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) . '&per_page=21&type=alphabetical' ) ) : ?> <div id="pag-top" class="pagination"> <div class="pag-count" id="member-dir-count-top"><?php bp_members_pagination_count(); ?></div> <div class="pagination-links" id="member-dir-pag-top"><?php bp_members_pagination_links(); ?></div> </div> <?php do_action( 'bp_before_directory_members_list' ); ?> <ul id="members-list" class="item-list" role="main"> <?php while ( bp_members() ) : bp_the_member(); ?> <li> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar('type=full&width=80&height=80'); ?></a> </div> <div class="item"> <div class="item-title"><a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a></div> <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div> <?php do_action( 'bp_directory_members_item' ); ?> </div> <div class="action"> <?php do_action( 'bp_directory_members_actions' ); ?> </div> <div class="clear"></div> </li> <?php endwhile; ?> </ul> <?php do_action( 'bp_after_directory_members_list' ); ?> <?php bp_member_hidden_fields(); ?> <div id="pag-bottom" class="pagination"> <div class="pag-count" id="member-dir-count-bottom"><?php bp_members_pagination_count(); ?></div> <div class="pagination-links" id="member-dir-pag-bottom"><?php bp_members_pagination_links(); ?></div> </div> <?php else: ?> <div id="message" class="info"><p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p></div> <?php endif; //$members_template = $reset_members_template; ?> <?php do_action( 'bp_after_members_loop' ); ?>
childtheme/members/index.php
<?php /** * BuddyPress - Members Directory * * @package BuddyPress * @subpackage bp-default - SSSMG */ get_header( 'buddypress' ); ?> <?php do_action( 'bp_before_directory_members_page' ); ?> <div class="container"> <div class="row"> <div id="primary" class="col-md-10"> <div id="content" role="main" class="<?php do_action( 'content_class' ); ?>"> <div class="padder"> <div class="buddypress"> <?php do_action( 'bp_before_directory_members' ); ?> <form action="" method="post" id="members-directory-form" class="dir-form"> <?php do_action( 'bp_before_directory_members_content' ); ?> <div id="members-dir-search" class="dir-search" role="search"> <?php bp_directory_members_search_form(); ?> </div><!-- #members-dir-search --> <?php do_action( 'bp_before_directory_members_tabs' ); ?> <div class="item-list-tabs" role="navigation"> <ul> <li class="selected" id="members-all"><a href="<?php bp_members_directory_permalink(); ?>"><?php printf( __( 'All Members %s', 'buddypress' ), '<span>' . bp_core_get_total_member_count() . '</span>' ); ?></a></li> <?php if ( is_user_logged_in() && bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?> <li id="members-personal"><a href="<?php echo bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends/'; ?>"><?php printf( __( 'My Friends %s', 'buddypress' ), '<span>' . bp_get_total_friend_count( bp_loggedin_user_id() ) . '</span>' ); ?></a></li> <?php endif; ?> <?php do_action( 'bp_members_directory_member_types' ); ?> </ul> </div><!-- .item-list-tabs --> <div id="members-dir-list" class="members dir-list"> <?php //bp_get_template_part( 'members/members-loop' ); locate_template( array( 'members/members-loop.php' ), true ); ?> </div><!-- #members-dir-list --> <?php do_action( 'bp_directory_members_content' ); ?> <?php wp_nonce_field( 'directory_members', '_wpnonce-member-filter' ); ?> <?php do_action( 'bp_after_directory_members_content' ); ?> </form><!-- #members-directory-form --> <?php do_action( 'bp_after_directory_members' ); ?> </div><!-- #buddypress --> </div><!-- .padder --> </div><!-- #content --> </div><!-- primary --> <?php get_sidebar( 'buddypress' ); ?> </div><!-- row --> </div><!-- container --> <?php do_action( 'bp_after_directory_members_page' ); ?> <?php get_footer( 'buddypress' ); ?>
bp-custom.php
<?php // bp-custom.php - BP hacks and mods will go here /** * Include bbPress 'topic' custom post type in WordPress' search results */ function ntwb_bbp_topic_cpt_search( $topic_search ) { $topic_search['exclude_from_search'] = false; return $topic_search; } add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' ); /** * Include bbPress 'forum' custom post type in WordPress' search results */ function ntwb_bbp_forum_cpt_search( $forum_search ) { $forum_search['exclude_from_search'] = false; return $forum_search; } add_filter( 'bbp_register_forum_post_type', 'ntwb_bbp_forum_cpt_search' ); /** * Include bbPress 'reply' custom post type in WordPress' search results */ function ntwb_bbp_reply_cpt_search( $reply_search ) { $reply_search['exclude_from_search'] = false; return $reply_search; } add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' ); /** * Ensure that multiselect boxes have trailing brackets in their 'id' and 'name' attributes. * * These brackets are required for an array of values to be sent in the POST * request. Previously, bp_get_the_profile_field_input_name() contained the * necessary logic, but since BP 2.0 that logic has been moved into * BP_XProfile_Field_Type_Multiselectbox. Since bp-default does not use the * BP_XProfile_Field_Type classes to build its markup, it did not inherit * the brackets from their new location. Thus this workaround. */ function bp_dtheme_add_brackets_to_multiselectbox_attributes( $name ) { global $field; if ( 'multiselectbox' === $field->type ) { $name .= '[]'; } return $name; } add_filter( 'bp_get_the_profile_field_input_name', 'bp_dtheme_add_brackets_to_multiselectbox_attributes' ); // add the custom column headers to BP manage signups function philopress_modify_user_columns($column_headers) { $column_headers['extended'] = 'Extended'; return $column_headers; } add_action('manage_users_page_bp-signups_columns','philopress_modify_user_columns'); // dump all the pending user's meta data in the custom column function philopress_signup_custom_column( $str, $column_name, $signup_object ) { if ( $column_name == 'extended' ) return print_r( $signup_object->meta, true ); return $str; } add_filter( 'bp_members_signup_custom_column', 'philopress_signup_custom_column', 1, 3 ); //* Redirect WordPress Logout to Home Page add_action('wp_logout',create_function('','wp_redirect(home_url());exit();')); //add @mentions to bbpress forum function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) { if ( function_exists( 'bbpress' ) && is_bbpress() ) { $retval = true; } return $retval; } add_filter( 'bp_activity_maybe_load_mentions_scripts', 'custom_bbpress_maybe_load_mentions_scripts' ); function bphelp_dpioml(){ $bphelp_my_profile_field_1='Profession'; $bphelp_my_profile_field_2='Primary Institution'; if( is_user_logged_in() && bp_is_members_component() ) { ?> <div class="bph_xprofile_fields"> <?php if(bphelp_my_profile_field_1<>"") echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_1 ); ?><br /> <?php if(bphelp_my_profile_field_2<>"") echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_2 ); ?><br /> </div><?php } } add_action('bp_directory_members_item', 'bphelp_dpioml'); ?>
I’ve tried all sorts of different combinations but whatever I do, the only way to get both the profile pages and the members directory to display is to remove the index and members-loop customizations. Then everything works fine, but without the adjustments to the members directory that I want (removing recent updates, for instance). Any pointers would be brilliant!
Hello,
I´m searched endless hours and didn´t found anything to solve my problem. Hope a lot that you can help me.
I want to give the admins of every group the possibility to enter a value related to a specific user in his group.
Background is that I want to create a gaming clan network and I want to organize the clans as groups. So the admin should be able to set a custom “role” (not with any permissions or anything like that, only a value related to the specific user) for each user.I checked dozens of plugins to find one where a group admin is able to set something for a group member to customize it because I´m not much into php. But I couldn´t find anything useful.
Next idea was to hook into the “Promote to”-function, so I can use the already existing structure and adding “only” some custom statuses without any further permissions. But I can´t get it to work, if I´m changing anything related to this in my functions.php, or even direct in the BuddyPress/src/bp-groups/bp-groups-functions.php, the website is broken. :´-(
The perfect solution would be a possibility for every group admin to enter a custom value related to a specific user of his group in the members area in group management.
In example
User Set rank
Testuser [textfield]
Testuser 2 [textfield]But also every other working solution would be also perfect.
I want to display the rank then under the username in the group members page and on the members profile under groups. That shouldn´t be a problem. I have only no idea how to give the admin of a group the possibility to save a value related to an user of his group. The value must be saved in the group because the user should be able to choose more than one group, so it doesn´t make much sense to save it in the user database I think.
Any idea how I can get this to work? I was really surprised and dissapointed that I couldn´t find anything like this.
Thanks a ton already.