Search Results for 'Permalink post_id'
-
Search Results
-
Hi. I have a “little problem”.
Im am using custom permalinks to the topics contents:
Example:
https://www.ggforo.com/foros/topic/%post_id%
So everything is perfect using ID post on topics URL but… when a user tries to edit the post (no WP admin, inside the topic, a normal user) is redirected to the list of forums:
I Have no idea why this is happening. I tried to search which bbpress file need to modify or something but I have no luck for the moment…
BBPress Version: 2.6.5
Wordpress Version: 5.5.1If someone could help me I would appreciate it
Regards.
Hi,
I have created a custom notification for my site when a post is published, the code used to do this is :-
// this is to add a fake component to BuddyPress. A registered component is needed to add notifications function custom_filter_notifications_get_registered_components( $component_names = array() ) { // Force $component_names to be an array if ( ! is_array( $component_names ) ) { $component_names = array(); } // Add 'custom' component to registered components array array_push( $component_names, 'publishpost' ); // Return component's with 'custom' appended return $component_names; } add_filter( 'bp_notifications_get_registered_components', 'custom_filter_notifications_get_registered_components' ); // this hooks to post creation and saves the post id function bp_custom_add_notification( $post_id, $post ) { $post = get_post( $post_id ); $author_id = $post->post_author; $blogusers = get_users( array( 'role' => 'staff' ) ); // Array of WP_User objects. foreach ( $blogusers as $user ) { bp_notifications_add_notification( array( 'user_id' => $user->id, 'item_id' => $post_id, 'component_name' => 'publishpost', 'component_action' => 'publishpost_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } } add_action( 'publish_post', 'bp_custom_add_notification', 99, 2 ); /** * Format the BuddyBar/Toolbar notifications * * @since bbPress (r5155) * * @package bbPress * * @param string $action The kind of notification being rendered * @param int $item_id The primary item id * @param int $secondary_item_id The secondary item id * @param int $total_items The total number of messaging-related notifications waiting for the user * @param string $format 'string' for BuddyBar-compatible notifications; 'array' for WP Toolbar */ function custom_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { // New custom notifications if ( 'publishpost_action' === $action ) { $post = get_post( $item_id ); $author_name = get_the_author_meta('display_name', $post->post_author); $custom_title = bp_core_get_user_displayname( $post->post_author ) . ' published a new post "' . get_the_title( $item_id ) . '"'; $custom_link = get_permalink( $post ); $custom_text = bp_core_get_user_displayname( $post->post_author ) . ' published a new post "' . get_the_title( $item_id ) . '"'; // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( 'publishpost_filter', '<a href="' . esc_url( $custom_link ) . '" title="' . esc_attr( $custom_title ) . '">' . esc_html( $custom_text ) . '</a>', $custom_text, $custom_link ); // Deprecated BuddyBar } else { $return = apply_filters( 'publishpost_filter', array( 'text' => $custom_text, 'link' => $custom_link ), $custom_link, (int) $total_items, $custom_text, $custom_title ); } return $return; } if ( 'bbp_new_reply' === $action ) { $topic_id = bbp_get_reply_topic_id( $item_id ); $topic_title = bbp_get_topic_title( $topic_id ); $topic_link = wp_nonce_url( add_query_arg( array( 'action' => 'bbp_mark_read', 'topic_id' => $topic_id ), bbp_get_reply_url( $item_id ) ), 'bbp_mark_topic_' . $topic_id ); $title_attr = __( 'Topic Replies', 'bbpress' ); if ( (int) $total_items > 1 ) { $text = sprintf( __( 'You have %d new replies', 'bbpress' ), (int) $total_items ); $filter = 'bbp_multiple_new_subscription_notification'; } else { if ( !empty( $secondary_item_id ) ) { $text = sprintf( __( 'You have %d new reply to %2$s from %3$s', 'bbpress' ), (int) $total_items, $topic_title, bp_core_get_user_displayname( $secondary_item_id ) ); } else { $text = sprintf( __( 'You have %d new reply to %s', 'bbpress' ), (int) $total_items, $topic_title ); } $filter = 'bbp_single_new_subscription_notification'; } // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( $filter, '<a href="' . esc_url( $topic_link ) . '" title="' . esc_attr( $title_attr ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $text, $topic_link ); // Deprecated BuddyBar } else { $return = apply_filters( $filter, array( 'text' => $text, 'link' => $topic_link ), $topic_link, (int) $total_items, $text, $topic_title ); } do_action( 'bbp_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items ); return $return; } } add_filter( 'bp_notifications_get_notifications_for_user', 'custom_format_buddypress_notifications', 1, 5 );
How can i create the same for a new bbpress topic? i’m thinking i need to change this code section but not sure how
// this hooks to post creation and saves the post id function bp_custom_add_notification( $post_id, $post ) { $post = get_post( $post_id ); $author_id = $post->post_author; $blogusers = get_users( array( 'role' => 'staff' ) ); // Array of WP_User objects. foreach ( $blogusers as $user ) { bp_notifications_add_notification( array( 'user_id' => $user->id, 'item_id' => $post_id, 'component_name' => 'publishpost', 'component_action' => 'publishpost_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } } add_action( 'publish_post', 'bp_custom_add_notification', 99, 2 );
I am using woffice as the theme, bbpress version 2.5.14, buddypress version 4.1.0 and the latest version of wordpress
Thanks
Hi,
I have created a custom notification for my site when a post is published, if i have buddypress activated alone i see the notification text but as soon as i activate bbpress i can no longer see the notification description. In order to work out this was happening when bbpress was activated i created a whole new blank install of wpress and only installed the two plugins and when i deactivated bbpress it showed the text.
this is how the notification shows when bbpress is activated
https://www.dropbox.com/s/uepps9cjcd8xan5/With%20BbPress%20no%20text.PNG?dl=0this is how the notification shows when bbpress is NOT activated
https://www.dropbox.com/s/03wch6bc27nsked/Without%20BbPress%20showing%20text.PNG?dl=0I am using Twenty seventeen as the theme, bbpress version 2.5.14, buddypress version 4.1.0 and the latest version of wordpress
The code i have used to generate the notification is below, and this is located in \wp-content\plugins\bp-custom.php
<?php // this is to add a fake component to BuddyPress. A registered component is needed to add notifications function custom_filter_notifications_get_registered_components( $component_names = array() ) { // Force $component_names to be an array if ( ! is_array( $component_names ) ) { $component_names = array(); } // Add 'custom' component to registered components array array_push( $component_names, 'publishpost' ); // Return component's with 'custom' appended return $component_names; } add_filter( 'bp_notifications_get_registered_components', 'custom_filter_notifications_get_registered_components' ); // this hooks to post creation and saves the post id function bp_custom_add_notification( $post_id, $post ) { $post = get_post( $post_id ); $author_id = $post->post_author; bp_notifications_add_notification( array( 'user_id' => $author_id, 'item_id' => $post_id, 'component_name' => 'publishpost', 'component_action' => 'publishpost_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } add_action( 'publish_post', 'bp_custom_add_notification', 99, 2 ); function custom_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { // New custom notifications if ( 'publishpost_action' === $action ) { $post = get_post( $item_id ); $custom_title = $post->post_author . ' published a new post ' . get_the_title( $item_id ); $custom_link = get_permalink( $post ); $custom_text = $post->post_author . ' published a new post ' . get_the_title( $item_id ); // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( 'publishpost_filter', '<a href="' . esc_url( $custom_link ) . '" title="' . esc_attr( $custom_title ) . '">' . esc_html( $custom_text ) . '</a>', $custom_text, $custom_link ); // Deprecated BuddyBar } else { $return = apply_filters( 'publishpost_filter', array( 'text' => $custom_text, 'link' => $custom_link ), $custom_link, (int) $total_items, $custom_text, $custom_title ); } return $return; } } add_filter( 'bp_notifications_get_notifications_for_user', 'custom_format_buddypress_notifications', 10, 5 );
I need to get it so that when bbpress is activated i can see the custom notification description as we use bbpress for our forums
Hi,
I’ve been struggling with a serious import problem since may 2016.
Issue #1 My BBpress forums will not migrate properly with conventional WordPress import/export built in tool.
Issue #2 When I use WP ALL Import (pro bundle) to get a CSV I can actually work with, and manually update the USER ID table and Forum ID and Parent ID, the import works (Forums and Topics are matched up properly) but tool>BBpress>recaculate will completely break the forum, I need to be able to recalculate once in a while… not being able to do this is a problem. And even to get the imports working I have to manually change IDs in the CSVs in order for the imports to match content up properly. And even when using vlookup in Excel, it is painstakingly difficult to manually create a dual reference column where column one is the old ID (for old website forum) and column two is the new ID (for new website forum). This is why I don’t have a fixed CSV for replies yet. I’ve thousands of them.Authors of WP ALL Import have been of no substantial help. Please any help because I’ve been paying for my old server and new server for months now and it’s gotten very expensive.
Data columns including in Forum Export is:
id Title Content Post Type Date Order Parent Slug Author Status _bbp_status _bbp_old_forum_id _bbp_forum_parent_id _bbp_forum_subforum_count _bbp_topic_count_hidden _vc_post_settings _bbp_status _yoast_wpseo_title _bbp_forum_id _bbp_last_topic_id _bbp_last_reply_id _bbp_last_active_id _bbp_last_active_time _bbp_topic_count _bbp_total_topic_count _bbp_reply_count _bbp_total_reply_count
Data columns included in Topic Export is:
"id Title Content Date Post Type Permalink _bbp_old_topic_id _bbp_reply_count _bbp_total_reply_count _bbp_author_ip _bbp_old_sticky_status _bbp_topic_id _bbp_forum_id _bbp_last_reply_id _bbp_last_active_id _bbp_last_active_time _bbp_voice_count _vc_post_settings vc_teaser Status Author Slug Order Parent Comment Status"
Data columns included in Replies Export is:
id Content Date Post Type Permalink Status Author Slug Parent Order Comment Status Ping Status _bbp_post_id _bbp_author_ip _vc_post_settings _bbp_activity_id _bbp_topic_id _bbp_forum_id
For Forum’s I updated Author IDs.
For Topic’s I updated Author IDs, Parent, and _bbp_forum_idAfter a successful import for these two post types,
bbpress recalculate will completely break the posts’ hierarchy.I’ve yet to find a way to get replies to import successfully due to the shear number of replies and _bbp_topic_id’s I’d have to update the new IDs for.
I changed the permalinks in wordpress->dashboard->settting->permalinks to:
/%year%/%monthnum%/%day%/%post_id%.htmlhowever, it doesn’t impact the forum at all! the link of topics in the forum are still shown as the title of the topic (I’m setting up a Chinese forum, the title of the topics would become some escaped characters).
I am currently experiencing a padding issue with mini avatar icon displays. For example, on the last post author among other things:
[IMG]http://i.imgur.com/YYBQoHX.png[/IMG]
I am using a custom avatar plugin and it seems users with blank avatars don’t have this padding issue. I have checked CSS and can’t seem to find where to mess with this padding or anything that seems to work.
I am also using this code in my loop-single-forum file to display the topic title under the last post time
<?php do_action( 'bbp_theme_before_topic_author' ); ?> <div class="bbp-forum-last-topic-name"><a href="<?php bbp_forum_last_topic_permalink(); ?>" title="<?php bbp_forum_last_topic_title(); ?>"><?php bbp_forum_last_topic_title(); ?></a></div> <?php do_action( 'bbp_theme_before_topic_author' ); ?> <span class="bbp-topic-freshness-author"><?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'size' => 14 ) ); ?></span> <?php do_action( 'bbp_theme_after_topic_author' ); ?>
My site:
http://the-divine.net/forumUse WordPress + bbpress , Permalink set to /%post_id% ,but still not work !!!
Damn ,this BUG is two years ago >:-[
I install worpdress and bbpress , and set Permalink to /%post_id% .
But not work ,Help ! I want use post_id in post.