• karolin2226

    (@karolin2226)


    Hello,
    Thank you for your plugin, but we would’ve wanted to change a few settings.
    Actually, we don’t use the BuddyPress profile, so we would like to change the link of the buttons. Right now, the buttons “Wish Happy Birthday” are not displaying, which is also problematic.
    But we want the button “Wish Happy Birthday” to go to the user’s URL (the URL that is set in the WordPress user meta).
    How can we do that? We try to do that by ourselves but unfortunately cannot find the solution. Thank you in advance for your help.

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Prashant Singh

    (@prashantvatsh)

    Hi

    Right now, the buttons “Wish Happy Birthday” are not displaying, which is also problematic.

    Please check if the messaging component(https://prnt.sc/t3kgve) is enabled on your site or not. I have checked in the code if messaging is active only then that button will appear.

    Kind Regards

    Thread Starter karolin2226

    (@karolin2226)

    The buttons appeared, but since we don’t use the BuddyPress profile, it doesn’t lead anywhere. How can we change the button value? We need the button to redirect to the user’s URL that is set in the WordPress profile settings. Thank you in advance for your help.

    Plugin Author Prashant Singh

    (@prashantvatsh)

    Please paste the following code in the bp-custom.php file or your child theme’s functions.php file.

    function ps_filter_bp_get_button( $button_contents, $args, $button ) { 
        if($args['link_text'] == 'Wish Happy Birthday'){
            $mmbr_id = str_replace('private_message-', '', $args['id']);
            $custom_url = get_user_meta($mmbr_id, 'YOUR_FIELD_NAME',true); // If URL is not saved in user_meta then you can change this function to get user URL.
            $button_contents = '<div class="send-private-message generic-button" id="bpbp-custom-userurl"><a href='.$custom_url.' class="send-message" title="Send a private message to this user.">Wish Happy Birthday</a></div>';
        }
        return $button_contents; 
    }
    add_filter( 'bp_get_button', 'ps_filter_bp_get_button', 10, 3 ); 

    Note: YOUR_FIELD_NAME should be replaced with the exact field name.

    I hope that it will help you.

    Kind Regards

    Thread Starter karolin2226

    (@karolin2226)

    Hello,
    Thank you for your answer. We tried this snippet, but unfortunately, nothing changed. We tried to replace YOUR_FIELD_NAME with the exact field name, but we cannot see if it is the right name.
    Nothing changed. Can you please help us and tell us what field name should it be? We need user’s URL. Thank you in advance for your help.

    Plugin Author Prashant Singh

    (@prashantvatsh)

    Can you please quickly check by passing a custom URL in the custom_url variable? For example:

    $custom_url = 'wp.org';

    The rest of the code will be the same. If it is changing the button URL then that means the field name is not correct.

    Thread Starter karolin2226

    (@karolin2226)

    Unfortunately, a custom URL didn’t work. It still goes to this URL: https://littercon.com/ru/authors-2/

    Plugin Author Prashant Singh

    (@prashantvatsh)

    Not sure, what is wrong there. The code works fine for me. Can you please confirm that the button came when you enabled private messaging in BuddyPress and without using the code, that I gave, the button URL is pointing to message page?

    Thread Starter karolin2226

    (@karolin2226)

    When we enabled private messaging in BuddyPress, the button did come, but right now we checked, and the button URL without using the code goes to the link: https://littercon.com/ru/authors-2/
    But no private messaging

    Plugin Author Prashant Singh

    (@prashantvatsh)

    It looks like something else is causing the issue on your site. If you have any staging version then can you please check with only buddypress and this plugin active? Also, please activate any default theme(e.g. twentytwenty) on the staging site.

    Kind regards

    Thread Starter karolin2226

    (@karolin2226)

    Hello,
    We tried on another website with only BuddyPress and your plugin active, but unfortunately, the buttons didn’t even appear. We made sure that private messaging is active but still, no buttons. Do you have any idea why?

    Plugin Author Prashant Singh

    (@prashantvatsh)

    With the default theme(twentytwenty), and DOB field mapped in the settings? Also if there’s a birthday then only it will show the member’s avatar and the button.

    Kind regards

    Thread Starter karolin2226

    (@karolin2226)

    Yes, with the default theme and DOB field mapped in the settings. And of course, there was a birthday. The avatars were shown, but no button. And right now, on our website littercon.com, it is a user’s birthday and the button appeared, but it doesn’t lead anywhere. And the private messaging is disabled. So normally, if there is no private messaging, the button should disappear, but as you can see, it is not the case. What is the problem? Please help us solve the issue as soon as possible.

    Thread Starter karolin2226

    (@karolin2226)

    Actually, right now we tried to add a custom URL in the custom_url variable:
    $custom_url = 'littercon.com';

    And right now the button leads to the url: https://littercon.com/ru/2020/07/itogi-tshheslavie/littercon.com
    but not littercon.com

    Plugin Author Prashant Singh

    (@prashantvatsh)

    It’s showing random URLs which is my concern. It seems like there is some issue in the setup.

    On your staging site if you can try the following suggestions that will be great.

    1. Please check the .htaccess file and match it with this https://wordpress.org/support/article/htaccess/#basic-wp

    2. After checking the .htaccess file, please change your permalink to post name and save.

    3. In BuddyPress settings, please check if the private messaging feature is enabled and the date of birth field is mapped in the birthday greetings plugin settings.

    4. Please check now if there’s any birthday and how it’s showing on the staging site and what’s the link it is having on the button.

    Note: Please do the mentioned steps on the staging site so that your live site is not affected.

    Also if you are writing $custom_url = site_url(); is it still showing the custom URL at the end of the URL? Please clear cache, if any, then check.

    Kind regards

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Buttons “Wish Happy Birthday”’ is closed to new replies.