Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 6,376 through 6,400 (of 32,519 total)
  • Author
    Search Results
  • Kineta
    Participant

    Here you go. I have this in my theme’s functions.php file. I posted this code a while ago, but there was a small mistake which is fixed here.

    function jpr_buddypress_add_notification( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $author_id = 0, $is_edit = false, $reply_to = 0 ) {
    	
    		
    		// this is who the notification goes to. whose post is replied to
    		$topic_author_id = bbp_get_topic_author_id( $reply_to );
    
    		// Bail if somehow this is hooked to an edit action
    		if ( !empty( $is_edit ) ) {
    			return;
    		}
    
    		// Get author information
    		// $topic_author_id   = bp_loggedin_user_id();
    		$secondary_item_id = $author_id;
    
    		// Hierarchical replies
    		if ( !empty( $reply_to ) ) {			
    			$reply_to_item_id = bbp_get_topic_author_id( $reply_to );
    			// if not replying to OP:
    			$topic_id = $reply_to;
    		}		
    
    		
    		// Get some reply information
    		$args = array(
    			'user_id'          => $topic_author_id,
    			'item_id'          => $topic_id,
    			'component_name'   => bbp_get_component_name(),
    			'component_action' => 'bbp_new_reply',
    			'date_notified'    => get_post( $reply_id )->post_date_gmt,
    		);
    	 	
    		// Notify the topic author if not the current reply author
    	 	if ( $author_id !== $topic_author_id ) {
    			$args['secondary_item_id'] = $secondary_item_id ;
    
    			bp_notifications_add_notification( $args );
    	 	}
    	 	// Notify the immediate reply author if not the current reply author
    	 	if ( !empty( $reply_to ) && ( $author_id !== $reply_to_item_id ) ) {
    			$args['secondary_item_id'] = $secondary_item_id;
    			
    			bp_notifications_add_notification( $args );
    	 }
    }
    // remove the bbpress notification function so we don't get dupicate notifications
    remove_action( 'bbp_new_reply', 'bbp_buddypress_add_notification', 10, 7 );
    add_action( 'bbp_new_reply', 'jpr_buddypress_add_notification', 10, 7 );
    
    // remove the bbpress format notification function before using our custom function
    remove_filter( 'bp_notifications_get_notifications_for_user', 'bbp_format_buddypress_notifications', 10, 5 );
    
    function jpr_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    
    	// New reply notifications
    	if ( 'bbp_new_reply' === $action ) {
    		$topic_id    = bbp_get_reply_id( $item_id );
    		$topic_title = bbp_get_reply_title( $item_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( 'jpr_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items );
    
    		return $return;
    	}
    }
    add_filter( 'bp_notifications_get_notifications_for_user', 'jpr_format_buddypress_notifications', 10, 5 );
    
    
    #175125
    alzaran
    Participant

    So Buddypress, by default, has a nifty @function that allows you to look up users by username. As I understand it, bbpress works with this out of the box, in the reply boxes. However, when I enable TinyMCE using the tutorial above (https://codex.bbpress.org/enable-visual-editor/), Buddypress autocomplete goes away completely. We’d rather not have to choose between these two features, is there a way to restore autocomplete even with TinyMCE enabled?

    #175120
    Digital Arm
    Participant

    After upgrading to PHP 5.5 and running a compatibility test on a site, it has flagged the use of a deprecated modifier being used in preg_replace functions.
    These occur on lines 1149 and 1150 in file /includes/admin/parser.php

    1149 | ERROR | preg_replace() – /e modifier is deprecated in PHP 5.5
    1150 | ERROR | preg_replace() – /e modifier is deprecated in PHP 5.5

    Could you please let me know the best way to replace the code with the preg_replace_callback function and let me know if this is likely to be updated in a future patch as this can be seen as a security concern.

    Thank you

    #175115
    dawidadach
    Participant

    Hi guys,

    for some reason , in our bbpress forum (http://mdbootstrap.com/forums/forum/support/) code tag doesnt work . Regardless whether we use it or not all HTML markups are executed instead of displayed. The only way to display it is to replace all <> with &gt and &lt

    Any idea?

    Robin W
    Moderator

    try the shortcodes in my style pack

    [bsp-display-topic-index show=’5′]

    https://wordpress.org/plugins/bbp-style-pack/

    Schoelje
    Participant

    Note: else if should be elseif.
    It still works, though.

    How do I set this topic to resolved?

    Schoelje
    Participant

    It took some time to make this topic visible on the forum. So, I’ve solved my own problem.

    Instead of writing an htacces file I chose to write an alternative viewtopic.php script that collects the appropriate new bbPress URL from the database.

    If your new bbPress forum is online, you place the following script in your old phpBB domain and save it as viewtopic.php (exactly where the old viewtopic.php used to be located) and don’t forget to replace the “my_xxxx” values with your information:

    <?php
      // If all else fails, use this url.
      $defaulturl = "http://my_domain/forums/";
      
      // Your new bbPress database credentials.
      $host = "my_host";
      $db = "my_database";
      $dbuser ="my_database_user";
      $userpwd = "my_database_user_password";
      
      // Build the query according to url parameters p or t.
      $query = '';
      if (!empty($_GET['p'])) {
          $query = "SELECT xkcom_posts.guid FROM xkcom_postmeta 
                    INNER JOIN xkcom_posts ON xkcom_posts.ID = xkcom_postmeta.post_id 
                    WHERE xkcom_postmeta.meta_key = '_bbp_old_reply_id' 
                    AND xkcom_postmeta.meta_value = '" . $_GET['p'] . "';";
      }else if (!empty($_GET['t'])) {
          $query = "SELECT xkcom_posts.guid FROM xkcom_postmeta 
                    INNER JOIN xkcom_posts ON xkcom_posts.ID = xkcom_postmeta.post_id 
                    WHERE xkcom_postmeta.meta_key = '_bbp_old_topic_id' 
                    AND xkcom_postmeta.meta_value = '" . $_GET['t'] . "';";
      }
      
      // Set the new url to the default url
      $url = $defaulturl;
      
      // Check if we need to make a database connection.
      if (!empty($query)) {
        // Make a connection
        $mysqli = new mysqli($host, $dbuser, $userpwd, $db);
        
        // Check the connection.
        if (!$mysqli->connect_errno) {
          // Run the query.
          $result = $mysqli->query($query);
          
          // Get the new URL.
          if ($result) {
    	$row = $result->fetch_array(MYSQLI_ASSOC);
    	$guid = trim($row["guid"]);
    	if (!empty($guid)) {
    	  $url = $guid;
    	}
          }
    
          // Free the result set.
          $result->free();
    
          // Close the connection.
          $mysqli->close();
        }
      }
      
      //var_dump($url);
      
      // Write the header.
      header("Location: " . $url, true, 301);
    ?>
    #175105

    Topic: Global Access

    in forum Installation
    sharmavishal
    Participant

    Hi @johnjamesjacoby

    the codex mentions this for Allow Global Access
    In a WordPress Multisite install bbPress is activated on individual sites. Allowing global access will permit all users from across the network to post topics and replies on the forums for this particular site.

    i activated bbpress per site on my 3 network sites. still i dont see any setings for global access? does global access happen by default?

    Also is there some similar setting for bbpress like buddypress’s define(‘BP_ENABLE_MULTIBLOG’, true);?

    i got define(‘BP_ENABLE_MULTIBLOG’, true); enabled for my wp+bp multinetwork. But forums on the root site dont show up on the sub sites like groups/members do with that setting enabled.

    Thanks in advance.

    #175102
    u_Oi
    Participant

    Thanks @Casiepa

    But I don’t want count the replies, I just wanna add a Label to Topics with 0 replies, and hide it if somebody reply the topic.

    I found the info here:

    24. Show status labels for bbPress Topics

    Any other suggestion?

    I think the label (no replies) should be on the documentation by default.

    ropyro
    Participant

    Hello,

    I have a forum currently set up for our organization. I am using some fellow employees to test it but it looks like people are able to go in and make posts for our blog (saved but not published in the Contributor, Participant roles). I don’t want that. Users should only be able to post to our website forum, and nothing else. Is there a line of code that I’m missing for this?

    I would also like to know if there is a way to mask being able to see one another user’s posting stats. TIA!

    website is creatingourcommonwealth.org. Our WordPress template is Ribosome, if that helps any.

    Schoelje
    Participant

    I’ve successfully imported phpBB data into bbPress. Now, I’d like to redirect URLs like
    http://my_phpbb_domain.com/viewtopic.php?f=1&t=2
    to:
    http://my_wordpress_domain.com/forums/topic/corresponding_topic/

    I’ve search the web and have been experimenting with several solutions but without any luck. Anything I do throws a 404.

    These are some of the links I tried out:

    Rewriting URLs

    Redirection to new bbPress board?

    As you can see, these topics are at least 7 years old. On the other hand, I don’t expect that something has changed on how to write redirects in an htaccess file.

    Does somebody here has some experience with this?

    #175070
    nemoclown
    Participant

    Ok Update: I did the Short code for creating forums… I added a Page, then input the shortcode into it, And plugged that page into a menu as a sub option as you can unfortunately view at my website Gamingcommunity.us . I limited the function of the shortcode to be used only by moderators and keymasters, But how do I hide the visibility of the menu’d sub page to anyone who doesn’t have the permission to use it?

    #175069
    pcpro178
    Participant

    Are there shortcodes for getting a member/user’s recent posts or comments? I don’t see anything like this in the documentation. It seems like a rather basic thing to have with a bulletin board or forum.

    wdppoppe81
    Participant

    Hi All,

    After configuring the importing form and clicking the start button, a failure message appears after amount of time;

    Unknown column 'forums.forum_topics' in 'field list'
    

    After clicking again on the start button only the reactions will be converted from phpBB to bbpress.

    How can I import the topics and users properly, without encounter these failures?

    Grtz.

    Willem

    #175030
    semperaye
    Participant

    Is there a way to allow bbpress users with the “participant” role to upload media by url only, i.e. disable the media library. I want my users to be able to put pictures into their post that are hosted other places without having to figure codes and such.

    Thank you!

    #175026

    In reply to: Topic Header Space

    argburs14
    Participant

    I meant ading some &nbsp;

    AngryGerman
    Participant

    I’m currently developing a WP (4.5.2) site with the bbPress plug-in (2.5.9).

    I have various standard WP pages and posts (e.g. About (slug: about) and Help (slug: help)) on the site.

    The forum runs under the forums root slug.

    When creating a forum or topic, for example, whose slug is the same as that of an existing page, trying to display that forum/topic fails with a 404 error.

    For example, creating a forum with the name “About” (slug: about) leads to the (correct) bbPress URL /forums/forum/about/. However, trying to display that forum at that specific URL fails with a 404 error, apparently because a page with the URL/slug /about/ already exists for a WP page.

    This only seems to happen when a page/post/etc. exists that has such a “conflicting” slug, which is still puzzling because the bbPress forum has its own root slug/URL path /forums/, which should prevent such conflicts.

    Renaming the forum slug manually to something like aboutx fixes the issue, and the forum is then accessible just fine under /forums/forum/aboutx/. (This is obviously not a solution, but illustrates that there must be some sort of slug conflict.)

    1. Is this a known issue, or what could the problem be?
    2. Alternatively, is there a way to automatically append a (e.g. random) string to any bbPress forum/topic/post slug to prevent something like this?

    #175021
    littlemisslanna
    Participant

    So right now I am using Gravity Forms with the Sticky List plugin to create an editable database people can submit information to. I have a hidden field that automatically populates the username of the submitter, which is cool and what I want. But I would like that username in question to link to that user’s BuddyPress profile.

    I have a feeling it has to do with some PHP code, but I’m not savvy with php as I’d like to be. This is what I have so far, from a previous topic I found on the forum.

    
    add_filter( 'gform_field_value_linkuser', 'link_username' );
    
    <?php
    add_filter( 'gform_field_value_linkuser', 'link_username' );
    function link_username($user_login) {
       return '$_COOKIE['utm_campaign']; < NO idea what to return here! 
    }
    ?>
    

    I assume the return value should be something like <a href="URL.com/members/[USERNAME]">Username </a>, but I don’t know how to make that work in PHP!

    Please help me out! BBP Version is 2.5.9, WP version is most recent one, Gravity Forms 1.9.19, Gravity Forms Sticky List plugin 1.4.1.

    Thank you!

    #175009
    Andrew Tibbetts
    Participant

    I can create a topic fine ( and hook into bbp_new_topic ) but when I try to save changes to an existing topic ( change title, description, sticky, etc ) it doesn’t retain the changes ( and bbp_edit_topic never fires ). It redirects to the topic where bbp_template_notices spits out ERROR: Forum ID is missing. Anyone experience this / have any ideas what’s going on?

    WP: 4.5.2
    BP: 2.5.2
    BBP: 2.5.9

    #175005

    Topic: Strip HTML

    in forum Showcase
    Presskopp
    Participant

    Hi there,

    if you please could tell me how to strip out any HTML Code before a post is saved to the db. I tried to make a little plugin, but I don’t get behind it at this point. See working draft on

    http://pastebin.com/5JgFKd0V

    Thank you very much!

    #175001

    In reply to: Undefined Variables

    Robkk
    Moderator

    For the first error, contact the GD bbPress Toolbox plugin support team.

    For the second error, read this https://codex.bbpress.org/bbp_setup_current_user/was-called-incorrectly/

    #175000

    In reply to: Undefined Variables

    WPnolanbretigne
    Participant

    Followup: Found this message using page source:

    <b>Notice</b>: bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in <b>/var/www/html/wordpress/wp-includes/functions.php</b> on line <b>3897</b><br />
    <!DOCTYPE html>

    #174993
    karaokelove
    Participant

    Hi, I’m creating a forum where people can post links to their Twitch streams for other users to rate. I want to add specific input fields, such as Embed Code, games streamed, active times, etc, that the user can fill in to populate the post. Is there a way to do this?

    Also, is it possible to add another field to the main list of topics, other than Voices, Posts, and Freshness? I have a good rating plugin installed, and I have it integrated with bbPress to allow and show ratings inside the topic. But I’d like users to be able to see and sort topics by rating.

    Thanks in advance!

    #174985
    Robin W
    Moderator

    bbpress has various widgets and well as shortcodes, so you can call it from pages, posts and sidebars

    check out the documentation !

    Kineta
    Participant

    @robin-w Thanks Robin. I still need to use the loop-single-reply as it is, what I’m trying to do is call an additional custom loop that also threads. (I’m putting an index of linked post titles above the threaded replies. Example on my test site: http://jpr-test.com/boards/topic/lets-make-a-giant-thread/ )

    The solution I came up with isn’t very elegant, but it works. I ended up creating a copy of the BBP_Walker_Reply class with a different name, just to direct it to a different loop. Seems like a lot of duplicated code to change one line. But I can’t think of any other way to do it.

Viewing 25 results - 6,376 through 6,400 (of 32,519 total)
Skip to toolbar