Skip to:
Content
Pages
Categories
Search
Top
Bottom

Shortcode to create Edit Profile Page

Viewing 25 replies - 1 through 25 (of 31 total)

  • Henry Wright
    Moderator

    @henrywright

    The edit form is in edit.php. You will need to add that to the page but I don’t think it will be as easy as copying and pasting because the default form processing may depend on the current URL.


    ma3ry
    Participant

    @ma3ry

    Thank you Henry. This is obviously beyond my capabilities. I appreciate you letting me know.

    Perhaps you might be able to help me with an alternative. There is a plugin called BuddyPress Redirect To Profile (on Login). It works exactly as I’d like it to work, except with Simple Membership, which happens to be the Membership plugin I’m using.

    Would you know of a way to bypass the Simple Membership plugin to make this redirect plugin work?

    Thank you.


    Henry Wright
    Moderator

    @henrywright

    Simple Membership may use a different action hook on login. I’m guessing the redirect plugin uses the standard hook provided by BuddyPress. Do you have a link to Simple Membership?


    ma3ry
    Participant

    @ma3ry

    Yes, this is their website page https://simple-membership-plugin.com

    My page is https://christiangays.com

    Thank you!


    Henry Wright
    Moderator

    @henrywright

    So on successful login it looks as though Simple Membership’s swpm_login hook runs. With the Simple Membership plugin activated, try adding this to your theme’s functions.php file:

    add_action( 'swpm_login', function( $user, $pass, $remember ) {
        if ( ! $user || is_wp_error( $user ) ) {
            return;
        }
        bp_core_redirect( bp_loggedin_user_domain() );
    } );

    Please note I haven’t tested.


    ma3ry
    Participant

    @ma3ry

    Thank you. It doesn’t work. Now mind you the redirect to profile plugin is old and may not work with WP4.2.2 so maybe that is the problem.

    Thank you for trying to help.


    Henry Wright
    Moderator

    @henrywright

    Can you try this?

    I’ve removed the $user check which was unnecessary in this case. I also didn’t add a priority or the number of args passed (but again those are unnecessary so I’ve removed them).

    add_action( 'swpm_login', function() {
        bp_core_redirect( bp_loggedin_user_domain() );
    } );

    ma3ry
    Participant

    @ma3ry

    That code prevents anyone from logging in. After submitting username and password the ball just spins and page never loads.


    ma3ry
    Participant

    @ma3ry

    Is there a way to make this link (from Sidebar Login Widget) go to BuddyPress Profile or Edit Profile

    Profile | %admin_url%/profile.php


    shanebp
    Moderator

    @shanebp

    To fix the redirect loop, try this adjustment to Henry’s code:

    add_action( 'swpm_login', function() {
        if ( bp_is_my_profile() )
          return;
        bp_core_redirect( bp_loggedin_user_domain() );
    } );
    

    ma3ry
    Participant

    @ma3ry

    Gosh I love how you folks are trying to help me. I really do appreciate it. Unfortunately this code just gives me the spinning ball too. We never get logged in.


    Paul Wong-Gibbs
    Keymaster

    @djpaul

    I’ll let those two continue to try to help, I just wanted to say I really want to investigate adding shortcodes for all BuddyPress things in some future release and have recently began to think about it. Doesn’t help you now, but might help someone in the future.


    ma3ry
    Participant

    @ma3ry

    Oh my, that would be wonderful! Thank you!


    coolukboy
    Participant

    @coolukboy

    Hey @ma3ry
    I’ll let those two keep on trying to help, I simply needed to state I truly need to explore including shortcodes for all BuddyPress things in some future discharge and have as of late pondered it. Doesn’t help you now, yet may help somebody later on.

    So here Every plugin perform their role, right? but i recommendation ARMember I have personally Experience with that plugin and it is also integrated with BuddyPress


    jameskoo
    Participant

    @jameskoo

    Mary, do you still having issue on this? I have the same issue as you. I wish everything can be automated, using simple membership login and buddy press.

    Login using simple membership plugin, then auto redirect to the buddy press profile. I suppose this should be done using some functions that can retrieve the user profile url?


    jameskoo
    Participant

    @jameskoo

    That’s a really Noble idea! May I know is this short code function available now?


    ma3ry
    Participant

    @ma3ry

    My coder gave me the following information. It works for me. If it doesn’t work for you, I’m sorry but I don’t know what to tell you. I’m not a coder.

    CUSTOM MENU SHORTCODES

    Create a simple shortcode by adding the following in child-theme’s functions.php file

    add_shortcode( 'bp_user_profile_link', 'bp_user_profile_link_shortcode');
    function bp_user_profile_link_shortcode( $atts ){
    	$atts = shortcode_atts( array(
    		'text'		=> 'Profile',
    		'target'  => ''
    	), $atts );
    	if( !is_user_logged_in() )
    		return '';
    	$target_link = bp_loggedin_user_domain();
    	switch( $atts['target'] ){
    		case 'settings' : $target_link .= 'settings/'; break;
    		case 'profile'  : $target_link .= 'profile/'; break;
    		case 'edit_profile'  : $target_link .= 'profile/edit/'; break;
    	}
    
    	return "<a href='" . $target_link . "'>" . $atts['text'] . "</a>";  }

    Now this gives you the chance to choose which profile link you want to target. So

    1) For the main member page (activity) use the following shortcode:
    [bp_user_profile_link text=”Profile” ]

    2) For the View Profile page
    [bp_user_profile_link text=”View My Profile” target=”profile”]

    3) For the Edit Profile page
    [bp_user_profile_link text=”Edit My Profile” target=”edit_profile”]

    CUSTOM MENU URL (this may be very specific to my website. I don’t know.

    Edit Profile: https://yourwebsite.com/members/–sububsername–/profile/edit/group/1/

    Hope this helps.


    jameskoo
    Participant

    @jameskoo

    Thank you really much for your reply! I will try this now!

    So is this your method?
    After adding the codes into the functions.php, you set up a page with these shortcodes.

    And you redirect the user to this page after they login?

    Thanks again.


    ma3ry
    Participant

    @ma3ry

    No, there is no redirect. It is just a link in the login box.

    See screenshot at https://prnt.sc/jdgxeq


    jameskoo
    Participant

    @jameskoo

    Oh I see, but this is a good solution too.

    May I know where do you apply these shortcodes?
    1) For the main member page (activity) use the following shortcode:
    [bp_user_profile_link text=”Profile” ]

    2) For the View Profile page
    [bp_user_profile_link text=”View My Profile” target=”profile”]

    3) For the Edit Profile page
    [bp_user_profile_link text=”Edit My Profile” target=”edit_profile”]

    As for now, I just created a functions.php in my child theme. And pasted the codes into the functions.php.


    Venutius
    Moderator

    @venutius

    I have a plugin – BP Profile Shortcodes Extra, it includes a shortcode that allows you to create a link to edit the users profile – [bpps_profile_edit_url text=”Edit Profile”] it can also create links to the users other profile pages and has many other functions.


    jameskoo
    Participant

    @jameskoo

    Hi @venutius thanks for developing this plugin. I think this should solve my issue.

    I have tried the edit profile shortcodes, and paste it in the footer widget, it do shows the url. But it doesn’t shows the gravatar like what the buddypress login widget is.

    Is the shortcodes being used in this way?


    Venutius
    Moderator

    @venutius

    I’ve added a feature to the profile_avatar_link shortcode where you can specify the profile like to use as follows:

    [bpps_profile_avatar_link profile_page=”profile/edit”]

    This will display the members avatar as a link to the edit profile page. You can also specify height and r width of the aatar to be displayed.

    Make sure you download the latest version for this.


    jameskoo
    Participant

    @jameskoo

    I have tried to reply to this topics but I am not sure why my comments are not showing up…
    Is it that I have been blocked by the forum?


    Venutius
    Moderator

    @venutius

    Not blocked as far as I’m aware, maybe you were trying to share a link that was not allowed?

Viewing 25 replies - 1 through 25 (of 31 total)
  • You must be logged in to reply to this topic.
Skip to toolbar