Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,126 through 5,150 (of 32,577 total)
  • Author
    Search Results
  • #185281

    In reply to: Link to latest post

    PinkishHue
    Participant

    You could install the ‘bbp additional shortcodes’ plugin, then use that to display just one topic

    bbp additional shortcodes

    Then use ‘do shortcode’ if you want to place this in a template file, like:

    // Use shortcodes in form like Landing Page Template.
    <?php echo do_shortcode( '[bbp-display-topic-index show='1']' ); ?>

    I think that should work for you.

    #185268
    Robin W
    Moderator

    sorry – I was half awake this morning

    try

    add_filter ('bbp_before_has_forums_parse_args', 'rew_show_all' ) ;
    
    function rew_show_all ($args) {
    	$args['posts_per_page'] = -1 ;
    return $args ;
    
    }
    #185263
    Robin W
    Moderator

    the code only shows 50

    put this in your functions file (untested, but should work)

    add_filter ('bbp_before_has_forums_parse_arguments', 'rew_show_all' ) :
    
    function rew_show_all ($args) {
    	$args['posts_per_page'] = -1 ;
    return $args ;
    
    }
    #185262
    PinkishHue
    Participant

    Just wondering if anyone has come across this before – I’m attempting to create a subforum for every postcode district in the UK of which there are 2000+ (this may seem a bad idea but having considered many different options it seems the best/simplest for my use case at the moment)

    I’ve imported the forums via the ‘WP CSV’ plugin, and they seem to have imported fine, but on the front end when viewing the full forum list it only shows the first 50. Is this by design? Or could it be something buggy I have done?

    If it’s unavoidable I guess I can make them sub-subforums of a smaller number of postcode areas.

    Thanks

    #185252

    In reply to: Multiple Forum Indexes

    Robin W
    Moderator

    If I understand what you want correctly, just set each ‘page’/index as a category and then the appropriate forums as belonging to that category.

    Then set up a page for each and use a shortcodes to display the appropriate forums for that page

    eg
    [bbp-single-forum id=1]
    [bbp-single-forum id=2]
    [bbp-single-forum id=3]

    #185251
    itayasa
    Participant

    I successfully managed to post messages into the forum by including WordPress in my php script and calling bbp_insert_topic.
    However, it seems like when I call bbp_insert_reply bbPress actually inserts a topic parented to another topic and these appear like replies in the site itself.
    Tried repairing the forums and it didn’t work.
    Any idea why?

    #185232
    Robin W
    Moderator

    this is doable, but you’ll need to modify the role

    see

    bbPress User Roles and Capabilities

    and

    Custom Capabilities

    you’ll probably want to create a new role which just lets this role create and edit replies

    PinkishHue
    Participant

    I see, to make the font on the sub-forums larger you can use:

    .bbp-forums-list .bbp-forum a {
    font-size: 18px;
    }

    Also if you want an easier way to alter sizes and styles etc. you could try Robin’s handy plugin:

    bbp style pack

    #185185
    theredeclipse
    Participant

    Hello,

    I’m trying to make a link to a latest topic in forum page. I achieved topic name by bbp_forum_last_topic_title function, but can’t figure out how to get a link for latest topic.

    I’ve tried to pull out something like this, but it links to forum index.
    <p><a href="<?php echo $link; ?>"><?php bbp_forum_last_topic_title(); ?></a></p>

    #185182
    sourfew
    Participant

    95000 topics
    750000 replies
    25000 users

    When I run the script several times I think all posts are recalculated but not really sure.

    I have som other issues as well.
    Imported users do not get a site role or forum role.
    Users post count is zero.
    Users do not show up in the memberslist (front end) and are not searchable. But I can access user profiles and the number of topics, replies ans mentions seems to be ok.

    Post quotes are not always converted the right way and sometimes even bbcode are parsed resulting in very small text.

    I have tried the import on both an newer VPS with php 7 and a older one with php 5.4.
    Vbulletin version 4.2.2

    locutus1
    Participant

    1) Good to know. That solves that.

    2) This worked but only partly. My terminology may be wrong. I have a menu item which is a category. If you click it, it lists 4 main forums each of which is also a category. Under each main forum are listed its sub-forums. The code you gave me made the main forums bigger – 18 pt is good – but the sub-forums are a little small. If you click a sub-forum then it becomes a main forum and it’s 18 pt. So the code affects main forums only. I don’t know if this is clear so look at this. This is what I see if I click the menu item.

    Main forum1
    (indented) sub-forum1, sub-forum2, sub-forum3, sub-forum4
    Main forum2
    Main forum3

    Each main forum is 18 pt. I understand the sub-forums should be smaller than the main forums but they’re a little too small. Can that be adjusted? It’s OK if it can’t be.

    3) I’m still working on this one.

    Thanks a lot. I have other questions but I’ll make a new post.

    #185172
    PinkishHue
    Participant

    @casiepa Hi again, I don’t see an option to send you a private message but wanted to let you know I installed the plugin (thanks), but I’ve noticed it has altered the display of my subforums (removed the topic and voice counts, and made the font larger), even though I have not checked that option in the plugin settings.

    Here’s the info from the plugin if it’s any help.

    WP version 4.8
    Theme Make (child theme) 1.1.0
    PHP version 5.6.30
    bbPress version 2.5.12-6148
    site url (removed, on localhost XAMPP)
    Active Plugins Name and Version
    – p1 bbP Toolkit 1.0.10
    – p2 bbP shortcodes 2.8
    – p3 bbPress 2.5.12
    – p4 BuddyPress 2.8.2
    – p5 User Switching 1.0.9
    – p6 WordPress Social Login 2.3.3

    #185168
    PinkishHue
    Participant

    Thanks for all the info above. I’ve added the ‘bbPress-Topic-Subscribers’ plugin and that works great.

    To try and do the same for forum subscriptions I’ve copied the files and changed all instances of ‘topic’ to ‘forum’, and it’s listing the users fine, but when you click the unsubscribe link nothing happens.

    Looking at the code, I think it must be something in this section that is not right:

    		$forum_id = bbp_get_forum_id();
    		
    		if ( $forum_id && current_user_can( 'moderate' ) ){
    			$subscribers = bbp_get_forum_subscribers( $forum_id );
    			if ( $subscribers ){
    				echo '<table style="width: 100%">';
    				foreach ( $subscribers as $subscriber ){
    					$subscriber = get_user_by( 'id', $subscriber );
    					echo '<tr>';
    						// avatar
    						echo get_avatar( $subscriber->ID, 45 );
    						echo ' ';
    						//username
    						echo $subscriber->user_login;
    						echo ' ';
    						// remove button
    						echo bbp_get_forum_subscription_link(
    							array(
    								'user_id'     => $subscriber->ID
    							)
    						);

    Specifically maybe the ‘bbp_get_forum_subscription_link’ area? Does anyone have any suggestions on why this wouldn’t work for forums in the same way as topics? Many thanks for any help you can give.

    #185166
    Stagger Lee
    Participant

    Here it is.
    You hijacked topic a bit.
    I still dont understand why you use bbPress as Blog/Posts tool when WordPress is made for this. Almost as you are not so good on theming, and looking for shortcuts.

    – Make own image size
    – Change “slider” to name of own image size.
    – There is a class to center image, give it maybe some gray background for smaller featured mages. fix margins and paddings, etc…

    function ntwb_bbpress_random_single_topic() {
            global $post;
    	    if ( has_post_thumbnail($post->ID) )
    	    	echo get_the_post_thumbnail($post->ID,'slider',array('class' => 'forum-topic-featured'));
        }
    // Hook into action
    add_action('bbp_template_before_lead_topic','ntwb_bbpress_random_single_topic');
    #185162
    kariellen35
    Participant

    By the way… what I did end up doing which has been a real good work-around, is use the bbp style pack single forum short code to show my forums as pages. This has been great, because it allows for much more modification! So I just added my featured image to each forum’s page.

    #185160
    kariellen35
    Participant

    Thank you so much for your help @stagger-lee! This code did work, however, it seems to only be for forum lists, which is an option already included in the bbp style pack plugin. I am trying to get the featured image to show up on the forum’s page itself (like what they do in buddypress groups) I don’t have forum lists accessible on my site so it’s not relevant to what I am doing. Thanks again for taking the time to post this tho!

    #185159
    andrew55
    Participant

    I don’t mean to ramble, but I think the solution will be something such as:

    if (Am_Lite::getInstance()->haveSubscriptions(364) && ($reply_user_id($topic_id) ))

    I just add bbpress statement to my already existing “if” statement using an “And” operator.

    I’m just getting caught up on the bbpress part.

    Any suggestions on what the bbpress code would be to “just show for the author of this reply?”

    Thanks for any help.

    #185158
    andrew55
    Participant

    I seems like this should work, but it doesn’t:

    <?php
    if (bbp_get_reply_author_id($reply_id))
    {
    ?>
    
    my other code goes here
    
    <?php
    }
    ?>

    It seems like it should wrap my code with a statement of “show only for the author of this reply” but it’s not working like this.

    Any suggestions on what the code would be to “just show for the author of this reply?”

    Thanks for any help.

    #185155
    andrew55
    Participant

    I’ve got a simple “php if snippet” I’m trying to get into loop-single-reply.php.

    Here is an example of my snippet (used for a seperate membership script):

    <?php
    require_once '/members/library/Am/Lite.php';
    $user = Am_Lite::getInstance()->getUser(); 
    ?>
    <?php
    if (Am_Lite::getInstance()->haveSubscriptions(364))
    {
    ?>
    <span class='custom-user-donation-badge'>I've Donated!</span>
    <?php
    }
    else {
    // do the other thing
    ?>
    <?php
    }
    ?>

    I need the code snippet to show only in the profile area of the reply author, if it applies to them.

    In other words: “show this if it applies and only show if it applies to this specific reply author.”

    I’ve used these before for something similar:

    $reply_user_id = bbp_get_reply_author_id();
    $reply_user = new WP_User( $reply_user_id )

    I’m still leaning php and bbpress. Any suggestions on how I can wrap my code snippet with these bbpress statements? This way, my code snippet will only apply if it applies to the specific author.

    Thanks for any suggestions.

    #185150
    PinkishHue
    Participant

    See this info –

    bbp_topic_author_link

    To display just the avatar linked to the member profile you would use:

    <?php bbp_topic_author_link( array( 'sep' => '<br />', 'show_role' => false, 'type' => 'avatar' ) ); ?>

    or for reply author’s:

    <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => false, 'type' => 'avatar' ) ); ?>

    Hope that helps

    PinkishHue
    Participant

    1) Topic Type and Topic Status are only viewable to you/forum admins (aka keymasters), regular users do not see them

    2) Wherever you add custom CSS (probably ‘Appearance > Customize’ in the admin menu’s), add this:

    .bbp-forum-title {
      font-size: 18px; /* make this size whatever you prefer */
    }

    3) This functionality isn’t built in to bbpress but you could add another plugin to make this happen. Here is an old topic that might provide some suggestions for you: https://bbpress.org/forums/topic/rating-and-sorting-plugin/

    Hope that helps

    #185135
    Stagger Lee
    Participant

    Here is code for forum index, forum featured images, not topics:

    /*
    Plugin Name: bbPress - Forum Icons
    Plugin URI: https://gist.github.com/ntwb/8277457
    Description: bbPress - bbPress - Forum Icons
    Version: 0.1
    Author: Stephen Edgar - Netweb
    Author URI: http://netweb.com.au
    */
     
    // Original Source: http://www.kristarella.com/2013/04/bbpress-forum-icons/
     
    add_post_type_support('forum', array('thumbnail'));
     
    function ks_forum_icons() {
    	if ( 'forum' == get_post_type() ) {
    		global $post;
    	    if ( has_post_thumbnail($post->ID) )
    	    	echo get_the_post_thumbnail($post->ID,'thumbnail',array('class' => 'alignleft forum-icon'));
    	 }
    }
     
    add_action('bbp_theme_before_forum_title','ks_forum_icons');
    #185134
    Stagger Lee
    Participant

    In theme functions.php or custom field with functions.php.
    It gives featured image metaboxes in backend. Then you display featured image on front as any other post type featured. See how your theme is doing this and copy/paste whole code block.

    As you need only fetaured image allowed for admins and moderators you can use this:

    add_post_type_support('topic', array('thumbnail'));
    add_post_type_support('forum', array('thumbnail'));
    /*
    Plugin Name: bbPress - Forum Icons
    Plugin URI: https://gist.github.com/ntwb/8277457
    Description: bbPress - bbPress - Forum Icons
    Version: 0.1
    Author: Stephen Edgar - Netweb
    Author URI: http://netweb.com.au
    */
    // Original Source: http://www.kristarella.com/2013/04/bbpress-forum-icons/
    add_post_type_support('forum', array('thumbnail'));
    function ks_forum_icons() {
    	if ( 'topic' == get_post_type() ) {
    		global $post;
    	    if ( has_post_thumbnail($post->ID) )
    	    	echo get_the_post_thumbnail($post->ID,'thumbnail',array('class' => 'alignleft forum-icon'));
    	 }
    }
    add_action('bbp_theme_before_topic_title','ks_forum_icons');

    I will see later what is the best way to allow all Users to set topic featured images.
    But dont see much point in it. Thousands of forum topics, thousands of images on server x all WP image sizes. Big mess.

    #185130
    kariellen35
    Participant

    Stagger Lee, where did you add this code? Does it only bring up the image in forum or topic lists or does it appear on the forum page?

    #185128
    TKServer
    Participant

    This was missing from bbp-api.php:

    	register_rest_route( 'bbp-api/v1', '/users/(?P<id>\d+)', array(
    		'methods' => 'GET',
    		'callback' => 'bbp_api_users_one',
    	) );

    and users.php was also missing.

    I’m guessing that was intentional?

Viewing 25 results - 5,126 through 5,150 (of 32,577 total)
Skip to toolbar