Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,376 through 5,400 (of 32,505 total)
  • Author
    Search Results
  • robcruiz
    Participant

    Would it be possible to add a filter to the function that determines the status of a new topic? I understand there is some moderation in place using the word list, topic duplicate, user blacklist, etc. However, I currently have the need to determine the status based on user role. We want all admins and editors to show topics immediately after creation, however, we want subscribers to be set as pending so we can proactively moderate topics (not necessarily replies).

    I have added a filter in the core code in order to achieve this. I was wondering if this change could be added to future versions of bbPress. The change is in bbpress>inclues>topics>functions around line 287. It looks like this:

    /** Filter Topic Status ***************************************************/
    
    $new_topic_args = array($anonymous_data, $topic_author, $topic_title, $topic_content);
    
    $topic_status = apply_filters('bbp_new_topic_status', $topic_status, $new_topic_args);

    Please let me know whether or not this will be implemented, so I know whether or not to update the plugin.

    Thanks.

    Pascal Casier
    Moderator

    It’s not a solution, but what I did in my ‘bbP Move Topics’ was staying in the same database without exporting but correctly changing the post type and meta data.
    If you are into coding, that might give you a direction. If I find some free hours this year, I might code it myself, but priority is low.
    Pascal.

    #182746
    Pascal Casier
    Moderator

    Code is always welcome. And I think it’s a nice to have as option to admin and moderator.

    Will try myself too 🙂

    #182745
    brettdarnesh
    Participant

    @casiepa

    I tried your suggested untested code

    `function casiepa_fltr_get_forum_subscribers( $user_ids ) {
    return array();
    };
    // add the filter
    add_filter( ‘bbp_forum_subscription_user_ids’, ‘casiepa_fltr_get_forum_subscribers’, 10, 1 );`

    it’s not working for me 🙁

    I have an urgent matter where bbpress is sending our multiple emails not just from the recent activities of the day but from all notifications from the beginning of the whole forum. I’m not sure on how to stop the thing. People are being driven nuts

    #182739
    KurzBaginski
    Participant

    Thanks. Perhaps I am looking for a Freelance Coder to do this for me. Is the source code interesting for you?

    #182733
    Collins Agbonghama
    Participant

    I also needed something like this. Will try the code out.

    Thank you.

    #182732
    Robin W
    Moderator

    untested, and may need you to debug it a bit but something like changing step 3 to read

    /*
     * Search only a specific forum
     */
    function my_bbp_filter_search_results( $args ){
     
        //Get the submitted forum ID (from the hidden field added in step 2)
        $forum_id = sanitize_title_for_query( $_GET['bbp_search_forum_id'] );
    
    $sub_forums = bbp_forum_get_subforums( $forum_id );
    
     $args['post__in'] = $sub-forums ;
                
        
        return $args;
    }
    add_filter( 'bbp_before_has_search_results_parse_args' , 'my_bbp_filter_search_results' );
    

    you may need to add the main forum into the sub-forum list/

    #182723
    DragoWeb
    Participant

    Hi, I’m new with bbpress and using a WP (v4.7.3) with WPML (v3.6.6) to display 2 languages. I created 2 main forums named “English Forum” and “French Forum” with some sub forums under each of them, and I’m looking now for a way to display a search form to target only the “english forum” but also his child forum, and another which target the “french forum” with his child ones.

    I’ve found this :http://sevenspark.com/tutorials/how-to-search-a-single-forum-with-bbpress
    but it only search on a single forum ID (not to child ones).

    I googled for hours but, surprisingly, found nothing really helpful.

    I can create my own shortcode to display a search form but how to target a forum_id?

    Thanks for any help…

    #182719
    Robin W
    Moderator

    untested but try

    add_action('bbp_template_before_pagination_loop','pmh_new_topic_button');

    #182714
    unconquered
    Participant

    Hi there,
    Was wondering how do I control the capabilities and permissions for guest posters i.e. the posters who can reply and create topics without registering.

    My forum requires anonymous guest posting but I need to give Anonymous posters the ability to edit and delete their posts.
    I’m not a coder but I can figure it out, the part where I’m stuck is that I can’t find any info on what variable or function controls guest posters. I looked into Capabilities.php and at first mistook spectators for guest posting, however that’s not the case

    Thanks

    #182710
    fastk9dad
    Participant

    I fixed my function above so this works now:

    function pmh_new_topic_button() {
    $forum_id=bbp_get_forum_id();
    
    	if ( is_user_logged_in() ) {
    		echo '<a href="/forums/new-topic/?ForumId='. $forum_id .'"><div class="new-topic btn">New Topic</div></a>';
    	}
    }
    
    add_action('bbp_template_before_topics_loop','pmh_new_topic_button');
    #182709
    fastk9dad
    Participant

    Hrmm, I replied last night and it looks to be gone now. Not sure if I’ve gotten moderated but I’ll put my response here again.

    Currently I’m just using this code in the content-single-topic.php template in my child theme.
    <a href="/forums/new-topic/?ForumId=<?php echo bbp_get_forum_id()?>"><div class="new-topic btn">New Topic</div></a>

    I have developed this for use in function.php to replace the above but I get a parsing error right now. It works ok if I don’t try to insert the ForumID so something is wrong with my syntax.

    function pmh_new_topic_btn() {
    	if ( is_user_logged_in() ) {
    		echo '<a href="/forums/new-topic/?ForumId=".$_GET['ForumId'].""><div class="new-topic btn">New Topic</div></a>';
    	}
    }
    add_action('bbp_template_before_topics_loop','pmh_new_topic_btn');

    Regardless of which method I use the resulting code is always placed after the bbp-pagination element and my CSS fu isn’t strong enough to have the button flow/move with the bbp-pagination-links contained within (is it even possible?).

    <div class="bbp-pagination">
    	<div class="bbp-pagination-count">
    		Viewing 3 topics - 1 through 3 (of 3 total)
    	</div>
    	<div class="bbp-pagination-links">
    	</div>
    </div>
    <a href="/forums/new-topic/?ForumId=1486">
            <div class="new-topic btn">New Topic</div>
    </a>
    #182702
    mpnuu
    Participant

    Hello

    I have only added style.css file with comment section and functions.php file with my_theme_enqueue_styles() function as it is advised in Codex (https://codex.wordpress.org/Child_Themes). My website is not yet public, because I’m doing it for my customer and I don’t want to publish it before it is ready.

    #182684
    brettdarnesh
    Participant

    I have a number of not so happy customers being inundated with emails from the forum, they are receiving numerous repeat emails for some reason.

    I’m happy to try and figure it out, BUT for the URGENT NOW, I need a way to just shut off all the emails coming from bbpress. Is there a surefire way to do this?

    happy with functions.php code snippets, anything

    thanks for your help

    Brett

    #182681

    In reply to: bbp_reply_admin_links

    Robin W
    Moderator
    #182680

    In reply to: bbp_reply_admin_links

    Robin W
    Moderator

    sorry, this was not meant to be a solution, but rather to point you to then code

    'before' => '<span class="bbp-admin-links">',
    			'after'  => '</span>',

    is what it currently does, so if you wanted to take out the span entirely you would do

    function theredeclipse_change ($args) {
    	$args['before'] = '' ;
    	$args['after']   = '' ;
    return $args ;
    }
    #182678

    In reply to: bbp_reply_admin_links

    theredeclipse
    Participant

    I’ve tried at least to change <span> like in your example, but it doesn’t work. Aswell tried to pull this out in this way:

    add_filter ('bbp_reply_admin_links', 'theredeclipse_change' ) ;
    
    function theredeclipse_change ($retval, $r) {
    $r = bbp_parse_args( $args, array(
    			'before' => '<span class="bbp-admin-links">',
    			'after'  => '</span>',
    		), 'get_reply_admin_links' );
    return $retval ;
    }

    And several attempts more, but nothing happens :[

    #182677

    In reply to: How make full width

    Robin W
    Moderator
    #182663

    In reply to: bbp_reply_admin_links

    Robin W
    Moderator

    hmmm … if you want each link to be a button, I can point you to some code, but you’ll need to figure it out.

    so

    so for replies, the function is in

    bbpress/includes/replies/template.php

    which I think you found.

    function bbp_get_reply_admin_links( $args = array() ) {
    
    		// Parse arguments against default values
    		$r = bbp_parse_args( $args, array(
    			'id'     => 0,
    			'before' => '<span class="bbp-admin-links">',
    			'after'  => '</span>',
    			'sep'    => ' | ',
    			'links'  => array()
    		), 'get_reply_admin_links' );
    
    		$r['id'] = bbp_get_reply_id( (int) $r['id'] );
    
    		// If post is a topic, return the topic admin links instead
    		if ( bbp_is_topic( $r['id'] ) ) {
    			return bbp_get_topic_admin_links( $args );
    		}
    
    		// If post is not a reply, return
    		if ( !bbp_is_reply( $r['id'] ) ) {
    			return;
    		}
    
    		// If topic is trashed, do not show admin links
    		if ( bbp_is_topic_trash( bbp_get_reply_topic_id( $r['id'] ) ) ) {
    			return;
    		}
    
    		// If no links were passed, default to the standard
    		if ( empty( $r['links'] ) ) {
    			$r['links'] = apply_filters( 'bbp_reply_admin_links', array(
    				'edit'  => bbp_get_reply_edit_link ( $r ),
    				'move'  => bbp_get_reply_move_link ( $r ),
    				'split' => bbp_get_topic_split_link( $r ),
    				'trash' => bbp_get_reply_trash_link( $r ),
    				'spam'  => bbp_get_reply_spam_link ( $r ),
    				'reply' => bbp_get_reply_to_link   ( $r )
    			), $r['id'] );
    		}
    
    		// See if links need to be unset
    		$reply_status = bbp_get_reply_status( $r['id'] );
    		if ( in_array( $reply_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id() ) ) ) {
    
    			// Spam link shouldn't be visible on trashed topics
    			if ( bbp_get_trash_status_id() === $reply_status ) {
    				unset( $r['links']['spam'] );
    
    			// Trash link shouldn't be visible on spam topics
    			} elseif ( bbp_get_spam_status_id() === $reply_status ) {
    				unset( $r['links']['trash'] );
    			}
    		}
    
    		// Process the admin links
    		$links  = implode( $r['sep'], array_filter( $r['links'] ) );
    		$retval = $r['before'] . $links . $r['after'];
    
    		return apply_filters( 'bbp_get_reply_admin_links', $retval, $r, $args );
    	}

    which you can filter at the end, but how would depend on your skills.

    the span part can be simply changed by putting a filter into your child theme’s function file

    eg

    add_filter ('bbp_before_get_reply_admin_links_parse_args', 'theredeclipse_change' ) ;
    
    function theredeclipse_change ($args) {
    	$args['before'] = '<span class="bbp-admin-links">' ;
    	$args['after']   = '</span>' ;
    return $args ;
    }

    and just change whatever you want the span part to look like, or just remove it.

    if you want to style each link, then you’ll see that there is a call to each separate function

    'edit'  => bbp_get_reply_edit_link ( $r ),
    				'move'  => bbp_get_reply_move_link ( $r ),
    				'split' => bbp_get_topic_split_link( $r ),
    				'trash' => bbp_get_reply_trash_link( $r ),
    				'spam'  => bbp_get_reply_spam_link ( $r ),
    				'reply' => bbp_get_reply_to_link   ( $r )
    

    so to do it in functions, you’d need to go to each one.

    you’ll find these in the same file above

    since the class is hard coded, you could add a final filter with a preg_replace

    eg

    add_filter( 'bbp_get_reply_move_link' , 'theredeclipse_move', 10 , 2 ) ;
    
    function theredeclipse_move ($retval, $r) {
    $retval =  preg_replace(whatever args you need, with, $retval);
    return $retval ;
    }

    so $retval will hold the line of code including the class.

    so google preg-replace and see if you can get it working !!

    Ryan Giglio
    Participant

    Turns out every lead I was following was a red herring.

    I had another function hooked into wp_insert_post that was redirecting you back to the Video single page instead of sending you to the Thread single page if you posted your reply FROM the Video single page. It turns out that redirect was hitting and stopping execution before the bbp_new_reply actions were allowed allowed to fire.

    I changed that function to also hook into bbp_new_reply and changed its priority to 11 so it would run after the native actions. Working great!

    #182655

    In reply to: bbp_reply_admin_links

    theredeclipse
    Participant

    Default output looks like

    <span class="bbp-admin-links">
    // inside different classes of links
    </span>

    I would like change it to
    <a class="button"></a>
    So I want to delete span from output and use one style for each <a> link, if its possible.

    And the thing is – I could do it by modifying forum files, but after update it will be overwritten. So I want to use bbpress functions php file to change output, but I don’t know how. I hope I’ve explained it well 😛

    Ryan Giglio
    Participant

    I’m working an educational website that produces video content and uses a BBPress forum for discussion rather than the native WordPress comments. Here’s how it works:

    I have a hook on wp_insert_post that creates a new BBPress topic when a new video post is created and saves this new topic_id to a _comment_topic_id meta field.

    In my single-video.php template where the video is displayed, I’m using the BBPress [bbp-single-topic id=$topic_id] shortcode to display the topic thread and reply form for people to post comments.

    All of this works great! I’m just having one problem – the “subscribe” feature of BBPress isn’t working when people post replies via the Video Single page. The reply is posted just fine, but subscribed users don’t receive a notification. If you’re not familiar – when a user subscribes to a thread, they receive an email whenever someone replies to the thread. This is still working fine when someone posts a reply via the actual Thread single page – it’s only a problem on the thread embedded via the shortcode on the Video single page.

    I’ve tried digging into the core and I got so far as to discover that the bbp_new_reply action isn’t firing – BBPress uses a function called bbp_notify_topic_subscribers hooked into bbp_new_reply to send the notifications and that function isn’t running at all when a reply is made via the Video single page.

    It seems that BBPress uses some hidden inputs to determine what actions to run after a reply has been submitted, but those seem to be included properly through the shortcode. These appear at the bottom of the Topic single form (that works properly);

        <input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="422573">
        <input type="hidden" name="bbp_reply_to" id="bbp_reply_to" value="0">
        <input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply">
        <input type="hidden" id="_wpnonce" name="_wpnonce" value="83ea236cd1">
        <input type="hidden" name="_wp_http_referer" value="/forums/topic/SLUG/">

    And these appear at the bottom of the Video single form (that doesn’t)

        <input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="422573">
        <input type="hidden" name="bbp_reply_to" id="bbp_reply_to" value="0">
        <input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply">
        <input type="hidden" id="_wpnonce" name="_wpnonce" value="83ea236cd1">
        <input type="hidden" name="_wp_http_referer" value="/videos/SLUG/">

    I’m at a loss for how to debug this issue further and could really use some help. BBPress has all kinds of page type/post type checks in the core that I’ve been ducking and weaving around, but this one has got me stumped. I suspect the problem is that SOMEWHERE it’s checking the post type of the current post, seeing it’s a video instead of a topic and bailing before the action runs, but I have no idea how or where to find that and how to patch around it.

    Thanks!

    #182603
    Pascal Casier
    Moderator

    This is bbPress, for BuddyPress you could check the BuddyPress forums 🙂

    Below just a quick idea to stop ALL email to subscribers, but UNTESTED:

    function casiepa_fltr_get_forum_subscribers( $user_ids ) {
    	return array();
    }; 
    // add the filter 
    add_filter( 'bbp_forum_subscription_user_ids', 'casiepa_fltr_get_forum_subscribers', 10, 1 );
    #182589
    Ismail
    Participant

    Hello,

    Sorry if I am bumping this old thread, but there’s already a thread open for this over wporg support forums at https://wordpress.org/support/topic/does-this-have-shortcode-can-use-this-in-wordpress-sidebar-as-form/. I left you a reply from there.

    Best,
    Samuel

    #182582
    fastk9dad
    Participant

    I am looking to make my “New Topic” button below follow the pagination, by that I mean if there is only one page and the pagination links don’t exist I want the “New Topic” button to appear all the way to the right. If there is pagination I want it to sit at it’s left most side like my example below. Right now I’m just placing it there in a static position which means on pages with no pagination it’s just floating in space.

    Example position:
    button position

    This is the static code I’m using for the button:

    #bbpress-forums .new-topic {
        margin-top: -41px;
        margin-right: 80px;
        float: right;
    }
Viewing 25 results - 5,376 through 5,400 (of 32,505 total)
Skip to toolbar