Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,626 through 5,650 (of 32,505 total)
  • Author
    Search Results
  • #180329
    Robin W
    Moderator

    ok, I’ve found a link to some code that doesn’t entirely make sense yet, but gives me some clues, but I’ll do some more digging over the next few days.

    #180328

    In reply to: Random Topic Link

    Stephen Edgar
    Keymaster

    @ johnskennedy You’re spot on, creating 8 functions is one way to do that, you’d need to make sure that each function name is unique.

    That said, the above is one way, another way is to use some conditional logic with some if/else statements which is a little trickier, possibly more fun though to update the function in this way even 😉

    See these codex docs for sme very initial hints:
    https://codex.wordpress.org/Conditional_Tags
    https://codex.bbpress.org/bbpress-conditional-tags/

    #180319
    davemiller58
    Participant

    I have the same problem as you – the shortcodes don’t work.

    I did what you said here – reset the forums – but no change – the same problem.

    Still not working …

    #180318

    In reply to: Random Topic Link

    johnskennedy
    Participant

    I have used Stephen’s code above and it works perfectly.

    However, I have 8 forums on my site so if I wanted to add a random button for each separate forum that only selects topics from that forum would I have to create 8 different function ntwb_bbpress_random_single_topic() in my .php and include only a single forum ID every time or is there a better way to implement this? Also, how and where would I add the shortcodes so that they only show on the relevant forum?

    #180317
    davemiller58
    Participant

    Am using:

    Twentythirteen wordpress theme

    bbPress – Version 2.5.12

    With bbPress I have created a number of forums

    But – when I put the following short code into a page:
    [bbp-forum-index]

    it shows nothing …

    Please – what am I doing wrong?

    #180313
    casamia743
    Participant

    I have same problem. Here is my error log

    [06-Jan-2017 10:47:16 UTC] PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/bbpress/includes/forums/functions.php:1800
    Stack trace:
    #0 /Applications/MAMP/htdocs/wordpress/wp-includes/class-wp-hook.php(298): bbp_pre_get_posts_normalize_forum_visibility(Object(WP_Query))
    #1 /Applications/MAMP/htdocs/wordpress/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
    #2 /Applications/MAMP/htdocs/wordpress/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
    #3 /Applications/MAMP/htdocs/wordpress/wp-includes/class-wp-query.php(1681): do_action_ref_array('pre_get_posts', Array)
    #4 /Applications/MAMP/htdocs/wordpress/wp-includes/class-wp-query.php(3238): WP_Query->get_posts()
    #5 /Applications/MAMP/htdocs/wordpress/wp-includes/class-wp.php(617): WP_Query->query(Array)
    #6 /Applications/MAMP/htdocs/wordpress/wp-includes/class-wp.php(735): WP->query_posts()
    #7 /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php(955): WP->main(Array)
    #8 /Applications/MAMP/htdoc in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/bbpress/includes/forums/functions.php on line 1800
    #180306
    Wilbur
    Participant

    Thanks. I tried http://MY_SITE.COM/wp-json/wp/v2/posts?filter[type]=topic and http://MY_SITE.COM/wp-json/wp/v2/posts?filter[type]=forum but the filter appeared not to work as blog posts was returned. Please not that I have already installed the plugin.

    #180305
    mth75
    Participant

    Hi all,

    I added an easy New Topic button (after reading a lot of other possible solutions):

    New Topic button

    Add to your loop-topics.php template (before the actual loop):

    <?php if (!is_user_logged_in() ) :?>
    <?php else : ?>
    <div class="new-topic">
    	<input type="submit" name="submit" value="New Topic"  onclick="location.href='#new-post';">
    </div>
    <?php endif; ?>

    Add some css for styling when needed:

    .new-topic {  
    	position: relative;
    	z-index:1;
    	float: right;
    }

    Regards,

    Marc

    mth75
    Participant

    Hi all,

    I’m trying to integrate the BuddyPress favorite (aka like system) system with BBPress.

    On my site: http://www.starry-night.nl I use the BuddyPress Activity page as homepage, this means that forum topics and replies are
    shown on the activity wall, and can be liked.

    SN Activity (Home) Page

    For easy navigation I made a custom “comment” button which links to the BBPress topic or reply. BBPress activity items (topics or replies)
    can be liked.

    Going to a forum topic of replies of course doesn’t show any likes in the BBPress topic and replies.

    SN Topic/Replies

    Integrating the BuddyPress favorite system with BBPress is at least in my mind the cleanest way and from a functionality point of view, the way
    to go.

    On the BuddyPress forum I found the following code (below) which implements the BuddyPress favorite button in blogpost (and this works), so a rewrite
    should be possible to make this work for BBPress.

    In single.php for blogpost and in the future in the loop-single-reply.php for BBPress.

    <?php echo get_fav_or_unfav_button_for_post( $post ); ?>

    In function.php:

    / Buddypress favorites
    function get_fav_or_unfav_button_for_post( $post ) {
    global $bp, $activities_template;
            // user is not logged ? Show nothing.
    	if ( ! is_user_logged_in() ) {
    	return '';
    	}
    	
    	$activity_id = bp_activity_get_activity_id( array(
    		'user_id' => $post->post_author,
    		'type' => 'new_blog_post',
    		'component' => 'blogs',
    		'item_id' => 1,
    		'secondary_item_id' => $post->ID
    		) );
    	
    	if ( ! $activity_id ) {
    	return '';
    	}
    	
    		bp_has_activities(); // update $activities_template of user's fav
    		$old_value = false;
    		
    		if ( isset( $activities_template->activity->id ) ) {
    		$old_value = $activities_template->activity->id;
    		$activities_template->activity->id = $activity_id;
    		} else {
    		$activities_template->activity = (object) array( 'id' => $activity_id );
    		}
    	
    		// building the template
    	$code = '';
    	$code .= '<div class="activity-meta">'."\n";
    
    		if ( ! bp_get_activity_is_favorite() ) {
    		// if not favorited, add a fav button
    		$code .= ' <a href="'.bp_get_activity_favorite_link( ).'" class="button fav bp-secondary-action" title="'.__( 'Like', 'buddypress' ).'">'.__( 'Like', 'buddyboss' ).'</a>'."\n";
    		
    		} else {
    		
    		// if already favorited, a button to unfav
    		$code .= ' <a href="'.bp_get_activity_unfavorite_link( ).'" class="button unfav bp-secondary-action" title="'.__( 'Unlike', 'buddypress' ).'">'.__( 'Unlike', 'buddyboss' ).'</a>'."\n";
    		
    		// bonus button to show user's all favs
    		$code .= ' <a href="'.bp_loggedin_user_domain() . 'activity/favorites/" class="button unfav bp-secondary-action">'.__( 'My Likes', 'buddyboss' ).'</a>'."\n";
    		}
    		
    		// closing .activity-meta
    	$code .= '</div>'."\n"; 
    
    		if ( false !== $old_value ) {
    		$activities_template->activity->id = $old_value;
    		} else {
    		$activities_template->activity = null;
    		}
    	return $code;
    }

    I’m having problems with rewriting the array for bbpress:

    $activity_id = bp_activity_get_activity_id( array(
    		'user_id' => $post->post_author,
    		'type' => 'new_blog_post',
    		'component' => 'blogs',
    		'item_id' => 1,
    		'secondary_item_id' => $post->ID
    		) );

    Help for figuring this one out is appreciated.

    Best regards,

    Marc

    #180299
    aaronbennett2097
    Participant

    I’d like to display a list of the last 5 topics the logged in user has contributed to, either by starting the topic, or replying to it.

    This is to go on a summary page for the user, so can either be shortcode or by creating a tepmplate.

    Any ideas would be appreciated.

    #180298
    roquec
    Participant

    Dear Friends,

    I’m using WP 4.7 and bbPress 2.5.12. I’m using the importer under Tools->Forums->Import forums to import a MyBB Forum (version 1.6), with 4000 topics, 50.000 messages, and 3000 users.

    The performance is Ok, it takes two hours more or less. The problem, is that at certain point, the message Conversion complete is displayed, and certainly, the users / topics count is the right one. And then, without my interaction, it starts again.

    I’m not sure if this “second pass” is the normal procedure, or it is an error.

    Any help would be very appreciate.

    That’s the output of my last attempt

    Calculating forum hierarchy (0 - 999)Converting forums (0 - 999)Delete users WordPress default passwords (5000 - 5999)Delete users WordPress default passwords (4000 - 4999)Delete users WordPress default passwords (3000 - 3999)Delete users WordPress default passwords (2000 - 2999)Delete users WordPress default passwords (1000 - 1999)Delete users WordPress default passwords (0 - 999)Converting users (2000 - 2999)Converting users (1000 - 1999)Converting users (0 - 999)<strong>Conversion Complete</strong>No reply_to parents to convertConverting replies (3000 - 3999)Converting replies (2000 - 2999)Converting replies (1000 - 1999)Converting replies (0 - 999)No tags to convertNo super stickies to stickCalculating topic stickies (0 - 999)Converting topics (51000 - 51999)Converting topics (50000 - 50999)Converting topics (49000 - 49999)Converting topics (48000 - 48999)Converting topics (47000 - 47999)Converting topics (46000 - 46999)Converting topics (45000 - 45999)Converting topics (44000 - 44999)Converting topics (43000 - 43999)Converting topics (42000 - 42999)Converting topics (41000 - 41999)Converting topics (40000 - 40999)Converting topics (39000 - 39999)Converting topics (38000 - 38999)Converting topics (37000 - 37999)Converting topics (36000 - 36999)Converting topics (35000 - 35999)Converting topics (34000 - 34999)Converting topics (33000 - 33999)Converting topics (32000 - 32999)Converting topics (31000 - 31999)Converting topics (30000 - 30999)Converting topics (29000 - 29999)Converting topics (28000 - 28999)Converting topics (27000 - 27999)Converting topics (26000 - 26999)Converting topics (25000 - 25999)Converting topics (24000 - 24999)Converting topics (23000 - 23999)Converting topics (22000 - 22999)Converting topics (21000 - 21999)Converting topics (20000 - 20999)Converting topics (19000 - 19999)Converting topics (18000 - 18999)Converting topics (17000 - 17999)Converting topics (16000 - 16999)Converting topics (15000 - 15999)Converting topics (14000 - 14999)Converting topics (13000 - 13999)Converting topics (12000 - 12999)Converting topics (11000 - 11999)Converting topics (10000 - 10999)Converting topics (9000 - 9999)Converting topics (8000 - 8999)Converting topics (7000 - 7999)Converting topics (6000 - 6999)Converting topics (5000 - 5999)Converting topics (4000 - 4999)Converting topics (3000 - 3999)Converting topics (2000 - 2999)Converting topics (1000 - 1999)Converting topics (0 - 999)Calculating forum hierarchy (0 - 999)Converting forums (0 - 999)Delete users WordPress default passwords (2000 - 2999)Delete users WordPress default passwords (1000 - 1999)Delete users WordPress default passwords (0 - 999)Converting users (2000 - 2999)Converting users (1000 - 1999)Converting users (0 - 999)Starting Conversion

    #180279
    mth75
    Participant

    The trick is to relate the activity ID to the Post ID of the forum topic or reply. This code (used for liking (aka favouriting) ) blogpost works. I’m trying to rewrite it for bbpress

    In single.php:

    <?php echo get_fav_or_unfav_button_for_post( $post ); ?>

    In function.php:

    // Buddypress favorites
    function get_fav_or_unfav_button_for_post( $post ) {
    global $bp, $activities_template;
            // user is not logged ? Show nothing.
    	if ( ! is_user_logged_in() ) {
    	return '';
    	}
    	
    	$activity_id = bp_activity_get_activity_id( array(
    		'user_id' => $post->post_author,
    		'type' => 'new_blog_post',
    		'component' => 'blogs',
    		'item_id' => 1,
    		'secondary_item_id' => $post->ID
    		) );
    	
    	if ( ! $activity_id ) {
    	return '';
    	}
    	
    		bp_has_activities(); // update $activities_template of user's fav
    		$old_value = false;
    		
    		if ( isset( $activities_template->activity->id ) ) {
    		$old_value = $activities_template->activity->id;
    		$activities_template->activity->id = $activity_id;
    		} else {
    		$activities_template->activity = (object) array( 'id' => $activity_id );
    		}
    	
    		// building the template
    	$code = '';
    	$code .= '<div class="activity-meta">'."\n";
    
    		if ( ! bp_get_activity_is_favorite() ) {
    		// if not favorited, add a fav button
    		$code .= ' <a href="'.bp_get_activity_favorite_link( ).'" class="button fav bp-secondary-action" title="'.__( 'Like', 'buddypress' ).'">'.__( 'Like', 'buddyboss' ).'</a>'."\n";
    		
    		} else {
    		
    		// if already favorited, a button to unfav
    		$code .= ' <a href="'.bp_get_activity_unfavorite_link( ).'" class="button unfav bp-secondary-action" title="'.__( 'Unlike', 'buddypress' ).'">'.__( 'Unlike', 'buddyboss' ).'</a>'."\n";
    		
    		// bonus button to show user's all favs
    		$code .= ' <a href="'.bp_loggedin_user_domain() . 'activity/favorites/" class="button unfav bp-secondary-action">'.__( 'My Likes', 'buddyboss' ).'</a>'."\n";
    		}
    		
    		// closing .activity-meta
    	$code .= '</div>'."\n"; 
    
    		if ( false !== $old_value ) {
    		$activities_template->activity->id = $old_value;
    		} else {
    		$activities_template->activity = null;
    		}
    	return $code;
    }
    #180267

    In reply to: Unassigned Topics

    Scordisian
    Participant

    I fixed it, here is for future reference:

    UPDATE wpxn_posts SET post_parent=3270 WHERE post_type=’topic’;

    TheDream18
    Participant

    Hello,

    I’m not good at code. Can you please step by step what to do?

    I added following code to function.php childe-theme, it leaved me a blank page.

    <span class=”bbp-last-post-by-author”><?php printf( __( ‘Last Post: %1$s’, ‘bbpress’ ),bbp_get_topic_freshness_link( array() ) ); ?></span>
    <?php _e(‘ by ‘, ‘bbp’); ?>
    <span class=”bbp-topic-freshness-author”><?php bbp_author_link( array( ‘post_id’ => bbp_get_topic_last_active_id(), ‘size’ => 14 ) ); ?></span>

    #180256
    TKServer
    Participant

    I’m trying to make my own nested threaded replies. Right now all the replies appear in my page, but there’s no organization to them. Is the $args method the way to go or do I need to make my own custom sql statement? I’ve got all the data in the args below, but the sort isn’t nested. Not sure how do do that.

    
    				$args = array(
    					'post_type' 		=> 'reply', // custom post type
    					'posts_per_page'    => '50',
    					'orderby' 		=> 'post_parent',
    					'post_parent' 		=> $topic_id,
    
    				     'meta_query' => array(
    				         'relation' => 'OR',
    					     array(
    					 	   'key'=> $topic_id,
    					    ),
    					    array(
    						   'key'=>'_bbp_reply_to',
    						   'compare' => 'NOT EXISTS'
    					   ),
    				         array(
    				             'key'=>'_bbp_reply_to',
    				             'compare' => 'EXISTS',
    				         ),
    				     ),
    					'orderby' => 'meta_value_num',
    				     'order' => 'ASC',
    				);
    
    					//global $wpdb;
    
    				$loopReply = new WP_Query($args);
    
    #180219
    Robin W
    Moderator

    bit more digging

    it would appear that wordpress 4.7 takes out the filter capability

    https://github.com/WP-API/WP-API/issues/2964

    there is plugin that puts it back

    https://github.com/WP-API/rest-filter

    Otherwise I think they now want you to filter at the client end.

    so http://MY_SITE.COM/wp-json/wp/v2/posts gives you all the posts, and then you pick those that are the right post type.

    If you try the plugin above, then I think

    http://MY_SITE.COM/wp-json/wp/v2/posts?filter[type]=topic

    does it

    Please do report progress back !!

    #180214
    Robin W
    Moderator

    Do you know how to put code in your theme’s function file ?

    if so add this to it

    add_filter( ‘bbp_get_do_not_reply_address’, ‘noreply@swissinformatics.org' );

    and that will not get overwritten on upgrade of bbpress plugin

    Of course that will need a child theme, as otherwise it will get lost on a theme update !

    If any of that not clear (or not possible) come back !

    #180212
    Robin W
    Moderator

    The below is offered as potential help, and in an effort to help, so if it is rubbish, then please come back, and I will try to help further.

    bbpress uses the standard wordpress posts, but with post types of ‘forum’, ‘topic’ and ‘reply’ instead of ‘post’ and ‘page’, and bbpress code itself basically uses wp_query to access the database.

    The glossary for wordpress api says

    GET /wp-json/wp/v2/posts to get a collection of Posts. This is roughly equivalent to using WP_Query.

    so I’d imagine that you would just use the same sort of call, and use wp_query parameters to return what you wanted.

    So if for wordpress you had a command that gave you say the latest 5 posts, then this same command would work but just changing whatever that code has for post_type=’post’ to post_type=’topic’

    If you wanted topics from a particular forum, you would add the equivalent of post_parent = ID where ID was the forum ID

    In essence if you can tell me what you want, I can give you the wp_query, and you could hopefully translate this into json.

    Does any of that make sense? 🙂

    #180210
    Gilbert
    Participant

    Hi,
    WP 4.7, latest BBpress. I have a multisite: swissinformatic.org, magazine.swissinformatics.org, [other stuff]swissinformatics.org. My mail server is @swissinformatics.org and the plugin picks up $_SERVER['SERVER_NAME'] to create the no reply address.
    COULD YOU HELP US with a setting box to supersede this value?
    Meanwhile I replaced it with my site name in the functions.php code, but mind the next plugin update!
    $sitename = strtolower( ‘swissinformatics.org );
    Always beware of “Educated guess’ I’m not going to buy a mail server for each subdomain and with the present security of providers,…
    I also created a no reply alias of my administrative e-mail address.
    Everything is fine now

    Subscriptions ***********************************************************/

    /**
    * Get the “Do Not Reply” email address to use when sending subscription emails.
    *
    * We make some educated guesses here based on the home URL. Filters are
    * available to customize this address further. In the future, we may consider
    * using admin_email instead, though this is not normally publicized.
    *
    * We use $_SERVER['SERVER_NAME'] here to mimic similar functionality in
    * WordPress core. Previously, we used get_home_url() to use already validated
    * user input, but it was causing issues in some installations.
    *
    * @since bbPress (r5409)
    *
    * @see wp_mail
    * @see wp_notify_postauthor
    * @link https://bbpress.trac.wordpress.org/ticket/2618
    *
    * @return string
    */
    function bbp_get_do_not_reply_address() {
    $sitename = strtolower( $_SERVER[‘SERVER_NAME’] );
    if ( substr( $sitename, 0, 4 ) === ‘www.’ ) {
    $sitename = substr( $sitename, 4 );
    }
    return apply_filters( ‘bbp_get_do_not_reply_address’, ‘noreply@’ . $sitename );

    #180199

    In reply to: Guest Posting Question

    Anonymous User
    Inactive

    Mike,

    I have just stumbled upon the thread from 3 years ago and it led me to finding yours here. Is this really not resolved?

    I recently got bbPress up and running and I also needed this. I went ahead and found the solution… here goes…

    It’s in the template. Seriously. Let’s take the previous answer (sorry for no reference) that souneone suggested to “tell the users to use anon@example.com”, and we’ll make it even easier for the user.

    Make sure to copy the default bbpress template “form-anonymous.php” to /wp-content/themes/your-theme/bbpress/

    Open up form-anonymous.php from your theme and find the following code section:

    <p>
    			<label for="bbp_anonymous_email"><?php _e( 'Mail (will not be published) (required):', 'bbpress' ); ?></label><br />
    			<input type="text" id="bbp_anonymous_email"   value="<?php bbp_author_email(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_anonymous_email" />
    		</p>

    Delete that. In fact, replace it with the following:

    <input type="hidden" id="bbp_anonymous_email" value="anon@yourdomain.com" tabindex="-1234" name="bbp_anonymous_email" />

    Save it out, close it out. You’re done!

    Now you don’t require names.. it forces the “anon@yourdomain.com” as the value.
    Developers can still change it 😉

    remember to change yourdomain.com to your actual domain in the values I gave above.

    if you have further questions or anything reach out on skype joshuasadler4550

    #180191
    TheDream18
    Participant

    Example:
    TOPIC A
    – Post 1
    – Post 2
    – Post 3
    – Post 4

    Simple added this code css:
    /* Display sub-forums in separate lines */
    #bbpress-forums .bbp-forums-list li {
    display: list-item !important;}

    #180188
    eliblair
    Participant

    Hi guys, I will just say first that I do not know much about coding.

    I just installed bbpress and now i have this error come up in my wordpress dashboard

    Warning: preg_match(): Unknown modifier ‘0’ in /home2/eli/public_html/juniortactician.com/wp-includes/class-wp.php on line 231

    Warning: preg_match(): Unknown modifier ‘0’ in /home2/eli/public_html/juniortactician.com/wp-includes/class-wp.php on line 232

    the code on those lines are as follows:

    if ( preg_match(“#^$match#”, $request_match, $matches) ||
    preg_match(“#^$match#”, urldecode($request_match), $matches) ) {

    what does this mean and how can I get rid of it?

    Thanks in advance.

    #180187
    Robin W
    Moderator

    the topic index shortcode in my style pack plugin might be what you need

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

    go to

    dashboard>settings>bbp style pack>shortcodes to see what is available and how it works

    #180186
    moni
    Participant

    Hi I am using a custom short code to show about 10 latest replies on my reply dash board.
    I get shortcode from this link by applying this code : http://www.daggerhart.com/bbpress-recent-replies-shortcode/

    what I want is to add paging (nav) at the bottom to show more then 10 replies on other pages. please suggest solutions.

    #180181
    stagezero
    Participant

    Hello,
    I have used Image Upload for BBPress to upload and attach image to forum.
    my problem is image is not responsive. It will just shrink its width. I tried playing with firbug and remove image attributes and set max-width to 100%.
    It works… Now my problem is which file to edit and how. Im not a coder. I just learned css and have little understanding on php…

Viewing 25 results - 5,626 through 5,650 (of 32,505 total)
Skip to toolbar