Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'display users posts'

Viewing 25 results - 76 through 100 (of 287 total)
  • Author
    Search Results
  • RLaine
    Participant

    I want to be able to attach documents to posts and pages in the wp/buddypress admin and control the display on the front end.
    I would also like to be able to make those documents searchable, also with privacy/ public setting options for groups and users applied.
    It also should pass accessibility standards compliance.
    I have tested buddydrive, buddypress docs and rtmedia.
    I need something lite and easy to use.

    Can anyone recommend the correct lite accessible ( standards compliant) plugins to start with as a base. I can’t see anything that does all I need so I do need to pass to a developer but any guidance on the best plugin and/or pitfalls much appreciated.

    #230656
    colabsadmin
    Participant

    Sorry I thought I was clear. I dont need an example of how to create the tab and the submenus.

    What I did was write a class that creates a top level member area tab called Favorites that consolidates all types of favorites within a single tab. https://github.com/colabsadmin/bp-favorites/blob/master/bp-favorites.php

    The submenus that have been created so far are Activity, Topics, Posts and a few more for some CPTs that I’ve written. This will make it easier for my users to find their favorites when they cant remember if it came from a topic, posts, activity, etc. Instead of jumping around from tab to tab, its all in one tab. The only submenu that doesnt work is Activity. The code, which I provided in my first question, was copied directly from Buddypress core code with one change to use ‘bp_core_new_subnav_item’. I used similar code to display content in all the other submenus. For example, the following shows the favorite topics

    // Favorite topics
    bp_core_new_subnav_item( array(
    		'name'            => __( 'Topics', 'kleo' ),
    		'slug'            => "topics",
    		'parent_url'      => $bp->displayed_user->domain . $bp->bp_nav['favorites']['slug'] . '/',
    		'parent_slug'     => $bp->bp_nav['favorites']['slug'],
    		'screen_function' => 'bbp_member_forums_screen_favorites',
    		'position'        => 10,
    		'item_css_id'     => 'favorites'
    ));
    

    So, my question, does bp_activity_screen_favorites() only work within the context of /members/membername/activity action? Or can it be used elsewhere as in /members/membersname/favorites?

    Alphaaffe
    Participant

    Hi there,

    I’m using the following Code to show users unread messages and pending friend requests in the sidebar:
    Friendship Requests
    Freundschaftsanfragen: <?php echo bp_friend_total_requests_count() ?>
    Unread Messages
    Nachrichten: <?php bp_total_unread_messages_count() ?>
    (I’m using “Enhanced Text Widget” to show php-code in my sidebar-widget)

    Additionally, I want to create some kind of notification that displays users if they have new messages or requests and thtat is only shown IF there are any new messages or requests!

    I imagine it should look something like:
    if (unread messages > 0)
    echo “You have unread Messages”;
    else
    echo ” “;

    if (pending friendship requests > 0)
    echo “You have new friendship requests”;
    else
    echo ” “;

    my problem is, that I don’t know the names of the variables to use (I tried it with the functions instead of the variables which didn’t work). Can anyone of your pls help? I’m using the “allow PHP in posts and pages” plugin to use php in posts and pages^^

    My WordPress-Version is 4.0.1, my Buddypress-Version is 2.1.1

    My website is still under construction and has directory protection, which is why I won’t post the domain, username or password. If your realy need this information, I’ll send it to your via pm.

    P.S. English is not my native language, I apologize for any typos or other kind of misstake.

    MVHartley
    Participant

    Hello folks,

    I’ve been researching translation plugins for my buddypress site (WordPress 4.0 Buddypress 2.1.1 – clean install as of yet, running twenty thirteen theme right now, just starting out on the theme development for my site, I want to pin the language issue down before doing anything)

    I want to be able to provide my visitors the option of displaying my buddypress in different languages however I do NOT want to translate any of the blogs/posts/comments/forums/any user generated content I just want to translate text on the BP pages, text in the menus, alerts etc

    The only slightly complicated bit to it is I have a few custom defined profile fields that I would like to translate

    To illustrate, take this example

    my (hypothetical) member page would read:

    Name : Matt <—User entered text, not translated
    languages: English, Swedish <—selected from drop down list/check boxes
    Country : England <—selected from drop down list/check boxes
    Nationality : English <—selected from drop down list/check boxes

    MY activity feed/entry would read

    “Hello everyone, my name is Matt”

    ****Now let’s say a French visitor visits my profile, they would read

    Nom: Matt
    Langue: Anglais, Suédois
    Pay : Angleterre
    nationalité : Anglais

    “Hello everyone, My name is matt”

    **I do NOT want my comment to read**

    “Salut tout le monde, je suis matt”

    So in short, I want to be able to provide translations of everything on the website that I have coded in there (menus, alerts, instructions, registration emails, info pages etc) but leave alone anything that a user has typed

    I would really appreciate being pointed in the correct direction for this – almost all of the plugins I’ve come across so far are focused on providing translations for everything, blog posts included

    Cheers!

    Matt

    #214456
    gaarenstroom
    Participant

    Hello,

    Im using bbpress and buddypress on my website.
    Now in bbpress you see the authors role under his username when he posts.
    I know how to remove the role but i want it to display the users group names.

    Can anyone help me with this? I cant find anything about this.

    #214084
    MuseMusic
    Participant

    Hello All,

    I’m looking to create a BuddyPress site that allows users to share youtube videos. My wish list of the features I would like to create are as follows:

    • Custom post type for adding a video (video post type).
    • Create a page containing a loop filtered for displaying each video post.
    • Create an entry in the activity stream alerting that a new video has been posted.
    • Create a notification that alerts users if their friends adds a video.

    I am pretty clear on how to create a custom post type and then create a filtered loop to display the custom posts. I’m not so sure about adding an entry to the activity stream and creating an alert for the users’ friends. Would anyone be able to give me some advice on how to achieve this?

    Cheers!

    DogGuyJosh
    Participant

    Hello Community,

    I’ve been browsing various directory plugins and BuddyPress options, but I am having difficulty determining the best course of action in building my site. I would greatly appreciate any feedback and advice you could lend me in this matter.

    I would like to create a directory site in which there are two types of registered users (neither is charged to sign up).

    The first user only has the ability to register strictly for privately messaging the second user type through BuddyPress.

    The second user type has the ability to register by submitting a listing for their profile to appear in a searchable directory. I would like this user type’s registration to have custom form fields (BuddyPress extended profiles?). Geolocation is optional I suppose, provided that a custom field could substitute this if it is still a searchable option in the directory.

    I intend on using X theme with the Ethos stack. I’m also looking for a way to display recently added directory profiles as featured posts (so they appear in the stack above navigation).
    Please share your thoughts and suggestions!

    #191032
    ThatHostingCo
    Participant

    First off:
    1. Which version of WordPress are you running?
    a. Wordpress 4.0

    2. Did you install WordPress as a directory or subdomain install?
    a. Main directory

    3. If a directory install, is it in root or in a subdirectory?
    a. n/a

    4. Did you upgrade from a previous version of WordPress? If so, from which version?
    a. Yes, 3.8

    5. Was WordPress functioning properly before installing/upgrading BuddyPress (BP)? e.g. permalinks, creating a new post, commenting.
    a. No. Alphabetical pagination was only showing 20 members previously

    6. Which version of BP are you running?
    a. Version 2.0.2

    7. Did you upgraded from a previous version of BP? If so, from which version?
    a. No

    8. Do you have any plugins other than BuddyPress installed and activated? If so, which ones?
    a. Add New Default Avatar 1.3.1
    b. Backup 2.2
    c. BuddyPress 2.0.2
    d. BuddyPress Pending Activations 1.0.2
    e. BuddyPress Real Names 0.3.5
    f. Contact Form 7 3.9.3
    g. Custom Facebook Feed 2.1.1
    h. Email Address Encoder 1.0.4
    i. Google Analytics Dashboard for WP 4.3.3
    j. JotForm Feedback Button 1.0
    k. Newsletter 3.6.3
    l. Photo Gallery 1.1.30
    m. PHP Code for posts 1.2.0
    n. SYN Media WooCommerce USPS 2.1.0
    o. The Events Calendar 3.7
    p. The Events Calendar: WooCommerce Tickets 3.7
    q. The Events Calendar PRO 3.7
    r. WooCommerce 2.1.12
    s. WooCommerce Advanced Notifications 1.1.9
    t. WooCommerce Advanced Product Quantities 2.1.6
    u. WooCommerce Subscriptions 1.5.9
    v. WooCommerce Thumbnail Input Quantities 1.1.2
    w. WooThemes Helper 1.3.0
    x. WP-Members 2.9.6
    y. WPFront User Role Editor 1.2

    9. Are you using the standard BuddyPress themes or customized themes?
    a. Custom theme

    10. Have you modified the core files in any way?
    a. No, only member-loop

    11. Do you have any custom functions in bp-custom.php?
    a. No

    12. If running bbPress, which version? Or did your BuddyPress install come with a copy of bbPress built-in?
    a. N/A

    13. Please provide a list of any errors in your server’s log files.
    a. WordPress database error Unknown column ‘bprn_293’ in ‘having clause’ for query SELECT COUNT(u.ID) FROM vae_bp_xprofile_data u GROUP BY u.user_id HAVING bprn_293 IS NOT NULL AND bprn_1 IS NOT NULL made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/headway/index.php’), HeadwayDisplay::layout, HeadwayDisplay::grid, HeadwayLayoutRenderer->display, HeadwayGridRenderer->render_grid, HeadwayBlocks::display_block, do_action(‘headway_block_content_content’), call_user_func_array, HeadwayContentBlock->content, HeadwayContentBlockDisplay->display, HeadwayContentBlockDisplay->loop, HeadwayContentBlockDisplay->display_entry, HeadwayContentBlockDisplay->display_entry_content, the_content, apply_filters(‘the_content’), call_user_func_array, bp_replace_the_content, apply_filters(‘bp_replace_the_content’), call_user_func_array, BP_Members_Theme_Compat->directory_content, bp_buffer_template_part, bp_get_template_part, bp_locate_template, load_template, require(‘/themes/iherb/buddypress/members/index.php’), bp_get_template_part, bp_locate_template, load_template, require(‘/themes/iherb/buddypress/members/members-loop.php’), bp_has_members, BP_Core_Members_Template->__construct, bp_core_get_users, BP_User_Query->__construct, BP_User_Query->do_user_ids_query

    14. Which company provides your hosting?
    a. Our own – That Hosting Company (http://thathost.co)

    15. Is your server running Windows, or if Linux; Apache, nginx or something else?
    CentOS 5.8 (64 bits version) – Interworx Front End 5.0.14-580
    ———————

    The problem:
    We are using a custom members-loop. The pagination on the alphabetical list is limiting the members to the first 20 and not offering additional pages

    Troubleshooting:
    – We attempted to adjust the ajax search query, but it did not seem to make a difference.
    – We removed the custom buddypress member-loop and used the default. We found the same issue occurred.

    Notes:
    – We have 143 members
    – We are using a custom theme builder “Headway”
    – Pagination issue does not seem to be effecting “Latest”, “Random” or “Newest Registered” Options.
    – Site is live at http://www.iherb.org/members/

    #186135

    In reply to: Add Member Type Class

    LucidStrike
    Participant

    Hi.

    The subnav item comes from the app ‘BP Posts on Profile‘. The theme is ‘X‘ by Theme Co.

    Targetting the element with

    #posts-personal-li {
    display: none;
    }

    Removes it, but, of course, it removes it from ALL profiles. I need it on admin profiles only. It links to the author page, and other users can’t author posts anyway.

    Here is my admin profile.

    Ross Wintle
    Participant

    Thanks again Shane. I’ll try to explain again.

    At high level, I want users, in their user profile, to be able to select one or more skills that they have. Skills are posts of a post type.

    At lower level, I want, in a BP user profile, a field which is either a multi-select, or a set of checkboxes. The values selectable should be titles of posts from the “Skills” post type (I’ll actually save the IDs of the posts, but the titles should be displayed).

    The user should be able to select these values both when registering and when editing their profile.

    Possible implementations I can think of would be:
    – Implement a new field TYPE called “skill”, create a field of that type in BuddyPress, and write some hooks that display and save the field.
    – Add some custom code using action hooks to the bottom of the registration and edit profile screens.

    I know it’s kinda hard to explain in a short forum post. There just doesn’t seem to be some simple, documented hooks that a plugin can use to extend the user profiles with new custom fields of new types and I was looking for some guidance/best practice for doing this.

    Thanks again for your help.

    Ross

    foresme
    Participant

    Is there a way to hide member activity from Google? Some of my users are getting freaked out that some of their private posts within our community come up in the Google search listings.

    Google is displaying Activity Streams and Extended Profile information like this: https://www.google.co.nz/?gws_rd=cr&ei=WpTDU7bLKYqWkwWk8oEQ#q=reauthoring+anton+keijzer

    I hope you have a solution! Our members feel their privacy is being breached. It’s a website for a community of therapists to share ideas and information and a lot of the things discussed are sensitive and personal.

    It would be great to keep these excerpts off Google – but HOW?

    #184978
    danbp
    Participant

    hello @optiqal,
    using snippets from 2012 leads to errors in many case. 😉

    Here’s a new version of what you used. I tested it on BP 2.1 and 2013 theme.
    (original code comes from here) As it contained errors i corrected them and adjusted the code to get content everywhere.

    /* we're building the nav button and add it to the profile main menu */
    function mb_bp_profile_menu_posts() {
    	global $bp;
    	bp_core_new_nav_item(
    	array(
    	'name' => 'My Posts',
    	'slug' => 'posts', 
    	'position' => 11, 
    	'default_subnav_slug' => 'published', 
    	'screen_function' => 'mb_author_posts'
    	)
    	);
    }
    add_action('bp_setup_nav', 'mb_bp_profile_menu_posts', 301 );
    
    /* we're building 2 sub item
     * the first is the one showing by default
     */
    
    function mb_bp_profile_submenu_posts() {
    	global $bp;
    	if(!is_user_logged_in()) return '';
    	bp_core_new_subnav_item( array( 
    	'name' => 'Published',
    	'slug' => 'published', 
    	'parent_url' => $bp->loggedin_user->domain . $bp->bp_nav['posts']['slug'] . '/' ,
    	'parent_slug' => $bp->bp_nav['posts']['slug'],
    	'position' => 10,
    	'screen_function' => 'mb_author_posts' //the function is declared below
    	) 
    	); 
    	bp_core_new_subnav_item( array( 
    	'name' => 'Drafts',
    	'slug' => 'drafts', 
    	'parent_url' => $bp->loggedin_user->domain . $bp->bp_nav['posts']['slug'] . '/' ,
    	'parent_slug' => $bp->bp_nav['posts']['slug'],
    	'position' => 20,
    	'screen_function' => 'mb_author_drafts' //the function is declared below
    	) 
    	); 
    }
    add_action('bp_setup_nav', 'mb_bp_profile_submenu_posts', 302 );
    
    /* here we control our 1st sub item
     * first function is the screen_function
     * second function displays the content
    */
    function mb_author_posts(){	
    	add_action( 'bp_template_content', 'mb_show_posts' );
    	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function mb_show_posts() {
    	echo 'Function to Generate the displayed users posts.';
    	// add yout stuff here
    }
    
    /* here we control our 2nd sub item
     * first function is the screen_function
     * second function displays the content
     */
    function mb_author_drafts() {
    	add_action( 'bp_template_content', 'mb_show_drafts' );
    	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function mb_show_drafts() {
    	echo 'Another function to Generate the displayed users drafts.';
    	// add yout stuff here
    }
    piratescott
    Participant

    Ok so I’m attempting to display the users posts on their profiles, it’s all working with the exception of pagination, it just says that the page cannot be found and theres a button to return to the original page.

    The code I have is below.

    if ( !function_exists( 'add_action' ) ) {
    
    	echo '404';
    
    	exit;
    
    }
    
    define('bpShowPosts', '1.0');
    
    define('bpShowPosts_PLUGIN_URL', plugin_dir_url( __FILE__ ));
    
    function my_setup_nav() {
    
          global $bp;
    
     
    
          bp_core_new_nav_item( array( 
    
            'name' => __( 'Posts', 'buddypress' ), 
    
            'slug' => 'my-posts', 
    
            'position' => 75,
    
            'screen_function' => 'my_posts_link',
    
    	    'show_for_displayed_user' => true,
    
    	    'default_subnav_slug' => 'my-posts',
    
    	    'item_css_id' => 'my-posts'
    
          ) );
    
    }
    
     
    
    add_action( 'bp_setup_nav', 'my_setup_nav', 1000 );
    
     
    
    function my_posts_title() {
    
    	echo bp_displayed_user_username() . '\'s posts';
    
    }
    
     
    
    function my_posts_content() {
        $the_users_id = $bp->displayed_user->id;
    	
        //The Query
        query_posts('author=$the_users_id');
    
        //The Loop
        if ( have_posts() ) : while ( have_posts() ) : the_post();
        echo '<div id="bp_user_posts">';
        echo '<ul class="bp_user_post_image">';
        echo '<a href="' . get_permalink() . '">';
        the_post_thumbnail(thumbnail);
        echo '</a>';
        echo '</ul><ul class="bp_user_post_content"><li class="bp_user_post_title">';
        echo '<a href="' . get_permalink() . '"><h3>';
        the_title();
        echo '</h3></a>';
        echo '</li><li class="bp_user_post_excerpt">';
        echo '<a href="' . get_permalink() . '">';
        the_excerpt();
        echo '</a></li></ul></div>';
    
        endwhile; 
    
    echo '<div class="nav-previous alignleft">' . next_posts_link( 'Older posts' ) . '</div>';
    echo '<div class="nav-next alignright">' . previous_posts_link( 'Newer posts' ) . '</div>';
    
    else:
        echo "The user has not contributed anything!";
        endif;
    
    //Reset Query
    wp_reset_query();
    
    }
    
    function my_posts_link () {
    
    	add_action( 'bp_template_title', 'my_posts_title' );
    
    	add_action( 'bp_template_content', 'my_posts_content' );
    
    	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    
    }
    
    ?>

    Any help would be greatly appreciated

    karlajw
    Participant

    This is a well established site … up and running with BuddyPress and bbPress for just over 2 years. Recently (say the past few weeks … I’d guess since applying the latest updates) users are reporting problems with viewing their account/profile pages.

    The behavior is consistent but the pages do vary.

    For example this link
    http://canadianvintageradio.com/members/lee
    should display the member’s profile. Instead it’s redirecting to the forum topic

    For Sale:Lee Deforest signed autobiography

    If I try to access My Account -> Settings -> Profile of my own account I end up at a forum topic attachment with the title profile.gif

    In each case it’s using a word in the original url and finding a forum post with that same word somewhere in the title/url.

    WordPress: 3.9.1
    bbPress: 2.5.4
    BuddyPress: 2.0.1
    Theme: child theme of WooThemes Canvas

    I keep the plugins pretty much up to date but might have skipped a version if they were released close together.

    I’ve tried resaving the Permalinks and running the bbPress repair tools.

    Installed plugins:
    Akismet
    amr users
    BackupBuddy
    bbPress
    bbP Topic Views
    BP-Albun
    BuddyPress
    BuddyPress Pending Activations
    Disable XML-RPC Pingback
    Email Log
    Events Manager
    GD bbPress Attachments
    Lightbox Plus ColorBox
    List category posts
    MailChimp Widget
    NextGEN Gallery
    s2Member Framework
    TinyMCE Advanced
    User Role Editor
    Visitor Maps and Who’s Online
    WangGuard
    WP Password Generator

    judahraine
    Participant

    Hi there, I am in the process of preparing my new site, so it’s not actually up and running yet. I would like to clarify a few things before I discover I possibly can’t do what I would like.

    In essence it’s a community site for authors, readers and publishers, with groups, etc. I also wish to have a listing library (authors can add their books – covers and other required information) and a review site.

    What I would like to do is create a page on the site where users (authors) can have a snippet from their latest blog posts displayed (multiple rss feeds updating automatically with latest content). Most of them have their own blogs, so setting up the site for individual blogs would be a waste of time, so it would have to be the rss feed route. Also, I want this to display on a page (let’s call it Author Blog Roll) and from there update the activity stream.

    Is this possible? Could you recommend a plugin that would make this happen or will I need to approach a developer to create this?

    I would greatly appreciate your input. I have been on Google for hours and am no closer to finding an answer.

    Thank you for your time.
    Jude

    #182328
    djsteveo
    Participant

    @jconti – glad you jumped into this thread!

    The simplest thing would be a basic report this button that could appear next to all content displayed with a buddypress install. As mentioned above sending an email to the superadmin with the referring url would be nice.. added functionality has been discussed up above that would make this even better.

    I’d like to mention here, although it probably deserves it’s own thread, it would be a good idea to give users and option to ‘block user’ or auto-ignore / bozo other users.. this way people who may not get their account deleted for not violating rules after a report – could be blocked from having their pms show up, or activity show to the other user who wanted to block them.

    Combining the “report this” with an option to further “block all content (pms, activity stream messages, group posts, etc) – from appearing while user A is logged in.. that would make buddypress much more professional and user friendly.

    dominiclane
    Participant

    Hi there

    Using buddypress a lot recently and loving it!

    Quick question, I’m trying to pull the user id on the profile page and not the logged in user id

    I’m making an upload form on the profile page where logged in users can upload images and post urls ti vimeo etc, have made a form mapped to a custom post type etc

    Would like to create some code to pull posts of that custom type related to that user, on their profile page. So when viewing profile pages, when logged in or out, it dynamically pulls the posts of that type for the user related to the profile page being viewed and displays accordingly

    Any help greatly appreciated!

    Kind thanks

    Dominic

    kriskbarker
    Participant

    I manage a company website which includes 2 WordPress blogs – although I did not create them nor do I manage that part of the site. (They are managed by our marketing person who only deals with approving posts and generating content, nothing structural.)

    Last week we noticed that one of the blogs came up with a blank page; the last known activity was on about March 10th. WP admin showed it could not find any themes. For some reason, the /wp_content/themes folder was empty – I have no idea how that occurred as this is a managed, secure company site.

    Our hosting company has restored the entire folder structure from a backup made on 3/9/2014. I’ve also run a couple of queries on the database which APPEARS (from what little I know) to be intact. After restoring the folder structure, the blog home page is at least visible (header artwork) but nothing much else is shown other than an error:

    Fatal error: Class ‘BP_Core_User’ not found in E:\INetPub\wwwroot\expressmetrix\software-audit-forum\wp-content\themes\emforums\sidebar.php on line 47

    (which also shows up in the log when I enable debug) … and a “tag-like” looking thing “[bbp-forum-index]” which, I assume, should have been substituted with something.

    I did some simple file searching – the wp-content\plugins\buddypress\bp-core folder is there and includes bp-core-classes.php which contains the class definition. As this error is in sidebar.php, presumably an included file in the overall theme, it’s unclear if this alone might be the primary reason the entire site is displaying incorrectly. Given that none of the underlying structure has changed in months (only users and posts added), I’m concerned that somehow someone has figured out a way to damage the site thru a registration or post although I don’t know how something like that would cause a source-code level like problem.

    Any suggestions of where/how to look are greatly appreciated.

    #177712
    webauthor
    Participant

    I’ve been reading a lot about this issue and it looks like BP is missing some very basic functionality. This is the first time using it and right out of the gate I see that there are some things that have me baffled.

    1) No way to create conditional fields. I’ve tried using the Gravity Forms User Registration Add-On plugin but there is no way to map fields properly. For example, in Gravity Forms I have Country, State and City fields. If someone selects United States as a Country for example, the next field that the user sees is the State field, but then I run into a problem when someone selects a City. In order to use conditional fields with Gravity Forms, I need to create many City fields (alabama-cities, alaska-cities etc). One City field for each State. These City fields are conditional fields that displayed to the user Cities based on what the user selects in the State field.

    The problem is that Gravity Forms wants me to first create User Profile Fields in BuddyPress. Then map each Gravity Forms field to the appropriate User Profile Field. Since I have many Gravity Forms cities field, there is no way I can tell Gravity Forms to use the City that the user selects and map it to a City User Profile field in BuddyPress.

    I’ve read a lot of posts on this forum dating back 5 years and no one has offered a working solution.

    2) Also, Why is there no option for an admin to be able to deny users from changing their Screenname? How about an option that prevents user from modifying a specific field such as Gender? All I see is havoc and chaos if you allow users to change certain fields.

    3) Why doesn’t BuddyPress offer a way to have different registration fields based on the user? Teacher / Student Registration, Doctor / Patient etc? It doesn’t make sense. Look at the core of BuddyPress. It’s a social network plugin. In almost every circumstance you have a need for one user have certain fields and another to have other fields. Trying to figure out how to show certain profile fields for one user and not another should be at the core of this plugin. Not to mention making it easy for the site owner to layout those fields so that they look nice. For example something as easy as defining the length of the fields. You can’t make those modifications without Firebug and CSS and PHP experience, or worse yet another plugin. If you use a plugin, then you have to pray to God the author of that plugin not to fall off a cliff or pray that he / she keeps that plugin conducive with the latest version of BP.

    I don’t mean to gripe but BuddyPress it seems to me that at it’s core, very little thought was given to how people would actually use it. Almost like it’s piecemealed together.

    Another big complaint is that it’s not compatible with the best WordPress themes on the planet – StudioPress. Shouldn’t the contributors of BP make sure that BP and StudioPress be compatible?

    I’m sorry if this sounds like a rant, it’s not. It’s just frustration. BP looks awesome but underneath the hood, there are a lot of obvious problems. My suggestion is to do what WooCommerce, StudioPress and others do. Sit down and figure out how to handle the big issues first. If need be, charge for BuddyPress. If the problem is that you have a bunch of contributors who work on things “they” deem important and at their own leisure, then the plugin suffers. Charge for it. Sit down and listen to the complaints and address them based on customer priority. Pay someone to reply to this forum so we’re not waiting days for a response. You’ll have much happier users and a much better plugin. Just my 2 cents worth. Honestly, since BP is virtually the only Plugin of it’s kind, not taking my advice will lead to someone creating a better wheel and that point, it’s only a matter of time before BP becomes obsolete.

    It’s been close to 24 hours and no response to my original question. If ANYONE has an answer as to how I can get a user to simply select a Country, then State, then City based on previous fields, I’d greatly appreciate it. Also if someone could please tell me how to prevent users from modifying certain fields that would be appreciated as well.

    Thanks

    #177482
    Justin
    Participant

    I couldn’t get any of those hooks to work. I ended up editing the members.php file in the profile progression plugin and that worked. Obviously not ideal for updating plugins but it’s working!

    I also was then able to hide the progression bar from users who didn’t own that profile and hide it altogether once it was complete. Those features weren’t part of the original plugin.

    Here’s the code if anybody wants it:

    if (bp_is_my_profile()) {
    
    
        $percent = bppp_get_user_progression_percent();
    
        if ($percent == 100 && !current_user_can('edit_posts')) {
                    my_update_profile_mark();
        }
    
        if ($percent == 100) {
           echo '<div class="bppp-stat-no-display">';
    
        } else {
            echo '<div class="bppp-stat">';
        }
    
    
                echo '<span class="bppp-stat-title">';
                bppp_title();
                echo '</span> ';
                
                echo '<div class="bppp-stat-block">';
                        echo '<div class="bppp-bar">';
                echo '<div class="bppp-bar-mask" style="width:';
                echo (int)(100-bppp_get_user_progression_percent());
                echo '%"></div>';
                echo '</div>';
                        
                echo '</div>';
                echo '<span class="bppp-stat-percent">';
                echo bppp_get_user_progression_percent();
                echo '%</span>';
                echo '</div>';
    
    }
    

    Here’s the function that’s referenced that I added to functions.php:

    function my_update_profile_mark() {
    
       $user_ID = get_current_user_id();
       $power_level = 9001;
       update_user_meta( $user_ID, '_power_level', $power_level);
       
    }

    Oh and of course this got added to style.css:

    .bppp-stat-no-display {
        display: none;
    }
    

    Now I just need to build a custom menu in the backend that queries users based on their role level and the custom user meta key that’s updated here. Hopefully it’s a smoother process!

    Thanks all for your help!

    #177181
    SK
    Participant

    Better customisation options of the activity stream: ie to be able to define a set of “or” filters for content type, and who. So (with plugin support) I can define a feed to include things from “me or friends or followers” showing “topics and topic replies and posts and new users” (and ideally be able to have a permalink to this with no other fluff on display). The current activity feed selectors are a mess and don’t provide what most people want to see.

    There are about 50-75 Premium BuddyPress themes online for sale and 99% of them have the same activity stream page-layout. While all those premium theme developers can do lots of customization to all other pages the activity stream is like Twitter’s Bootstrap to BuddyPress it always tells you it’s a BuddyPress website without looking at the code.

    The reason all those themes activity look alike is because previously it was a nightmare to create something that wasn’t derivative of bp-default and it’s heavy-handed javascript. This is not the case anymore.

    In other words, this issue has already been fixed. Now it is upto the theme developers to customize the feed aesthetics to their hearts’ content.

    #177164
    shallowjeff
    Participant

    Hi,
    I need help. I’ve managed to get rid of the auto linking default function within the profile section of my members page, but am unable to place anything that has java and/or button qualities. I have a place for “profile widgets” but instead of the actual widget, I get an H-ref ugly link. http://www.poetsatwork.com

    For example:
    I paste this,

    <SCRIPT charset=”utf-8″ type=”text/javascript” src=”http://ws-na.amazon-adsystem.com/widgets/q?rt=tf_cw&ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Flovecourses-20%2F8010%2F5a411cc7-5346-4d91-86c2-9808086e235e&Operation=GetScriptTemplate”> </SCRIPT> <NOSCRIPT>Amazon.com Widgets</NOSCRIPT>

    On the page it shows this,

    <a-HREF=”http://ws-na.amazon-adsystem.com/widgets/q?rt=tf_cw&ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Flovecourses-20%2F8010%2F5a411cc7-5346-4d91-86c2-9808086e235e&Operation=NoScript=” Amazon.com Widgets

    This is the same for all link type images/widgets I place within BP. The stuff I put on the sidebars within wordpress works fine.

    Why? I’m sure it’s a filter/function, but not sure where/what to change.

    Here is my code:buddypress-xprofile-custom-fields-type/bp-xprofile-custom-fields-type.php
    THE CODE I USED TO GET RID OF AUTO LINKING IS ON THE VERY BOTTOM, THANKS http://www.poetsatwork.com

    
    /*
    Plugin Name: Buddypress Xprofile Custom Fields Type
    Plugin URI: https://github.com/donmik/buddypress-xprofile-custom-fields-type/
    Description: Buddypress installation required!! Add more custom fields type to extended profiles in buddypress: Birthdate, Email, Web, Datepicker. If you need more fields type, you are free to add them yourself or request us at miguel@donmik.com.
    Version: 1.5.8.4
    Author: donmik
    Author URI: http://donmik.com
    */
    //load text domain
    function bxcft_load_textdomain() {
    $locale = apply_filters( 'bxcft_load_load_textdomain_get_locale', get_locale() );
    // if load .mo file
    if ( !empty( $locale ) ) {
    $mofile_default = sprintf( '%slang/%s.mo', plugin_dir_path(__FILE__), $locale );
    $mofile = apply_filters( 'bxcft_load_textdomain_mofile', $mofile_default );
    
    if ( file_exists( $mofile ) )
    load_textdomain( “bxcft”, $mofile );
    }
    }
    add_action ( 'bp_init', 'bxcft_load_textdomain', 2 );
    
    function bxcft_add_new_xprofile_field_type($field_types){
    $new_field_types = array('birthdate', 'email', 'web', 'datepicker',
    'select_custom_post_type', 'multiselect_custom_post_type',
    'checkbox_acceptance', 'image', 'file', 'color', 'number');
    $field_types = array_merge($field_types, $new_field_types);
    return $field_types;
    }
    add_filter( 'xprofile_field_types', 'bxcft_add_new_xprofile_field_type' );
    
    function bxcft_admin_render_new_xprofile_field_type($field, $echo = true) {
    $html = ”;
    switch ( $field->type ) {
    case 'number':
    $html .= '<input type=”number” name=”field_'.$field->id.'” id=”'.$field->id.'” class=”input-number” />';
    break;
    
    case 'color':
    $html .= '<input type=”color” name=”field_'.$field->id.'” id=”'.$field->id.'” class=”input-color” />';
    break;
    
    case 'image':
    case 'file':
    $html .= '<input type=”file” name=”field_'.$field->id.'” id=”'.$field->id.'” class=”input-file” /> ';
    break;
    
    case 'checkbox_acceptance':
    $html .= '<input type=”checkbox” name=”field_'.$field->id.'” id=”'.$field->id.'” class=”input-checkbox” value=”” /> ';
    $html .= $field->description;
    $field->description = ”;
    break;
    
    case 'select_custom_post_type':
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    // Get the posts of custom post type.
    $loop = new WP_Query(array('posts_per_page' => -1, 'post_type' => $custom_post_type, 'orderby' => 'title', 'order' => 'ASC' ));
    }
    $select_custom_post_type = BP_XProfile_ProfileData::get_value_byid( $field->id );
    $html .= '<select name=”field_'.$field->id.'” id=”field_'.$field->id.'”>';
    if (isset($loop)) {
    foreach ($loop->posts as $post) {
    $html .= '<option value=”'.$post->ID.'”>'.$post->post_title.'</option>';
    }
    }
    $html .= '</select>';
    break;
    
    case “multiselect_custom_post_type”:
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    // Get the posts of custom post type.
    $loop = new WP_Query(array('posts_per_page' => -1, 'post_type' => $custom_post_type, 'orderby' => 'title', 'order' => 'ASC' ));
    }
    $select_custom_post_type = BP_XProfile_ProfileData::get_value_byid( $field->id );
    $html .= '<select name=”field_'.$field->id.'” id=”field_'.$field->id.'” multiple=”multiple”>';
    if (isset($loop)) {
    foreach ($loop->posts as $post) {
    $html .= '<option value=”'.$post->ID.'”>'.$post->post_title.'</option>';
    }
    }
    $html .= '</select>';
    break;
    
    case “datepicker”:
    $html .= '<input type=”date” name=”field_'.$field->id.'” id=”'.$field->id.'” class=”input” value=”” />';
    break;
    
    case “web”:
    $html .= '<input type=”url” name=”field_'.$field->id.'” id=”'.$field->id.'” class=”input” placeholder=”'.__('yourwebsite.com', 'bxcft').'” value=”” />';
    break;
    
    case “email”:
    $html .= '<input type=”email” name=”field_'.$field->id.'” id=”'.$field->id.'” class=”input” placeholder=”'.__('example@mail.com', 'bxcft').'” value=”” />';
    break;
    
    case “birthdate”:
    $date = BP_XProfile_ProfileData::get_value_byid( $field->id );
    
    // Set day, month, year defaults
    $day = ”;
    $month = ”;
    $year = ”;
    
    if ( !empty( $date ) ) {
    
    // If Unix timestamp
    if ( is_numeric( $date ) ) {
    $day = date( 'j', $date );
    $month = date( 'F', $date );
    $year = date( 'Y', $date );
    
    // If MySQL timestamp
    } else {
    $day = mysql2date( 'j', $date );
    $month = mysql2date( 'F', $date, false ); // Not localized, so that selected() works below
    $year = mysql2date( 'Y', $date );
    }
    }
    
    // Check for updated posted values, and errors preventing
    // them from being saved first time.
    if ( !empty( $_POST['field_' . $field->id . '_day'] ) ) {
    if ( $day != $_POST['field_' . $field->id . '_day'] ) {
    $day = $_POST['field_' . $field->id . '_day'];
    }
    }
    
    if ( !empty( $_POST['field_' . $field->id . '_month'] ) ) {
    if ( $month != $_POST['field_' . $field->id . '_month'] ) {
    $month = $_POST['field_' . $field->id . '_month'];
    }
    }
    
    if ( !empty( $_POST['field_' . $field->id . '_year'] ) ) {
    if ( $year != date( “j”, $_POST['field_' . $field->id . '_year'] ) ) {
    $year = $_POST['field_' . $field->id . '_year'];
    }
    }
    
    // Day.
    $html .= '<select name=”field_'.$field->id.'_day” id=”field_'.$field->id.'_day”>';
    $html .= '<option value=””' . selected( $day, ”, false ) . '>–</option>';
    for ( $i = 1; $i < 32; ++$i ) {
    $html .= '<option value=”' . $i .'”' . selected( $day, $i, false ) . '>' . $i . '</option>';
    }
    $html .= '</select>';
    
    // Month.
    $html .= '<select name=”field_'.$field->id.'_month” id=”field_'.$field->id.'_month”>';
    $eng_months = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
    $months = array(
    __( 'January', 'buddypress' ),
    __( 'February', 'buddypress' ),
    __( 'March', 'buddypress' ),
    __( 'April', 'buddypress' ),
    __( 'May', 'buddypress' ),
    __( 'June', 'buddypress' ),
    __( 'July', 'buddypress' ),
    __( 'August', 'buddypress' ),
    __( 'September', 'buddypress' ),
    __( 'October', 'buddypress' ),
    __( 'November', 'buddypress' ),
    __( 'December', 'buddypress' )
    );
    $html .= '<option value=””' . selected( $month, ”, false ) . '>——</option>';
    for ( $i = 0; $i < 12; ++$i ) {
    $html .= '<option value=”' . $eng_months[$i] . '”' . selected( $month, $eng_months[$i], false ) . '>' . $months[$i] . '</option>';
    }
    $html .= '</select>';
    
    // Year.
    $html .= '<select name=”field_'.$field->id.'_year” id=”field_'.$field->id.'_year”>';
    $html .= '<option value=””' . selected( $year, ”, false ) . '>—-</option>';
    for ( $i = date('Y')-1; $i > 1901; $i– ) {
    $html .= '<option value=”' . $i .'”' . selected( $year, $i, false ) . '>' . $i . '</option>';
    }
    $html .= '</select>';
    break;
    
    default:
    // Field type unrecognized.
    // $html = “<p>”.__('Field type unrecognized', 'bxcft').”</p>”;
    break;
    }
    
    if ($echo){
    echo $html;
    return;
    } else {
    return $html;
    }
    
    }
    add_filter( 'xprofile_admin_field', 'bxcft_admin_render_new_xprofile_field_type' );
    
    function bxcft_edit_render_new_xprofile_field($echo = true) {
    global $field;
    if (!is_bool($echo)) {
    $echo = true;
    }
    
    $uploads = wp_upload_dir();
    
    ob_start();
    if ( bp_get_the_profile_field_type() == 'birthdate' ) {
    $date = BP_XProfile_ProfileData::get_value_byid( $field->id );
    // Set day, month, year defaults
    $day = ”;
    $month = ”;
    $year = ”;
    
    if ( !empty( $date ) ) {
    
    // If Unix timestamp
    if ( is_numeric( $date ) ) {
    $day = date( 'j', $date );
    $month = date( 'F', $date );
    $year = date( 'Y', $date );
    
    // If MySQL timestamp
    } else {
    $day = mysql2date( 'j', $date );
    $month = mysql2date( 'F', $date, false ); // Not localized, so that selected() works below
    $year = mysql2date( 'Y', $date );
    }
    }
    
    // Check for updated posted values, and errors preventing
    // them from being saved first time.
    if ( !empty( $_POST['field_' . $field->id . '_day'] ) ) {
    if ( $day != $_POST['field_' . $field->id . '_day'] ) {
    $day = $_POST['field_' . $field->id . '_day'];
    }
    }
    
    if ( !empty( $_POST['field_' . $field->id . '_month'] ) ) {
    if ( $month != $_POST['field_' . $field->id . '_month'] ) {
    $month = $_POST['field_' . $field->id . '_month'];
    }
    }
    
    if ( !empty( $_POST['field_' . $field->id . '_year'] ) ) {
    if ( $year != date( “j”, $_POST['field_' . $field->id . '_year'] ) ) {
    $year = $_POST['field_' . $field->id . '_year'];
    }
    }
    ?>
    <div class=”datebox”>
    <?php
    $label = sprintf('<label class=”label-form%s” for=”%s_day”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    // Dropdown => Day of month.
    $options_day = ”;
    for ($i=1; $i<32; ++$i) {
    $options_day .= sprintf('<option value=”%s”%s>%s</option>',
    $i,
    selected($day, $i, false),
    $i);
    }
    $input = sprintf('<select name=”%s_day” id=”%s_day”%s><option value=””%s>–</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?'aria-required=”true”':”,
    selected($day, ”, false),
    $options_day);
    
    // Dropdown => Month.
    $eng_months = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
    $months = array(
    __( 'January', 'buddypress' ),
    __( 'February', 'buddypress' ),
    __( 'March', 'buddypress' ),
    __( 'April', 'buddypress' ),
    __( 'May', 'buddypress' ),
    __( 'June', 'buddypress' ),
    __( 'July', 'buddypress' ),
    __( 'August', 'buddypress' ),
    __( 'September', 'buddypress' ),
    __( 'October', 'buddypress' ),
    __( 'November', 'buddypress' ),
    __( 'December', 'buddypress' )
    );
    $options_month = ”;
    for ($i=0; $i<12; ++$i) {
    $options_month .= sprintf('<option value=”%s”%s>%s</option>',
    $eng_months[$i],
    selected( $month, $eng_months[$i], false ),
    $months[$i]);
    }
    $input .= sprintf('<select name=”%s_month” id=”%s_month”%s><option value=””%s>——</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?'aria-required=”true”':”,
    selected($month, ”, false),
    $options_month);
    
    // Dropdown => Year.
    $birthdate_start_year = date('Y')-1;
    $options_year = ”;
    for ($i=$birthdate_start_year; $i>1901; $i–) {
    $options_year .= sprintf('<option value=”%s”%s>%s</option>',
    $i,
    selected($year, $i, false),
    $i);
    }
    $input .= sprintf('<select name=”%s_year” id=”%s_year”%s><option value=””%s>—-</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?'aria-required=”true” required=”required”':”,
    selected($year, ”, false),
    $options_year);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'email' ) {
    ?>
    <div class=”input-email”>
    <?php
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    $input = sprintf('<input type=”email” name=”%s” id=”%s”%s class=”input” value=”%s” placeholder=”%s” />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”,
    bp_get_the_profile_field_edit_value(),
    __('example@mail.com', 'bxcft'));
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'web' ) {
    ?>
    <div class=”input-web”>
    <?php
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    $input = sprintf('<input type=”url” name=”%s” id=”%s”%s class=”input” value=”%s” placeholder=”%s” />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”,
    bp_get_the_profile_field_edit_value(),
    __('http://yourwebsite.com', 'bxcft'));
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'datepicker' ) {
    ?>
    <div class=”input-datepicker”>
    <?php
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    $input = sprintf('<input type=”date” name=”%s” id=”%s”%s class=”input” value=”%s” />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”,
    bp_get_the_profile_field_edit_value());
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'select_custom_post_type' ) {
    ?>
    <div class=”input-custom-post-type”>
    <?php
    $custom_post_type_selected = BP_XProfile_ProfileData::get_value_byid( $field->id );
    if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != ” ) {
    if ( !empty( $_POST['field_' . $field->id] ) ) {
    $custom_post_type_selected = $_POST['field_' . $field->id];
    }
    }
    if (is_null($custom_post_type_selected)) {
    $custom_post_type_selected = array();
    }
    // Get field's data.
    $field_data = new BP_XProfile_Field($field->id);
    // Get the childs of field
    $childs = $field_data->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    // Get the posts of custom post type.
    $loop = new WP_Query(array('posts_per_page' => -1, 'post_type' => $custom_post_type, 'orderby' => 'title', 'order' => 'ASC' ));
    
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    $options_posts = ”;
    foreach ($loop->posts as $post) {
    $options_posts .= sprintf('<option value=”%s”%s>%s</option>',
    $post->ID,
    ($custom_post_type_selected==$post->ID)?' selected=”selected”':”,
    $post->post_title);
    }
    $input = sprintf('<select name=”%s” id=”%s”%s class=”select”><option value=””>%s</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”,
    __('Select…', 'bxcft'),
    $options_posts);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    } else {
    _e('There is no custom post type selected.', 'bxcft');
    }
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'multiselect_custom_post_type' ) {
    ?>
    <div class=”input-custom-post-type-multi”>
    <?php
    $custom_post_type_selected = maybe_unserialize(BP_XProfile_ProfileData::get_value_byid( $field->id ));
    if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != ” ) {
    if ( !empty( $_POST['field_' . $field->id] ) ) {
    $custom_post_type_selected = $_POST['field_' . $field->id];
    }
    }
    // Get field's data.
    $field_data = new BP_XProfile_Field($field->id);
    // Get the childs of field
    $childs = $field_data->get_children();
    if (isset($childs) && $childs && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    // Get the posts of custom post type.
    $loop = new WP_Query(array('posts_per_page' => -1, 'post_type' => $custom_post_type, 'orderby' => 'title', 'order' => 'ASC' ));
    
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    $options_posts = ”;
    foreach ($loop->posts as $post) {
    $options_posts .= sprintf('<option value=”%s”%s>%s</option>',
    $post->ID,
    (!empty($custom_post_type_selected) &&in_array($post->ID, $custom_post_type_selected))?' selected=”selected”':”,
    $post->post_title);
    }
    $input = sprintf('<select name=”%s[]” id=”%s”%s class=”select” multiple=”multiple”><option value=””>%s</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”,
    __('Select…', 'bxcft'),
    $options_posts);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    } else {
    _e('There is no custom post type selected.', 'bxcft');
    }
    ?>
    </div>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'checkbox_acceptance') {
    ?>
    <div class=”checkbox-acceptance”>
    <?php
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    $input = sprintf('<input type=”checkbox” name=”%s” id=”%s”%s class=”checkbox” value=”1″%s />%s',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”,
    bp_get_the_profile_field_edit_value()?' checked=”checked”':”,
    bp_get_the_profile_field_description());
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    $field_description = ”;
    ?>
    </div>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'image') {
    ?>
    <div class=”input-image”>
    <?php
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    if (bp_get_the_profile_field_edit_value() != ”) {
    $actual_image = sprintf('%s<label for=”%s_deleteimg”><input type=”checkbox” name=”%s_deleteimg” id=”%s_deleteimg” value=”1″ />%s</label><input type=”hidden” name=”%s_hiddenimg” id=”%s_hiddenimg” value=”%s” />',
    $uploads['baseurl'].bp_get_the_profile_field_edit_value(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    __('Check this to delete this image', 'bxcft'),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_edit_value());
    } else {
    $actual_image = ”;
    }
    $input = sprintf('<input type=”file” name=”%s” id=”%s”%s />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    
    echo apply_filters('bxcft_field_actual_image', $actual_image, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_edit_value());
    ?>
    <script type=”text/javascript”>
    jQuery('#profile-edit-form').attr('enctype', 'multipart/form-data');
    </script>
    </div>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'file') {
    ?>
    <div class=”input-file”>
    <?php
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    if (bp_get_the_profile_field_edit_value() != ”) {
    $actual_file = sprintf('%s<label for=”%s_deletefile”><input type=”checkbox” name=”%s_deletefile” id=”%s_deletefile” value=”1″ />%s</label><input type=”hidden” name=”%s_hiddenfile” id=”%s_hiddenfile” value=”%s” />',
    apply_filters('bxcft_show_download_file_link', '' . __('Download file', 'bxcft') . '', bp_get_the_profile_field_type(), bp_get_the_profile_field_id(), bp_get_the_profile_field_edit_value()),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    __('Check this to delete this file', 'bxcft'),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_edit_value());
    } else {
    $actual_file = ”;
    }
    $input = sprintf('<input type=”file” name=”%s” id=”%s”%s />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    
    echo apply_filters('bxcft_field_actual_file', $actual_file, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_edit_value());
    ?>
    <script type=”text/javascript”>
    jQuery('#profile-edit-form').attr('enctype', 'multipart/form-data');
    </script>
    </div>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'color') {
    $color_selected = bp_get_the_profile_field_edit_value();
    if (strpos($color_selected, '#') === false) {
    $color_selected = '#'.$color_selected;
    }
    ?>
    <div class=”input-color”>
    <?php
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    $input = sprintf('<input type=”color” name=”%s” id=”%s”%s class=”input” value=”%s” />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”,
    $color_selected);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <script>
    if (!Modernizr.inputtypes.color) {
    // No html5 field colorpicker => Calling jscolor.
    jQuery('input#<?php bp_the_profile_field_input_name() ?>').addClass('color');
    }
    </script>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'number') {
    ?>
    <div class=”input-number”>
    <?php
    $label = sprintf('<label class=”label-form%s” for=”%s”>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':”,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):”);
    
    $input = sprintf('<input type=”number” name=”%s” id=”%s”%s class=”input” value=”%s” />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=”true” required=”required”':”,
    bp_get_the_profile_field_edit_value());
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    
    $output = ob_get_contents();
    ob_end_clean();
    
    if ($echo) {
    echo $output;
    return;
    }
    return $output;
    }
    
    /*
    * Buddypress v1.7 has better hook bp_custom_profile_edit_fields_pre_visibility which shows fields before visibility settings.
    * In case buddypress previous version is installed, we use the other tag bp_custom_profile_edit_fields.
    */
    $version_bp = 0;
    $data = get_file_data(WP_PLUGIN_DIR . '/buddypress/bp-loader.php', array('Version'));
    if (isset($data) && count($data) > 0 && $data[0] != ”)
    $version_bp = (float)$data[0];
    if ($version_bp >= 1.7)
    add_action( 'bp_custom_profile_edit_fields_pre_visibility', 'bxcft_edit_render_new_xprofile_field' );
    else
    add_action( 'bp_custom_profile_edit_fields', 'bxcft_edit_render_new_xprofile_field' );
    
    function bxcft_get_field_value( $value=”, $type=”, $id=”) {
    
    $value_to_return = $value;
    
    if ($value_to_return == ”)
    return apply_filters('bxcft_show_field_value', $value_to_return, $type, $id, $value);
    
    $uploads = wp_upload_dir();
    
    if ($type == 'birthdate') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $field = new BP_XProfile_Field($id);
    // Get children.
    $childs = $field->get_children();
    $show_age = false;
    if (isset($childs) && $childs && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    if ($childs[0]->name == 'show_age')
    $show_age = true;
    }
    if ($value != ”) {
    if ($show_age) {
    $value_to_return = '<p>'.floor((time() – strtotime($value))/31556926).'</p>';
    } else {
    $value_to_return = '<p>'.date_i18n(get_option('date_format') ,strtotime($value) ).'</p>';
    }
    }
    }
    elseif ($type == 'datepicker') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.date_i18n(get_option('date_format') ,strtotime($value) ).'</p>';
    }
    elseif ($type == 'email') {
    if (strpos($value, 'mailto') === false) {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.$value.'</p>';
    }
    }
    elseif ($type == 'web') {
    if (strpos($value, 'href=') === false) {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.$value.'</p>';
    }
    }
    elseif ($type == 'select_custom_post_type') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    // Get field's data.
    $field = new BP_XProfile_Field($id);
    // Get children.
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    }
    $post = get_post($value);
    if ($post->post_type == $custom_post_type) {
    $value_to_return = '<p>'.$post->post_title.'</p>';
    } else {
    // Custom post type is not the same.
    $value_to_return = '<p>–</p>';
    }
    }
    elseif ($type == 'multiselect_custom_post_type') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    // Get field's data.
    $field = new BP_XProfile_Field($id);
    // Get children.
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    } else {
    $custom_post_type = ”;
    }
    $values = explode(“,”, $value);
    $cad = ”;
    foreach ($values as $v) {
    $post = get_post($v);
    if ($post->post_type == $custom_post_type) {
    if ($cad == ”)
    $cad .= '<ul class=”list_custom_post_type”>';
    $cad .= '
    '.$post->post_title.'
    
    ';
    }
    }
    if ($cad != ”) {
    $cad .= '';
    $value_to_return = '<p>'.$cad.'</p>';
    } else {
    $value_to_return = '<p>–</p>';
    }
    } elseif ($type == 'checkbox_acceptance') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.(($value==1)?__('yes', 'bxcft'):__('no', 'bxcft')).'</p>';
    } elseif ($type == 'image') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p></p>';
    } elseif ($type == 'file') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.__('Download file', 'bxcft').'</p>';
    } elseif ($type == 'color') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    if (strpos($value, '#') === false) {
    $value = '#'.$value;
    }
    $value_to_return = '<p>'.$value.'</p>';
    }
    // Number nothing to do.
    
    return apply_filters('bxcft_show_field_value', $value_to_return, $type, $id, $value);
    }
    add_filter( 'bp_get_the_profile_field_value', 'bxcft_get_field_value', 15, 3);
    
    /**
    * Filter for those who use xprofile_get_field_data instead of get_field_value.
    * @param type $value
    * @param type $field_id
    * @param type $user_id
    * @return string
    */
    function bxcft_get_field_data($value, $field_id) {
    
    $value_to_return = $value;
    $field = new BP_XProfile_Field($field_id);
    
    if ($value_to_return == ”)
    return apply_filters('bxcft_show_field_value', $value_to_return, $field->type, $field_id, $value);
    
    $uploads = wp_upload_dir();
    if ($field->type == 'birthdate') {
    // Get children.
    $childs = $field->get_children();
    $show_age = false;
    if (isset($childs) && $childs && count($childs) > 0 && is_object($childs[0])) {
    if ($childs[0]->name == 'show_age')
    $show_age = true;
    }
    if ($value != ”) {
    if ($show_age) {
    $value_to_return = '<p>'.floor((time() – strtotime($value))/31556926).'</p>';
    } else {
    $value_to_return = '<p>'.date_i18n(get_option('date_format') ,strtotime($value) ).'</p>';
    }
    }
    }
    elseif ($field->type == 'datepicker') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.date_i18n(get_option('date_format') ,strtotime($value) ).'</p>';
    }
    elseif ($field->type == 'email') {
    if (strpos($value, 'mailto') === false) {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.$value.'</p>';
    }
    }
    elseif ($field->type == 'web') {
    if (strpos($value, 'href=') === false) {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.$value.'</p>';
    }
    }
    elseif ($field->type == 'select_custom_post_type') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    // Get children.
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    }
    $post = get_post($value);
    if ($post->post_type == $custom_post_type) {
    $value_to_return = '<p>'.$post->post_title.'</p>';
    } else {
    // Custom post type is not the same.
    $value_to_return = '<p>–</p>';
    }
    }
    elseif ($field->type == 'multiselect_custom_post_type') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    // Get children.
    $childs = $field->get_children();
    $values = explode(“,”, $value);
    $cad = ”;
    if (isset($childs) && is_array($childs) && count($childs) > 0) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    
    foreach ($values as $v) {
    $post = get_post($v);
    if ($post->post_type == $custom_post_type) {
    if ($cad == ”)
    $cad .= '<ul class=”list_custom_post_type”>';
    $cad .= '
    '.$post->post_title.'
    
    ';
    }
    }
    }
    if ($cad != ”) {
    $cad .= '';
    $value_to_return = '<p>'.$cad.'</p>';
    } else {
    $value_to_return = '<p>–</p>';
    }
    } elseif ($field->type == 'checkbox_acceptance') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.(($value==1)?__('yes', 'bxcft'):__('no', 'bxcft')).'</p>';
    } elseif ($field->type == 'image') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p></p>';
    } elseif ($field->type == 'file') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $value_to_return = '<p>'.__('Download file', 'bxcft').'</p>';
    } elseif ($field->type == 'color') {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    if (strpos($value, '#') === false) {
    $value = '#'.$value;
    }
    $value_to_return = '<p>'.$value.'</p>';
    }
    // Number nothing to do.
    
    return apply_filters('bxcft_show_field_value', $value_to_return, $field->type, $field_id, $value);
    
    }
    add_filter( 'xprofile_get_field_data', 'bxcft_get_field_data', 15, 2);
    
    /**
    * Function replacing the original buddypress filter.
    * @param type $field_value
    * @param type $field_type
    * @return string
    */
    function bxcft_xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
    if ( 'datebox' == $field_type || 'email' == $field_type || 'birthdate' == $field_type ||
    'datepicker' == $field_type || 'web' == $field_type || 'select_custom_post_type' == $field_type ||
    'multiselect_custom_post_type' == $field_type || 'image' == $field_type || 'file' == $field_type ||
    'color' == $field_type || 'number' == $field_type)
    return $field_value;
    
    if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) )
    return $field_value;
    
    $values = explode( ',', $field_value );
    
    if ( !empty( $values ) ) {
    foreach ( (array) $values as $value ) {
    $value = trim( $value );
    
    // If the value is a URL, skip it and just make it clickable.
    if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) {
    $new_values[] = make_clickable( $value );
    
    // Is not clickable
    } else {
    
    // More than 5 spaces
    if ( count( explode( ' ', $value ) ) > 5 ) {
    $new_values[] = $value;
    
    // Less than 5 spaces
    } else {
    $search_url = add_query_arg( array( 's' => urlencode( $value ) ), bp_get_members_directory_permalink() );
    $new_values[] = '' . $value . '';
    }
    }
    }
    
    $values = implode( ', ', $new_values );
    }
    
    return $values;
    }
    
    /**
    * Adding js for admin.
    * @param type $hook
    * @return type
    */
    function bxcft_add_js($hook) {
    if ('users_page_bp-profile-setup' != $hook && 'buddypress_page_bp-profile-setup' != $hook)
    return;
    
    wp_enqueue_script( 'bxcft-js', plugins_url('assets/js/addfields.js', __FILE__), array( 'jquery' ), '1.5.7′ );
    $params = array(
    'birthdate' => __('Birthdate', 'bxcft'),
    'email' => __('Email', 'bxcft'),
    'web' => __('Website', 'bxcft'),
    'datepicker' => __('Datepicker', 'bxcft'),
    'select_custom_post_type' => __('Custom Post Type Selector', 'bxcft'),
    'multiselect_custom_post_type' => __('Custom Post Type Multiselector', 'bxcft'),
    'checkbox_acceptance' => __('Checkbox acceptance', 'bxcft'),
    'image' => __('Image', 'bxcft'),
    'file' => __('File', 'bxcft'),
    'color' => __('Color', 'bxcft'),
    'number' => __('Number', 'bxcft')
    );
    wp_localize_script('bxcft-js', 'params', $params);
    }
    add_action( 'admin_enqueue_scripts', 'bxcft_add_js');
    
    /**
    * Adding js for edit form.
    */
    function bxcft_add_js_public() {
    // Modernizr to test html5 fields.
    wp_enqueue_script( 'bxcft-modernizr', plugins_url('assets/js/modernizr.js', __FILE__), array( 'jquery' ), '2.6.2′ );
    // Plugin jscolor fallback colorpicker.
    wp_enqueue_script( 'bxcft-jscolor', plugins_url('assets/js/jscolor/jscolor.js', __FILE__), array( 'bxcft-modernizr' ), '1.4.1′ );
    }
    add_action( 'wp_enqueue_scripts', 'bxcft_add_js_public');
    
    function bxcft_save_custom_option($field) {
    global $bp, $wpdb;
    
    if ( 'select_custom_post_type' == $field->type ) {
    $post_option = !empty( $_POST['select_custom_post_type_option']) ? $_POST['select_custom_post_type_option'] : ”;
    if ( ” != $post_option ) {
    if ( !empty( $field->id ) ) {
    $field_id = $field->id;
    } else {
    $field_id = $wpdb->insert_id;
    }
    if ( !$wpdb->query( $wpdb->prepare( “INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'custom_post_type_option', %s, ”, 0, %d, %d)”, $field->group_id, $field_id, $post_option, 1, 1 ) ) ) {
    return false;
    }
    }
    }
    elseif ( 'multiselect_custom_post_type' == $field->type) {
    $post_option = !empty( $_POST['multiselect_custom_post_type_option']) ? $_POST['multiselect_custom_post_type_option'] : ”;
    if ( ” != $post_option ) {
    if ( !empty( $field->id ) ) {
    $field_id = $field->id;
    } else {
    $field_id = $wpdb->insert_id;
    }
    if ( !$wpdb->query( $wpdb->prepare( “INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'multi_custom_post_type_option', %s, ”, 0, %d, %d)”, $field->group_id, $field_id, $post_option, 1, 1 ) ) ) {
    return false;
    }
    }
    }
    elseif ( 'birthdate' == $field->type) {
    $post_option = !empty( $_POST['birthdate_option']) ? $_POST['birthdate_option'] : ”;
    if ( ” != $post_option ) {
    if ( !empty( $field->id ) ) {
    $field_id = $field->id;
    } else {
    $field_id = $wpdb->insert_id;
    }
    if ( !$wpdb->query( $wpdb->prepare( “INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'birthdate_option', %s, ”, 0, %d, %d)”, $field->group_id, $field_id, $post_option, 1, 1 ) ) ) {
    return false;
    }
    }
    }
    
    }
    add_action( 'xprofile_field_after_save', 'bxcft_save_custom_option');
    
    function bxcft_delete_field_custom($field) {
    if ($field->type == 'select_custom_post_type' || $field->type == 'multiselect_custom_post_type'
    || $field->type == 'birthdate') {
    $field->delete_children();
    }
    }
    add_action( 'xprofile_fields_deleted_field', 'bxcft_delete_field_custom');
    
    function bxcft_selected_field($field) {
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0]) && $field->type == 'select_custom_post_type') {
    $selected_option = $childs[0]->name;
    } else {
    $selected_option = null;
    }
    
    if (!empty($_POST['select_custom_post_type_option'])) {
    $selected_option = $_POST['select_custom_post_type_option'];
    }
    ?>
    <div style=”display: none; margin-left: 15px;” class=”options-box” id=”select_custom_post_type”>
    <h4><?php _e('Please, select custom post type', 'bxcft'); ?></h4>
    <p>
    <?php _e('Custom Post Type:', 'bxcft'); ?>
    <select name=”select_custom_post_type_option” id=”select_custom_post_type_option”>
    <?php
    $args = array(
    'public' => true,
    '_builtin' => false
    );
    $custom_post_types = get_post_types($args);
    foreach ($custom_post_types as $post_type) :
    ?>
    <option value=”<?php echo $post_type; ?>” <?php if ($selected_option == $post_type): ?>selected=”selected”<?php endif; ?>>
    <?php echo $post_type; ?>
    </option>
    <?php endforeach; ?>
    </select>
    </p>
    </div>
    <?php
    if (isset($childs) && count($childs) > 0 && is_object($childs[0]) && $field->type == 'multiselect_custom_post_type') {
    $selected_option = $childs[0]->name;
    } else {
    $selected_option = null;
    }
    
    if (!empty($_POST['multiselect_custom_post_type_option'])) {
    $selected_option = $_POST['multiselect_custom_post_type_option'];
    }
    ?>
    <div style=”display: none; margin-left: 15px;” class=”options-box” id=”multiselect_custom_post_type”>
    <h4><?php _e('Please, select custom post type', 'bxcft'); ?></h4>
    <p>
    <?php _e('Custom Post Type:', 'bxcft'); ?>
    <select name=”multiselect_custom_post_type_option” id=”multiselect_custom_post_type_option”>
    <?php
    foreach ($custom_post_types as $post_type) :
    ?>
    <option value=”<?php echo $post_type; ?>” <?php if ($selected_option == $post_type): ?>selected=”selected”<?php endif; ?>>
    <?php echo $post_type; ?>
    </option>
    <?php endforeach; ?>
    </select>
    </p>
    </div>
    <?php
    if (isset($childs) && $childs && count($childs) > 0 && is_object($childs[0]) && $field->type == 'birthdate') {
    $selected_option = $childs[0]->name;
    } else {
    $selected_option = null;
    }
    
    if (!empty($_POST['birthdate_option'])) {
    $selected_option = $_POST['birthdate_option'];
    }
    ?>
    <div style=”display: none; margin-left: 15px;” class=”options-box” id=”birthdate”>
    <h4><?php _e('Show age (hide birthdate)', 'bxcft'); ?></h4>
    <p>
    <?php _e('Check this if you want to show age instead of birthdate:', 'bxcft'); ?>
    <input type=”checkbox” name=”birthdate_option” value=”show_age” id=”birthdate_option”
    <?php if ($selected_option == 'show_age') : ?>checked=”checked”<?php endif; ?>/>
    </p>
    </div>
    <?php if (!is_null($field->type)) : ?>
    <script type=”text/javascript”>
    jQuery(document).ready(function() {
    bxcft.select('<?php echo $field->type; ?>');
    });
    </script>
    <?php
    endif;
    }
    add_action('xprofile_field_additional_options', 'bxcft_selected_field');
    
    /**
    * This filter add a new level of visibility. Hide this field for everyone. Nobody can see.
    * @param type $visibility_levels
    * @return type
    */
    function bxcft_xprofile_get_visibility_levels($visibility_levels) {
    $visibility_levels['nobody'] = array('id' => 'nobody', 'label' => __('Nobody', 'bxcft'));
    return $visibility_levels;
    }
    add_filter('bp_xprofile_get_visibility_levels', 'bxcft_xprofile_get_visibility_levels', 1);
    
    /**
    * This filter is necessary to hide fields when 'nobody' new visibility is selected.
    * @param type $hidden_fields
    * @param type $displayed_user_id
    * @param type $current_user_id
    * @return type
    */
    function bxcft_xprofile_get_hidden_fields_for_user($hidden_fields, $displayed_user_id=0, $current_user_id=0) {
    if ( !$displayed_user_id ) {
    $displayed_user_id = bp_displayed_user_id();
    }
    
    if ( !$displayed_user_id ) {
    return array();
    }
    
    if ( !$current_user_id ) {
    $current_user_id = bp_loggedin_user_id();
    }
    
    // @todo – This is where you'd swap out for current_user_can() checks
    $new_hidden_fields = array();
    
    if ( $current_user_id ) {
    // Current user is logged in
    if ( $displayed_user_id == $current_user_id ) {
    // If you're viewing your own profile, nothing's private
    
    } elseif ( bp_is_active( 'friends' ) && friends_check_friendship( $displayed_user_id, $current_user_id ) ) {
    // If the current user and displayed user are friends, so exclude nobody
    $hidden_levels[] = 'nobody';
    $new_hidden_fields = bp_xprofile_get_fields_by_visibility_levels( $displayed_user_id, $hidden_levels );
    
    } else {
    // current user is logged-in but not friends, so exclude friends-only
    $hidden_levels[] = 'nobody';
    
    $new_hidden_fields = bp_xprofile_get_fields_by_visibility_levels( $displayed_user_id, $hidden_levels );
    }
    
    } else {
    // Current user is not logged in, so exclude friends-only and loggedin
    $hidden_levels[] = 'nobody';
    
    $new_hidden_fields = bp_xprofile_get_fields_by_visibility_levels( $displayed_user_id, $hidden_levels );
    }
    
    if (is_array($new_hidden_fields))
    $hidden_fields = array_merge($hidden_fields, $new_hidden_fields);
    
    return $hidden_fields;
    }
    add_filter('bp_xprofile_get_hidden_fields_for_user', 'bxcft_xprofile_get_hidden_fields_for_user', 10, 3);
    
    /**
    * Update profile
    */
    function bxcft_updated_profile($bp_user_id, $posted_field_ids, $errors) {
    
    global $bp;
    
    // There are errors
    if ( empty( $errors ) ) {
    
    // Reset the errors var
    $errors = false;
    
    // Now we've checked for required fields, lets save the values.
    foreach ( (array) $posted_field_ids as $field_id ) {
    
    // Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit.
    if ( empty( $_POST['field_' . $field_id] ) )
    $value = array();
    else
    $value = $_POST['field_' . $field_id];
    
    // Handles delete checkbox.
    $uploads = wp_upload_dir();
    $field = new BP_XProfile_Field($field_id);
    if ($field->type == 'image' && isset($_POST['field_'.$field_id.'_deleteimg']) && $_POST['field_'.$field_id.'_deleteimg']) {
    if (file_exists($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenimg'])) {
    unlink($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenimg']);
    }
    $value = array();
    }
    if ($field->type == 'file' && isset($_POST['field_'.$field_id.'_deletefile']) && $_POST['field_'.$field_id.'_deletefile']) {
    if (file_exists($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenfile'])) {
    unlink($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenfile']);
    }
    $value = array();
    }
    
    // Handles image field type saving.
    if (isset($_FILES['field_'.$field_id]) && $_FILES['field_'.$field_id]['size'] > 0) {
    $field = new BP_XProfile_Field($field_id);
    if ($field->type == 'image') {
    $ext_allowed = array('jpg','jpeg','gif','png');
    apply_filters('images_ext_allowed', $ext_allowed);
    } elseif ($field->type == 'file') {
    $ext_allowed = array('doc','docx','pdf');
    apply_filters('files_ext_allowed', $ext_allowed);
    }
    
    $ext = strtolower(substr($_FILES['field_'.$field_id]['name'], strrpos($_FILES['field_'.$field_id]['name'],'.')+1));
    if (!in_array($ext, $ext_allowed)) {
    $errors = true;
    } else {
    require_once( ABSPATH . '/wp-admin/includes/file.php' );
    add_filter( 'upload_dir', 'bxcft_profile_upload_dir', 10, 1 );
    $_POST['action'] = 'wp_handle_upload';
    $uploaded_file = wp_handle_upload( $_FILES['field_'.$field_id] );
    $uploads = wp_upload_dir();
    $value = str_replace($uploads['baseurl'], ”, $uploaded_file['url']);
    }
    } else {
    if ($field->type == 'image' && (!isset($_POST['field_'.$field_id.'_deleteimg']) || !$_POST['field_'.$field_id.'_deleteimg']) && isset($_POST['field_'.$field_id.'_hiddenimg']) && $_POST['field_'.$field_id.'_hiddenimg'] != ”) {
    $value = $_POST['field_'.$field_id.'_hiddenimg'];
    }
    elseif ($field->type == 'file' && (!isset($_POST['field_'.$field_id.'_deletefile']) || !$_POST['field_'.$field_id.'_deletefile']) && isset($_POST['field_'.$field_id.'_hiddenfile']) && $_POST['field_'.$field_id.'_hiddenfile'] != ”) {
    $value = $_POST['field_'.$field_id.'_hiddenfile'];
    }
    }
    if ( !xprofile_set_field_data( $field_id, $bp_user_id, $value ) ) {
    $errors = true;
    } else {
    do_action( 'xprofile_profile_field_data_updated', $field_id, $value );
    }
    }
    }
    }
    add_action('xprofile_updated_profile', 'bxcft_updated_profile', 10, 3);
    
    function bxcft_signup_user($user_id, $user_login, $user_password, $user_email, $usermeta)
    {
    // Set any profile data
    if ( bp_is_active( 'xprofile' ) ) {
    if ( !empty( $usermeta['profile_field_ids'] ) ) {
    $profile_field_ids = explode( ',', $usermeta['profile_field_ids'] );
    
    foreach( (array) $profile_field_ids as $field_id ) {
    
    if (!empty($usermeta["field_{$field_id}"]))
    $value = $usermeta["field_{$field_id}"];
    else
    $value = array();
    
    // Handles delete checkbox.
    $uploads = wp_upload_dir();
    $field = new BP_XProfile_Field($field_id);
    if ($field->type == 'image' && isset($_POST['field_'.$field_id.'_deleteimg']) && $_POST['field_'.$field_id.'_deleteimg']) {
    if (file_exists($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenimg'])) {
    unlink($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenimg']);
    }
    $value = array();
    }
    if ($field->type == 'file' && isset($_POST['field_'.$field_id.'_deletefile']) && $_POST['field_'.$field_id.'_deletefile']) {
    if (file_exists($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenfile'])) {
    unlink($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenfile']);
    }
    $value = array();
    }
    
    // Handles image field type saving.
    if (isset($_FILES['field_'.$field_id]) && $_FILES['field_'.$field_id]['size'] > 0) {
    $field = new BP_XProfile_Field($field_id);
    if ($field->type == 'image') {
    $ext_allowed = array('jpg','jpeg','gif','png');
    apply_filters('images_ext_allowed', $ext_allowed);
    } elseif ($field->type == 'file') {
    $ext_allowed = array('doc','docx','pdf');
    apply_filters('files_ext_allowed', $ext_allowed);
    }
    
    $ext = strtolower(substr($_FILES['field_'.$field_id]['name'], strrpos($_FILES['field_'.$field_id]['name'],'.')+1));
    if (in_array($ext, $ext_allowed)) {
    require_once( ABSPATH . '/wp-admin/includes/file.php' );
    add_filter( 'upload_dir', 'bxcft_profile_upload_dir', 10, 1 );
    $_POST['action'] = 'wp_handle_upload';
    $uploaded_file = wp_handle_upload( $_FILES['field_'.$field_id] );
    $destino = str_replace('0′, $user_id, $uploaded_file['file']);
    $aux = explode(“/”, $destino);
    if (!file_exists(str_replace('/'.$aux[count($aux)-1], ”, $destino))) {
    mkdir(str_replace('/'.$aux[count($aux)-1], ”, $destino));
    }
    copy($uploaded_file['file'], $destino);
    unlink($uploaded_file['file']);
    $value = str_replace($uploads['baseurl'], ”, str_replace('0′, $user_id, $uploaded_file['url']));
    }
    } else {
    if ($field->type == 'image' && (!isset($_POST['field_'.$field_id.'_deleteimg']) || !$_POST['field_'.$field_id.'_deleteimg']) && isset($_POST['field_'.$field_id.'_hiddenimg']) && $_POST['field_'.$field_id.'_hiddenimg'] != ”) {
    $value = $_POST['field_'.$field_id.'_hiddenimg'];
    }
    elseif ($field->type == 'file' && (!isset($_POST['field_'.$field_id.'_deletefile']) || !$_POST['field_'.$field_id.'_deletefile']) && isset($_POST['field_'.$field_id.'_hiddenfile']) && $_POST['field_'.$field_id.'_hiddenfile'] != ”) {
    $value = $_POST['field_'.$field_id.'_hiddenfile'];
    }
    }
    
    xprofile_set_field_data( $field_id, $user_id, $value );
    }
    }
    }
    }
    add_action('bp_core_signup_user', 'bxcft_signup_user', 10, 5);
    
    function bxcft_profile_upload_dir( $upload_dir, $user_id=0 ) {
    if ($user_id == 0)
    $user_id = bp_displayed_user_id();
    $profile_subdir = '/profiles/' . $user_id;
    
    $upload_dir['path'] = $upload_dir['basedir'] . $profile_subdir;
    $upload_dir['url'] = $upload_dir['baseurl'] . $profile_subdir;
    $upload_dir['subdir'] = $profile_subdir;
    
    return $upload_dir;
    }
    
    /**
    * Replacing the buddypress filter link profile is it has the filter.
    * If user deactivated the filter, we don't add another filter.
    */
    function bxcft_remove_xprofile_links() {
    if (has_filter('bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data')) {
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
    add_filter( 'bp_get_the_profile_field_value', 'bxcft_xprofile_filter_link_profile_data', 9, 2);
    }
    }
    add_action( 'bp_setup_globals', 'bxcft_remove_xprofile_links', 9999 );
    
    /**
    * This function only works if plugin bp-profile search is active.
    * @global type $bps_options
    * @param type $type
    * @return string
    */
    function bxcft_profile_field_type($type) {
    if (function_exists('is_plugin_active') && is_plugin_active('bp-profile-search/bps-main.php')
    || in_array( 'bp-profile-search/bps-main.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) )) {
    global $bps_options;
    $id = bp_get_the_profile_field_id ();
    
    if ( ((is_admin() && strpos($_SERVER['REQUEST_URI'], 'page=bp-profile-search'))
    || (isset($bps_options) && $bps_options['agerange'] == $id
    && isset($_POST['bp_profile_search']) && $_POST['bp_profile_search']))
    && $type == 'birthdate') {
    return 'datebox';
    }
    }
    
    return $type;
    }
    add_filter('bp_the_profile_field_type', 'bxcft_profile_field_type', 1);
    
    add_action('init', 'my_xprofile_links');
    function my_xprofile_links() {
    if (has_filter('bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data')) {
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9 );
    }
    if (has_filter('bp_get_the_profile_field_value', 'bxcft_xprofile_filter_link_profile_data')) {
    remove_filter( 'bp_get_the_profile_field_value', 'bxcft_xprofile_filter_link_profile_data', 9);
    }
    add_filter( 'bp_get_the_profile_field_value', 'my_xprofile_filter_link_profile_data', 10, 2);
    }
    
    function my_xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
    if ( 'datebox' == $field_type )
    return $field_value;
    
    if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) )
    return $field_value;
    
    $values = explode( ',', $field_value );
    
    if ( !empty( $values ) ) {
    foreach ( (array) $values as $value ) {
    $value = trim( $value );
    $new_values[] = make_clickable( $value );
    }
    $values = implode( ', ', $new_values );
    }
    return $values;
    }
    
    #177097
    Wendell
    Participant

    I am considering a move to BuddyPress but am very concerned about keeping the general functionality of my current forum at http://surveyorconnect.com. It uses a threaded, hierarchal tree-style forum software and my users love it. A little backstory: an industry magazine used to have a similar forum, then switched to a newer format and nobody liked it — so I started a new forum using MyLittleForum (http://mylittleforum.net) and told a few surveyors about it and in short order, it was very busy and respected in the surveying community. Many of the users are “old school” and so they like this format. But I also want to attract a younger crowd, who I assume would prefer a more modern format.

    What I’m really hoping for here is that BuddyPress would allow me to provide BOTH formats on a user-by-user basis, so they can select which format they’d prefer. Also, one of the features they like about the current site is the little bubble next to the date in the topics list that gives a preview of the latest post within that topic. If we lose that feature, I won’t be heart-broken, but it would be nice to have something like that in BuddyPress, if possible.

    There is so much I could do with my forum that MLF won’t allow me to do. Probably the biggest thing is the social aspects — allowing people to “like” and share posts, etc.

    I’d love your thoughts, opinions and references to anything that might help me make the decision to move to BuddyPress. Thanks!

    Justin
    Participant

    I am helping a nonprofit I support by building a site totally built on Buddypress: http://parishcollective.org/beta

    We are allowing users to create a profile with minimal information (via Social Login) but we want to keep the user role at ‘subscriber’ until they fill out the required profile fields. At that point, we need to be notified that they updated their info so an admin can check their info and up their role to ‘contributor.’ (It gives them access to creating blog posts and other things)

    Initially I started with something basic from this post: http://buddypress.org/support/topic/notification-on-profile-update-2/

    However, wp_mail() is conflicting with something in our site and causing a fatal error.

    So I’ve been attempting to add a user meta key (when a user updates their profile) that can be queried in the backend in a custom admin menu so the users with completed profiles can be displayed.

    Here was the adapted code based on the post above:

    
    
    function my_update_profile_mark() {
    $user_ID = get_current_user_id();
    $power_level = 9000;
    add_user_meta( $user_ID, '_level_of_power', $power_level);
    }
    add_action( ‘xprofile_updated_profile’, ‘my_update_profile_mark’ );
    
    

    If I understand the ‘xprofile_updated_profile’ hook correctly, it should just fire anytime any field is updated on a profile, right?

    From there I planned to experiment with something like this based on the Force Profile Update plugin to make the function fire when the profile is totally updated:

    function my_update_profile_mark() {
    
                            global $wpdb;
    
    			$bp_prefix = bp_core_get_table_prefix();
    			$xprofile_fields = $wpdb->get_results("SELECT count(*) AS empty_fields_count FROM {$bp_prefix}bp_xprofile_fields WHERE parent_id = 0 AND is_required = 1 AND id NOT IN (SELECT field_id FROM {$bp_prefix}bp_xprofile_data WHERE user_id = {$user_id} AND valueIS NOT NULL AND value` != '')");
    
    			foreach ($xprofile_fields as $field) 
    			{
    				if ($field->empty_fields_count > 0)	
    				{
                                      $user_ID = get_current_user_id();
                                      $power_level = 9000;
                                      add_user_meta( $user_ID, '_level_of_power', $power_level);
                                    }
    add_action( ‘xprofile_updated_profile’, ‘my_update_profile_mark’ );
    

    I’m a pretty new to programming and I don’t totally understand all the code here, but I’m trying hard to make something work here. Any ideas/guidance?

    I also realize this solution, even if it worked, would update the meta key ‘_level_of_power’ to the specified value “9000” every time the user updated their profile after their profiles were filled out. But that’s an annoyance we can live with for now. Not knowing the user is ready to be upgraded wouldn’t work at all for the site. Any help would be appreciated. 🙁

Viewing 25 results - 76 through 100 (of 287 total)
Skip to toolbar