Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,551 through 3,575 (of 32,517 total)
  • Author
    Search Results
  • #204382
    demonboy
    Participant

    OK, I think I have solved this by following this thread, except I had to do one thing the other way around…

    1. Scrap User Role Editor and install the Members plugin by Justin Tadlock
    2. Don’t put anything in your functions file
    3. In WordPress under Users/Roles, clone the Participant user role and give it a name and slug (in my case I am using ‘bosun’) and save the new role.
    4. Add this code to your functions file:

    function vip_add_custom_role( $bbp_roles ) {
    
    $bbp_roles['bosun'] = array(
    'name' => 'Bosun',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
    );
    
    return $bbp_roles;
    }
    
    add_filter( 'bbp_get_dynamic_roles', 'vip_add_custom_role', 1 );

    … where bbp_roles and name is changed to your own name of the user role. This must be the same as the name/slug you inserted when cloning the participant user role.

    5. Now any forum user assigned this user role will display the correct role, rather that ‘participant’ ‘subscriber’ or ‘spectator’.

    The thing I had to do the other way around from the instructions in the other thread was to not put anything in the functions file and install the plugin first.

    Phew. Took me two days to get there!

    #204379
    demonboy
    Participant

    Hi,

    I attempted to create some new bbp roles using the code in the codex to copy the ‘participant’ role. Unfortunately this did not work for me despite deactivating all plugins (seems quite a few other people had the same issue).

    Instead I am using User Role Editor to create a new forum role, which I have called ‘bosun’. Upon sign-up a new user is correctly assigned this role and has the capabilities of a participant, which is great, but their forum role is still displaying as ‘spectator’.

    I would like to display the user’s role under the avatar.

    One thing I can do is display:none the div class bbp-author-role and then add in a new div to display the user_role, which I think is what URE plugin generates.

    I appreciate that some of this has to do with the URE plugin and that it is not supported here. What I am trying to understand is what I need to change in order to hide the bbp-author-role div and add in a new div calling the URE role. I can only find references to bbp-author-role in templates.php which is a function:

    function bbp_topic_author_role( $args = array() ) {
    	echo bbp_get_topic_author_role( $args );
    }
    	/**
    	 * Return the topic author role
    	 *
    	 * @since bbPress (r3860)
    	 *
    	 * @param array $args Optional.
    	 * @uses bbp_get_topic_id() To get the topic id
    	 * @uses bbp_get_user_display_role() To get the user display role
    	 * @uses bbp_get_topic_author_id() To get the topic author id
    	 * @uses apply_filters() Calls bbp_get_topic_author_role with the author
    	 *                        role & args
    	 * @return string topic author role
    	 */
    	function bbp_get_topic_author_role( $args = array() ) {
    
    		// Parse arguments against default values
    		$r = bbp_parse_args( $args, array(
    			'topic_id' => 0,
    			'class'    => 'bbp-author-role',
    			'before'   => '',
    			'after'    => ''
    		), 'get_topic_author_role' );
    
    		$topic_id    = bbp_get_topic_id( $r['topic_id'] );
    		$role        = bbp_get_user_display_role( bbp_get_topic_author_id( $topic_id ) );
    		$author_role = sprintf( '%1$s<div class="%2$s">%3$s</div>%4$s', $r['before'], $r['class'], $role, $r['after'] );
    
    		return apply_filters( 'bbp_get_topic_author_role', $author_role, $r );
    	}
    PDidee
    Participant

    Not using Buddy Press.

    Here is a list of the bbPress related plugins that are installed currently:
    – AccessAlly – bbPress Add-on
    – bbP private groups
    – bbPress – Mark as Read
    – bbPress – Moderation Tools
    – bbPress Notifications
    – bbPress Notify (No-Spam)
    – bbPress Profile Link Shortcode
    – bbPress Search Widget
    – bbPress Toolkit
    – bbPress Unread Posts

    #204367
    Robin W
    Moderator

    It’s like using the shortcode

    , or is it using the shortcode [bbp-search] ??

    #204330
    demonboy
    Participant

    And, for the record, I tried Robin’s code too. This time the user was originally a ‘participant’. When adding Robin’s code and trying to save as my new forum user role, it reverts back to ‘participant’. Caching is turned off.

    #204327
    demonboy
    Participant

    Did anyone find a solution to this? I have am having the same issue and am using:

    function add_custom_role( $bbp_roles ) {
      $bbp_roles['my_custom_role'] = array( 
        'name' => 'Bosun',
        'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // same capabilities as participants
      );
    
      return $bbp_roles;
    }   
    add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );
    #204293
    tejt99
    Participant

    Sorry, been away for a while.
    It’s like using the shortcode
    Thanks so much.

    #204277
    demonboy
    Participant

    Hey Robin,

    Thanks for getting back to me. I’ve just this moment found a simple solution. What do you think of this:

    .logged-in #bbp-forum-40250 {
    	display: none;
    }
    #204276
    Robin W
    Moderator

    If you just want to remove it from the list then you could amend loop-single-forum.php

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/loop-single-forum.php
    bbPress will now use this template instead of the original
    and you can amend this

    change it to (assuming 40250 is the fiorum id)

    
    <?php
    
    /**
     * Forums Loop - Single Forum
     *
     * @package bbPress
     * @subpackage Theme
     */
    
    if ( !bbp_get_forum_id() == '40250')) {
    ?>
    
    <ul id="bbp-forum-<?php bbp_forum_id(); ?>" <?php bbp_forum_class(); ?>>
    
    	<li class="bbp-forum-info">
    
    		<?php if ( bbp_is_user_home() && bbp_is_subscriptions() ) : ?>
    
    			<span class="bbp-row-actions">
    
    				<?php do_action( 'bbp_theme_before_forum_subscription_action' ); ?>
    
    				<?php bbp_forum_subscription_link( array( 'before' => '', 'subscribe' => '+', 'unsubscribe' => '&times;' ) ); ?>
    
    				<?php do_action( 'bbp_theme_after_forum_subscription_action' ); ?>
    
    			</span>
    
    		<?php endif; ?>
    
    		<?php do_action( 'bbp_theme_before_forum_title' ); ?>
    
    		<a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a>
    
    		<?php do_action( 'bbp_theme_after_forum_title' ); ?>
    
    		<?php do_action( 'bbp_theme_before_forum_description' ); ?>
    
    		<div class="bbp-forum-content"><?php bbp_forum_content(); ?></div>
    
    		<?php do_action( 'bbp_theme_after_forum_description' ); ?>
    
    		<?php do_action( 'bbp_theme_before_forum_sub_forums' ); ?>
    
    		<?php bbp_list_forums(); ?>
    
    		<?php do_action( 'bbp_theme_after_forum_sub_forums' ); ?>
    
    		<?php bbp_forum_row_actions(); ?>
    
    	</li>
    
    	<li class="bbp-forum-topic-count"><?php bbp_forum_topic_count(); ?></li>
    
    	<li class="bbp-forum-reply-count"><?php bbp_show_lead_topic() ? bbp_forum_reply_count() : bbp_forum_post_count(); ?></li>
    
    	<li class="bbp-forum-freshness">
    
    		<?php do_action( 'bbp_theme_before_forum_freshness_link' ); ?>
    
    		<?php bbp_forum_freshness_link(); ?>
    
    		<?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?>
    
    		<p class="bbp-topic-meta">
    
    			<?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' ); ?>
    
    		</p>
    	</li>
    
    </ul><!-- #bbp-forum-<?php bbp_forum_id(); ?> -->
    
    <?php } ?>

    Not tested but should work, if not then might be another bbpress plugin overwriting the template – come back

    #204273
    Robin W
    Moderator

    ok, the code does not allow for pagnination if you have nested replies allowed in the forum settings.

    That is just the way the code is written, I am not an author of the code.

    #204271
    wordik
    Participant

    Posted this code in file functions and obsolyutno nothing to acquire not has changed: (as was 80 messages on page tube top so and remained, in all themes. Although the settings specified no more than 10.

    #204267
    Robin W
    Moderator

    Put this in your child theme’s function file – or use

    Code Snippets

    add_filter( 'bbp_get_replies_per_page', 'rew_replies');
    
    function rew_replies () {
    $replies = 5 ;
    return $replies ;
    }
    #204260
    demonboy
    Participant

    Hi,

    Strange request but I would like to hide a forum completely when the user is logged in. This is because I’m using this forum as an info page for new visitors. Once a user is registered and logged in, they don’t need to see the forum, so I’d like to remove the entire < ul >. I’m hoping this is a simple addition to my functions.php file, something along the lines of:

    if ( bbp_is_user_logged_in() ) {
       echo "<some css that did ul.bbp-forum-40250 {display:none;}
    }

    Except I know that’s probably not the best way to achieve this. What would be the best way to hide the forum to logged in users?

    Thanks.

    #204093
    demonboy
    Participant

    Hi,

    I have a gallery I would like to add either within the forum description or within a topic but bbpress is not parsing the shortcode. It is not a bbpress shortcode, it comes from a gallery plugin.

    How do I enable parsing of other shortcodes within bbpress?

    Thanks!

    #203942
    kjvhout
    Participant

    Hi, tanks for your response. I already found this code on the internet, but it didn’t seem to do anything.

    #203931
    StormD
    Participant

    Hi. Can anyone please help me with the code to do this:

    change this
    [bbp-single-reply id=$reply_id]

    to this
    [bbp-single-reply id=$topic_id]

    or anything that will basically do the same thing. Perhaps just the code to direct a reply form to a topic?

    thanks in advance

    #203895
    davec14
    Participant

    Good Afternoon,

    I am currently having an issue with getting my template overrides to work on bbpress pages, like forums and questions( indlucing shortcodes). I have the files located in /wp-content/themes/mytheme/bbpress/ but they are not working. Is there something I have done wrong? Or something I need to do? I am trying to edit loop-forums.php and others.

    Many thanks in advance for any help or advice,

    Kind regards,

    Dave

    #203893
    Robin W
    Moderator

    there is a fuction

    bbp_delete_topic function that you can substitute which I have not tested

    #203892
    Robin W
    Moderator

    this will close topics with no activity in the last 10 days

    
    /*
    Plugin Name: BBPress Close Old Posts
    Description: Close BBPress 2.0+ posts that haven't been updated in X days. 
    Author: Raygun
    Version: 0.1
    Author URI: http://madebyraygun.com
    
    This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    */ 
    
    register_activation_hook(__FILE__, 'bbpress_topic_scheduler');
    
    add_action('bbpress_daily_event', 'bbpress_close_old_topics');
    
    function bbpress_topic_scheduler() {
     wp_schedule_event(time(), 'daily', 'bbpress_daily_event');
    }
    
    function bbpress_close_old_topics() {
    	// Auto close old topics
    	$topics_query = array(
    		'author' => 0,
    		'show_stickies' => false,
    		'parent_forum' => 'any',
    		'post_status' => 'publish',
    		'posts_per_page' => -1
    	);
    	if ( bbp_has_topics( $topics_query ) )
    		while( bbp_topics() ) {
    			bbp_the_topic();
    			$topic_id = bbp_get_topic_id();
    			$last_active = strtotime( get_post_meta( $topic_id, '_bbp_last_active_time', true ) );
    			if ($last_active < strtotime( '-10 days') )
    				bbp_close_topic( $topic_id );
    		}
    }
    ?>
    #203855
    StormD
    Participant

    Robin, I’m closing the site again to try to restore some of what was deleted.

    I think I found a solution. I simply created another page and used elementor and bsp shortcodes. Whichs seem to work fine. The Archives piece has disappeared and I can style with your shortcodes πŸ™‚

    In the case of categories, having elementor settings post types checked for posts seems to take away any ability to do anything with categories. I suppose that could have been the case with the archives bit, as well. but that really doesn’t make sense sense WP was completely deleted, including elementor. Perhaps it’s in phpMyAdmin. idk.

    Anyway, we’re all good here. Just one question. Do I now need to change the root slug?

    Thank you!
    Storm

    #203852
    StormD
    Participant

    at this point, I am using bsp shortcodes…some work as stated..some don’t..so I’m just at a loss

    #203846
    StormD
    Participant

    wow well that’s stupidly embarrassing. This is what I was expecting:

    https://buddypress.org/wp-content/uploads/53/2013/11/forum1.jpg

    taken from here:

    Step by step guide to setting up a bbPress forum – Part 1

    Any advice on the archives heading?

    Thanks again!

    #203834
    StormD
    Participant

    my site is deleted. I had bluehost absolutely wipe out WP and I started out adding bbpress and trying this again. I really haven’t yet added anything else back except for elementor. Am I misunderstanding thinking that [bbp-forum-index] should return a forum name and then have topics listed underneath and then the next forum and so on? If so, disregard and tell me I’m just silly please. Anyway, I threw something up and created a gyazo of what I think you might be wanting to see. But, if you need to get in there I can create some credentials for you if you want to message privately.

    So, left to right. Topics…I created a couple in topics and one by going to the page and opening the forum. Next, the page created with just the shortcode. I didn’t even use elementor. Just straight to add new page and shortcode using the name in the root. The last one, I opened the site and used an incognito window to view the page.

    As you can see, it’s like it’s calling up archives. Looking back, I didn’t mention that before. That was really dumb. It’s been doing that all along. After deactivating all plugins, this is what made me believe I actually needed to reinstall WP. Honestly, this index thing is not my actual issue. LOL maybe we can address that one later? But bc of the archives thing, I am afraid to move forward.

    Hopefully, now that you have the whole story, you will recognize my error and be able to just say comment this code out with your child’s functions.php or add that to some other file or whatever. And all will be well πŸ™‚

    Thank you so much, Robin. I look forward to hearing from you.
    Storm

    https://gyazo.com/ab8f8fd010ba5967cce876c547b971b4

    #203799
    StormD
    Participant

    Hi. Forgive me. I’m new to all of this…trying but new. My frontpage containing [bbp-forum-index] is not working. It shows the forums but not the topics.

    I did try using Topics for Posts but decided I couldn’t see the benefit. So, at this point, I have tried the following things:
    checked permalinks
    reset forum root should show to topics by freshness
    I have repaired and reset bbpress
    And, at that point, I rolled the entire thing back with backup to before the bbpress install. And did not update any plugins. Also, though I have bbpress styling code thingies I had intended to use, I had not gotten past adding a bbpress folder to my theme’s child.

    At this point, I am deactivating plugins but am not confident that will solve it. But if it does, I will come right back and try to delete this or just plain apologize.

    Any help at all would be greatly appreciated.

    ttranvnu
    Participant

    I checked the database posts table via phpmyadmin and confirmed that replies posts did not come over to bbpress. Is there a way I can fix this manually by running some manual sql code?

    I’m using latest wordpress just downloaded today, and latest version of bbpress (bbPress 2.5.14).
    During the conversion I only get the following error which I don’t think tied to the replies posts not coming over.

    Repair any missing information: Continue

    WordPress database error: [Table ‘*.*_core_tags’ doesn’t exist]
    SELECT convert(core_tags.tag_meta_id USING “utf8mb4”) AS tag_meta_id,convert(core_tags.tag_text USING “utf8mb4”) AS tag_text FROM *_core_tags AS core_tags LIMIT 0, 100

    No tags to convert

    No super stickies to stick

Viewing 25 results - 3,551 through 3,575 (of 32,517 total)
Skip to toolbar