Search Results for 'buddypress'
-
Search Results
-
Topic: Registration stopped working
Been on BuddyPress for years. Just got an email from a user today that was unable to register. I tested it out and on submission I get a screen flash, then nothing. There are no errors in the dev tools console. There are no php errors logged. I’m a little stumped. I switched themes to a default 2024 theme, and the issue happens on that as well. Would appreciate any suggestions.
I created a small plugin where users can subscribe to authors, but for some reason users are not notified when the author publishes a new post. Please help to solve this problem. I checked the logs, it shows that the notification was sent, but the notification itself is not there!
<?php /* Plugin Name: Author Subscription and Notification Description: Allows users to subscribe to authors and receive notifications when authors publish new posts. Version: 1.3 Author: test */ // Hook to create the database table upon plugin activation register_activation_hook(__FILE__, 'create_subscriptions_table'); function create_subscriptions_table() { global $wpdb; $table_name = $wpdb->prefix . 'author_subscriptions'; $charset_collate = $wpdb->get_charset_collate(); $sql = "CREATE TABLE $table_name ( id bigint(20) NOT NULL AUTO_INCREMENT, user_id bigint(20) NOT NULL, author_id bigint(20) NOT NULL, PRIMARY KEY (id), UNIQUE KEY user_author (user_id, author_id) ) $charset_collate;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } // Hook to add subscription button in the post content add_filter('the_content', 'add_author_subscription_button_to_post'); function add_author_subscription_button_to_post($content) { if (is_single() && is_user_logged_in()) { $author_id = get_the_author_meta('ID'); $current_user_id = get_current_user_id(); global $wpdb; $table_name = $wpdb->prefix . 'author_subscriptions'; // Check if user is already subscribed $is_subscribed = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM $table_name WHERE user_id = %d AND author_id = %d", $current_user_id, $author_id )); $button_text = $is_subscribed ? 'Unsubscribe' : 'Subscribe'; $button_html = '<button id="subscribe-author" class="subscribe-button" data-author-id="' . esc_attr($author_id) . '">' . esc_html($button_text) . '</button>'; $button_html .= '<div id="subscription-message"></div>'; $content .= $button_html; } return $content; } // Enqueue the JavaScript file and localize script add_action('wp_enqueue_scripts', 'enqueue_subscription_script'); function enqueue_subscription_script() { if (is_single() && is_user_logged_in()) { wp_enqueue_script('subscription-script', plugin_dir_url(__FILE__) . 'subscription.js', array('jquery'), '1.0', true); wp_localize_script('subscription-script', 'subscriptionData', array( 'ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('subscription_nonce') )); } } // Handle the AJAX request for subscription add_action('wp_ajax_handle_author_subscription', 'handle_author_subscription'); function handle_author_subscription() { check_ajax_referer('subscription_nonce', 'nonce'); if (is_user_logged_in()) { global $wpdb; $table_name = $wpdb->prefix . 'author_subscriptions'; $current_user_id = get_current_user_id(); $author_id = intval($_POST['author_id']); $operation = sanitize_text_field($_POST['operation']); if ($operation === 'subscribe') { $wpdb->insert($table_name, array( 'user_id' => $current_user_id, 'author_id' => $author_id )); wp_send_json_success('Subscribed successfully.'); error_log("User ID $current_user_id subscribed to author ID $author_id"); } else if ($operation === 'unsubscribe') { $wpdb->delete($table_name, array( 'user_id' => $current_user_id, 'author_id' => $author_id )); wp_send_json_success('Unsubscribed successfully.'); error_log("User ID $current_user_id unsubscribed from author ID $author_id"); } } wp_send_json_error('Failed to update subscription.'); } // Hook to send notifications when an author publishes a new post add_action('publish_post', 'notify_subscribers_on_new_post'); function notify_subscribers_on_new_post($post_id) { global $wpdb; $table_name = $wpdb->prefix . 'author_subscriptions'; $post = get_post($post_id); $author_id = $post->post_author; error_log("New post published by author ID: " . $author_id); // Get subscribers $subscribers = $wpdb->get_results($wpdb->prepare( "SELECT user_id FROM $table_name WHERE author_id = %d", $author_id )); error_log("Subscribers found: " . count($subscribers)); foreach ($subscribers as $subscriber) { // Send BuddyPress notification bp_notifications_add_notification(array( 'user_id' => $subscriber->user_id, 'item_id' => $post_id, 'secondary_item_id' => $author_id, 'component_name' => 'buddypress', 'component_action' => 'new_post_by_subscribed_author', 'date_notified' => bp_core_current_time(), 'is_new' => true, )); error_log("Notification sent to user ID: " . $subscriber->user_id); } } // Custom notification format add_filter('bp_notifications_get_notifications_for_user', 'custom_bp_notification_format', 10, 5); function custom_bp_notification_format($content, $item_id, $secondary_item_id, $action, $component_name) { if ($component_name === 'buddypress' && $action === 'new_post_by_subscribed_author') { $author_name = get_the_author_meta('display_name', $secondary_item_id); $post_title = get_the_title($item_id); $post_url = get_permalink($item_id); $content = sprintf(__('New post by %s: <a href="%s">%s</a>', 'text-domain'), $author_name, $post_url, $post_title); } return $content; } ?>[23-May-2024 09:42:15 UTC] a:0:{} [23-May-2024 09:42:40 UTC] New post published by author ID: 1 [23-May-2024 09:42:40 UTC] Subscribers found: 2 [23-May-2024 09:42:40 UTC] Notification sent to user ID: 1 [23-May-2024 09:42:40 UTC] Notification sent to user ID: 27 [23-May-2024 09:42:43 UTC] a:0:{}Hello, Is it possible tu use subgroups, hierarchical subgroups?
I saw very old topics about this problem and i would like to know if there are any news about.
I would like to use buddypress (Version: 12.5.0) but it dipends of this problem.
I know there is a plugin but i don’t know if it’s the best solution.
https://github.com/dcavins/hierarchical-groups-for-bp
Thank you for your help.I’m trying to create a block with notifications that should be displayed using a shortcode, but for some reason I get one message (Error: Unable to retrieve notification data.) in the place of the notifications themselves. Tell me where did I mess up?
The code itself:<?php /* Plugin Name: BuddyPress Real-Time Notifications Description: Version: 1.0 Author: */ // JavaScript function bprtn_enqueue_scripts() { wp_enqueue_script('bprtn-scripts', plugin_dir_url(__FILE__) . 'scripts.js', array('jquery'), null, true); } add_action('wp_enqueue_scripts', 'bprtn_enqueue_scripts'); // CSS function bprtn_enqueue_styles() { wp_enqueue_style('bprtn-styles', plugin_dir_url(__FILE__) . 'styles.css'); } add_action('wp_enqueue_scripts', 'bprtn_enqueue_styles'); // function function bprtn_display_notification($notification) { if (isset($notification->component_name) && isset($notification->component_action) && isset($notification->item_id)) { echo '<div class="bprtn-notification">'; echo '<p class="bprtn-description">' . bp_the_notification_description($notification->component_action, $notification->item_id) . '</p>'; echo '<p class="bprtn-date">' . bp_the_notification_time_since($notification->date_notified) . '</p>'; echo '<div class="bprtn-actions">'; // buttons bp_the_notification_action_links(array('before' => '<div class="bprtn-action">', 'after' => '</div>', 'notification' => $notification)); echo '</div>'; echo '</div>'; } else { echo '<p class="bprtn-notification-error">Error: Unable to retrieve notification data.</p>'; } } // function load notifications function bprtn_load_notifications() { $user_id = bp_loggedin_user_id(); $notifications = bp_notifications_get_notifications_for_user($user_id); if (!empty($notifications)) { foreach ($notifications as $notification) { bprtn_display_notification($notification); } } else { echo '<p class="bprtn-no-notifications">No new notifications.</p>'; } } // shortcode function bprtn_notifications_shortcode() { ob_start(); bprtn_load_notifications(); return ob_get_clean(); } add_shortcode('bprtn_notifications', 'bprtn_notifications_shortcode'); // AJAX function bprtn_mark_as_read() { if (isset($_POST['notification_id'])) { $notification_id = $_POST['notification_id']; bp_notifications_mark_notifications_by_id(array($notification_id), 'read'); } wp_die(); } add_action('wp_ajax_bprtn_mark_as_read', 'bprtn_mark_as_read'); ?>This is displayed to me as I come from Germany
I am sorry to inform you that your message was not possible
be delivered to one or more recipients. It is attached below.(2a00:1450:4025:c01::1b) said: 550 5.7.1 This message does not comply with RFC 5322
compliant. There are several To headers. To reduce the amount of spam sent to
Gmail, this message has been blocked. For more information, see
Check https://support.google.com/mail/?p=RfcMessageNonCompliant and RFC 5322
Specifications 4fb4d7f45d1cf-5733c2d5aa2si13175593a12.240 – GSMTPHello everyone,
My Organisation has branches in different locations:
— Ikeja.
— Victoria Island.
— Lekki.
— Sanders Almond Road, Maryland.
and so on.These are Member Types, but I want them to be translated as “Locations”.
So I used the code below:
add_filter( 'bp_members_member_type_base', function( $base ) { // Replace custom with your desired string. return _x( 'custom', 'member type URL base', 'buddypress' ); } );to help me call them “Locations”– as what they are, as you can see here — https://prnt.sc/l0ypmQxEGzSP
2.) You will notice that in my screenshot, when I want to view members of a specific directory who belong to a specific location, it says “Viewing members of the type: Maryland”.
Now, Maryland is a location. Instead of using the word/text “Type”, I want that text to say “Location”– so that it becomes “Viewing members of the location: Maryland”.
Is there any PHP Code Snippet that can help me change that Text from “Type” to “Location” ?
Regards.
I’m experiencing issues with the password field on the registration form. While it’s not displaying a password that exists (and every time I refresh it, it updates to a different one), it displays something random for any user who finds this page. I think this is why we keep getting so many spam requests…
Is there any way to hide that field input by default?
I found another topic here regarding a different theme conflict: https://buddypress.org/support/topic/password-key-input-invisible-by-default-help/
TIAAbility to create posts within groups with tags? Then allow members of groups searchbytagtoo? Making posts in groups for buddyboss or buddypress
The administration is not a member and we do not what him to show in memberslist.
Using BuddyPress Version 12.5.0.Any idea?
Topic: Attendees with ME Calendar
We are using the M.E. Booking widget with M.E. Calendar for fitness classes. Buddypress with these plugins allows for attendees to be listed for those who has signed up for the classes. So every Tuesday there is a class and you select the date and sign up. It adds your name to the attendee list. Currently it is showing everyone for all dates all the time. They would like to have it so when you select the date it shows who has signed up for that particular date. Looking for any ideas how how to get this working.
Hi, I have been us https://github.com/r-a-y/buddypress-followers for follow feature on buddypress. i need to make to make shortcode for the followers list .Can anyone please help me with this…….
Hi,
Ive installed Buddypress and tried to create a post (as a member in Member Activity tab) but when I click on Post Update button, it just shows a red exclamation error icon with no message and the post content is not being submitted/accepted. I’ve set the Activity stream to members only.
Buddypress version: 12.4.1
Hello!
I am new to Buddypress and have been trying to integrate buddypress into an existing site (that’s almost done)
But I have been having so much trouble getting this to work properly or the way it’s supposed to..have not been able to find any of the issues in the Forum or on the community and at this point I AM GETTING VERY DISCOURAGED!!!
There needs to be a way to speak one on one with support for when people have as much trouble as I seem to be – AND I have uninstalled, Cleared by browsing data and reinstalled the plugin a few times now… and still can’t get it to work the way it’s supposed to!
I have gone to YouTube I have looked through the Forum here, I have gone to the Facebook Community – I have exhausted every way I could possibly get support and am still stuck in the same spot I have been for hours… Please help…anyone!Topic: member read only
Hello,
I use Buddypress for an intranet. I want to create an useraccount with only the possibility to read.
I tried some rolemamagement-plugins but that did not work.
After hours of trying I will ask here if anyone knows if it’s possible. Or maybe have another solution to create a read-only memneraccount.
Thanks in advance,
sincerely, Marligreetings from Amsterdam, the Netherlands
Topic: Spam Signups Despite CAPTCH
Hey guys,
I’m wondering if you can help.
I installed BB-Press & BuddyPress a few weeks ago and quickly found the need to add a CAPTCHA to stop the spam sign ups.
I installed it, and it slowed them down, but I’m still getting sign ups that are clearly fake.
Attached is a screenshot of the settings and below is a link to the website forum.
Are you able to see where they might be getting through?
Thanks,
Marc