Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)

  • Xtremefaith
    Participant

    @xtremefaith

    @henrywright because I’m using OOP my filter is within a class, so the syntax I have is correct. I’ve created a dashboard page and I want the person viewing that page to see their details throughout it. I’m still pretty new to buddypress so not sure how this is done. But I imagine on any page, or perhaps a widget someone could want to display current user data. So perhaps some documentation or a clear explanation of that would do the trick for me. Thanks!


    Xtremefaith
    Participant

    @xtremefaith

    I believe I found a way to populate the displayed_user data in the $bp object, but the second I do I am redirected to the user’s profile page. Here is my hook:

    add_filter('bp_displayed_user_id', array( $this, 'bp_displayed_outside_bp') );
    function bp_displayed_outside_bp($id){
    	return ($id==0) ? get_current_user_id() : $id;
    }

    As expected, my dashboard page comes back with $id==0 and then the current user id is used to populate the displayed user data, but instead of then rending my dashboard page that I was on, I’m redirected to the profile page.

    I’ve also removed all redirect hooks that I had to make sure none of them are interfering with this. I’m literally stuck right now hoping for some help/direction. So please let me know if you have any thoughts.


    Xtremefaith
    Participant

    @xtremefaith

    Still working on this, I discovered something while debugging:

        1) If I set my priority to 1‚Äč like so:

        add_action('bp_core_activated_user', array( $this, 'setup_registration_metadata'), 1 );

        then in my setup_registration_metadata() function I use add_user_meta() to capture the first_name & last_name values at that point in time. Thankfully it makes an entry in the usermeta table with the expected value from get_user_meta($user_id, 'first_name', true)

        2) Unfortunately, something else apparently is hooked afterwards (possibly a method from the “Enable BuddyPress to WordPress profile syncing”, which then overrides any value I had set for those fields so that in the end the WordPress fields are now incorrect or wiped.

    It seems apparent to me that the “Enable BuddyPress to WordPress profile syncing” option is the culprit, but would that be a bug that the setting is grabbing the wrong values because even if I don’t hook into bp_core_activated_user the meta values that were successfully stored at registration are then wiped during activation? For example:

    • first_name becomes the username
    • last_name is cleared completely

    Setting the priority to 20 the results show that by that point the originally stored meta_value(s) have already been wiped.


    Xtremefaith
    Participant

    @xtremefaith

    So does this mean you cannot use standard WordPress First & Last name fields, that if I want them accessible on their profile I have to use the xprofile component? Seems either redundant to keep them in both or a waste to not use the WP standard fields.

    Is there not an easy easy way to modify the profile form to make standard fields visible and editable?


    Xtremefaith
    Participant

    @xtremefaith

    Any updates on this? So far this is the closes to an actual answer on this question. The documentation as expected is pretty quiet about the topic. It is very easy to add fields to the group activity form, but seems impossible to actually handler the the values posted. They don’t appear $instance variable of the bp_activity_after_save action. At the moment at a complete loss at what to do.

Viewing 5 replies - 1 through 5 (of 5 total)
Skip to toolbar