Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,826 through 3,850 (of 32,481 total)
  • Author
    Search Results
  • #198571

    In reply to: Links in new topic

    Robin W
    Moderator

    your first bit of code should be

    function custom_bbp_has_replies($args) {
     $args[‘order’] = ‘DESC’; // ‘ASC’ (Ascending, Default), ‘DESC’ (Descending)
    
    return $args;
     }
    
    add_filter(‘bbp_before_has_replies_parse_args’, ‘custom_bbp_has_replies’ );
    

    The ($args) brings in all the existing args and then your next line modifies just the ‘order’ arg. Otherwise the only argument passed to the query is the ‘order’ arg, so there is nothing to display.

    #198561
    Robin W
    Moderator

    Great – glad you are fixed, and for anyone reading this later the code should be

    add_filter ('bbp_get_do_not_reply_address', 'rew_no_reply') ;
    
    function rew_no_reply ($no_reply) {
    	$no_reply = 'abc@def.com' ;
    return $no_reply ;
    }
    #198557
    rhodesengr
    Participant

    I fixed it. Needed single quotes around the email address. I don’t uslly code much in php so I am not super on top of the syntax. Thanks for the code. Now it does just what I want. Only the admin email gets notified when someone posts. That is what i want for now. Thanks again.

    #198556
    rhodesengr
    Participant

    I tried your code snipet and it killed my site. I commented it back out and the site is working again. here is exactly what I put in functions.php except i changed the actual email name to “myemail”

    add_filter (‘bbp_get_do_not_reply_address’, ‘rew_no_reply’) ;
    function rew_no_reply ($no_reply) {
    $no_reply = myemail@gmail.com ;
    return $no_reply ;
    }

    #198554
    rhodesengr
    Participant

    ok thanks. I am trying the asynchronnous one first. Not really sure what it is doing. Now it seems like no email gets sent at all. Not to noreply, not to the poster, and not to site admin. I have asked about this on that plugin support page.

    Your code snippet goes in functions.php?

    #198553
    Robin W
    Moderator

    by default bbpress send one email to the noreply address and bcc’s in the subscibers, so only one email sent.

    code to change

    add_filter ('bbp_get_do_not_reply_address', 'rew_no_reply') ;
    
    function rew_no_reply ($no_reply) {
    	$no_reply = abc@def.com ;
    return $no_reply ;
    }

    You’d think the bbpress coders would have created setting for this by now

    the bbpress coders are busy people who can code what they wish to. Not up to us to criticise free software

    #198552
    rhodesengr
    Participant

    ok. thanks. What are “individual emails”

    Also, is there a reference to how to change the code? I would like to consider that option.

    I searched and found some other threads about this issue. One was from 2016. You’d think the bbpress coders would have created setting for this by now. Seems a lot of plugins have problems if you don’t have an enmail address with the website domain but it is very commone to use the built in system, your own pop, or gmail. Then the noreply@yourdomain.com is invalid. Common and forseeable.

    #198550
    Robin W
    Moderator

    bbpress sends an email to the noreply address and bcc’s in the intended recipients.

    2 solutions

    1. my style pack plugin lets you amend the ‘to’ address (see email subscriptions tab), or you can do this with code, and amend it to a real address on your website.

    bbp style pack


    2.switch to individual emails – this plugin does that https://wordpress.org/plugins/asyncronous-bbpress-subscriptions

    manuuu1127
    Participant

    I looked through all the entries and didn’t find the answer. Maybe if someone else goes searching they will see my answer.

    If you remove the sidebar and change your page to full-width it won’t work…buttt if you create a new page and set it as full width and then put the bbpress code into it, it will go full width. My only thing now is I will probably install a plug in to put sidebars where I want them

    #198532

    In reply to: All Forums not showing

    Robin W
    Moderator

    put this in your functions file, or code snippets

    Code Snippets

    //Number of forums per page
    add_filter (‘bbp_before_has_forums_parse_args’, ‘rew_number_of_forums’) ;#

    function rew_number_of_forums ($args) {
    $args[‘posts_per_page’] = 100 ;
    return $args ;
    }

    #198512

    In reply to: increase font size

    Robin W
    Moderator

    as per op

    What I did,
    1. installed Simple Custom CSS plugin – all ok
    2. insert the below code. and changed the font-size: 1.1em; to 1.6em

    #198504

    In reply to: increase font size

    unionhost
    Participant

    hello,

    I don’t understand where do we have to copy-paste this code please ?
    I’m looking for increasing the size of the font forum; thanks

    #198450
    Robin W
    Moderator

    I’d suggest you do this as follows:

    there is a ‘hook’ that you show above called ‘<?php do_action( ‘bbp_template_before_single_topic’ ); ?>’

    This tells bbpress to do any action that is added at that point.

    so adding a hook will mean that the function is called at that point.

    The following code should go in your child theme functions file, or use the code snippets plugin

    Code Snippets

    add_action ( 'bbp_template_before_single_topic' , 'rew_back' ); 
    
    function rew_back () {
    	$text = 'click to go back' ;
    	if (bbp_get_topic_forum_id() == '25') $href = home_url( '/forum/domestics/' ) ;
    	if (bbp_get_topic_forum_id() == '33') $href = home_url( '/forum/commercial/' ) ;
    		//where to go if page not there
    	else $href = home_url( '/login/' ) ;
    	echo '<a class="button" href ="'.$href.'">'.$text.'</a>' ;
    }

    so each forum will need a line.

    #198389
    Michael
    Participant

    Hello,

    I’ve been having issues with breadcrumbs, and gone through various mechanisms to get them working efficiently with no joy.

    My needs are simple, so looking to create a simple button in my single topic template to go back to the forum the topic is a part of.

    Can anyone suggest the best URL and code to use?

    / Background:

    – I have created multiple single forums
    – I have then created multiple WP pages, and used the single forum shortcode to embed the forum in the page
    – I’d like to include one button at the top of the topic, that simply takes the user back to the relevant page that is hosting that particular forum (not the bbP forum page)

    / Location of code:

    I am guessing (non-coder) that the best location for this code would be as follows (within content-single-topic.php). Is this correct? (see code below)


    <?php

    /**
    * Single Topic Content Part
    *
    * @package bbPress
    * @subpackage Theme
    */

    ?>

    /* BUTTON HERE */

    <div id="bbpress-forums">

    <?php bbp_breadcrumb(); ?>

    <?php do_action( 'bbp_template_before_single_topic' ); ?>

    Cheers,

    Michael

    #198356
    hthornhillhww
    Participant

    Hi,

    I have created a custom notification for my site when a post is published, the code used to do this is :-

    // this is to add a fake component to BuddyPress. A registered component is needed to add notifications
    function custom_filter_notifications_get_registered_components( $component_names = array() ) {
        // Force $component_names to be an array
        if ( ! is_array( $component_names ) ) {
            $component_names = array();
        }
        // Add 'custom' component to registered components array
        array_push( $component_names, 'publishpost' );
        // Return component's with 'custom' appended
        return $component_names;
    }
    add_filter( 'bp_notifications_get_registered_components', 'custom_filter_notifications_get_registered_components' );
    
    // this hooks to post creation and saves the post id
    function bp_custom_add_notification( $post_id, $post ) {
            $post = get_post( $post_id );
            $author_id = $post->post_author;
    		
    		$blogusers = get_users( array( 'role' => 'staff' ) );
    		// Array of WP_User objects.
    		foreach ( $blogusers as $user ) {
    			bp_notifications_add_notification( array(
                'user_id'           => $user->id,
                'item_id'           => $post_id,
                'component_name'    => 'publishpost',
                'component_action'  => 'publishpost_action',
                'date_notified'     => bp_core_current_time(),
                'is_new'            => 1,
            ) );   
    		}        
    }
    add_action( 'publish_post', 'bp_custom_add_notification', 99, 2 );
    
    /**
     * Format the BuddyBar/Toolbar notifications
     *
     * @since bbPress (r5155)
     *
     * @package bbPress
     *
     * @param string $action The kind of notification being rendered
     * @param int $item_id The primary item id
     * @param int $secondary_item_id The secondary item id
     * @param int $total_items The total number of messaging-related notifications waiting for the user
     * @param string $format 'string' for BuddyBar-compatible notifications; 'array' for WP Toolbar
     */
    function custom_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) 
    {
    // New custom notifications
        if ( 'publishpost_action' === $action ) {
    
            $post = get_post( $item_id );
    		$author_name = get_the_author_meta('display_name', $post->post_author);
            $custom_title = bp_core_get_user_displayname( $post->post_author ) . ' published a new post "' . get_the_title( $item_id ) . '"';
            $custom_link  = get_permalink( $post );
            $custom_text = bp_core_get_user_displayname( $post->post_author ) . ' published a new post "' . get_the_title( $item_id ) . '"';
            // WordPress Toolbar
            if ( 'string' === $format ) {
                $return = apply_filters( 'publishpost_filter', '<a href="' . esc_url( $custom_link ) . '" title="' . esc_attr( $custom_title ) . '">' . esc_html( $custom_text ) . '</a>', $custom_text, $custom_link );
            // Deprecated BuddyBar
            } else {
                $return = apply_filters( 'publishpost_filter', array(
                    'text' => $custom_text,
                    'link' => $custom_link
                ), $custom_link, (int) $total_items, $custom_text, $custom_title );
            }
    
            return $return;
    
        } 
    	
    	if ( 'bbp_new_reply' === $action ) {
    		$topic_id    = bbp_get_reply_topic_id( $item_id );
    		$topic_title = bbp_get_topic_title( $topic_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( 'bbp_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items );
    
    		return $return;
    	}
    }
    add_filter( 'bp_notifications_get_notifications_for_user', 'custom_format_buddypress_notifications', 1, 5 );

    How can i create the same for a new bbpress topic? i’m thinking i need to change this code section but not sure how

    // this hooks to post creation and saves the post id
    function bp_custom_add_notification( $post_id, $post ) {
            $post = get_post( $post_id );
            $author_id = $post->post_author;
    		
    		$blogusers = get_users( array( 'role' => 'staff' ) );
    		// Array of WP_User objects.
    		foreach ( $blogusers as $user ) {
    			bp_notifications_add_notification( array(
                'user_id'           => $user->id,
                'item_id'           => $post_id,
                'component_name'    => 'publishpost',
                'component_action'  => 'publishpost_action',
                'date_notified'     => bp_core_current_time(),
                'is_new'            => 1,
            ) );   
    		}        
    }
    add_action( 'publish_post', 'bp_custom_add_notification', 99, 2 );

    I am using woffice as the theme, bbpress version 2.5.14, buddypress version 4.1.0 and the latest version of wordpress

    Thanks

    #198333

    In reply to: Topic View

    Robin W
    Moderator
    #198316
    hthornhillhww
    Participant

    Hi,

    I have created a custom notification for my site when a post is published, if i have buddypress activated alone i see the notification text but as soon as i activate bbpress i can no longer see the notification description. In order to work out this was happening when bbpress was activated i created a whole new blank install of wpress and only installed the two plugins and when i deactivated bbpress it showed the text.

    this is how the notification shows when bbpress is activated
    https://www.dropbox.com/s/uepps9cjcd8xan5/With%20BbPress%20no%20text.PNG?dl=0

    this is how the notification shows when bbpress is NOT activated
    https://www.dropbox.com/s/03wch6bc27nsked/Without%20BbPress%20showing%20text.PNG?dl=0

    I am using Twenty seventeen as the theme, bbpress version 2.5.14, buddypress version 4.1.0 and the latest version of wordpress

    The code i have used to generate the notification is below, and this is located in \wp-content\plugins\bp-custom.php

    <?php
    // this is to add a fake component to BuddyPress. A registered component is needed to add notifications
    function custom_filter_notifications_get_registered_components( $component_names = array() ) {
        // Force $component_names to be an array
        if ( ! is_array( $component_names ) ) {
            $component_names = array();
        }
        // Add 'custom' component to registered components array
        array_push( $component_names, 'publishpost' );
        // Return component's with 'custom' appended
        return $component_names;
    }
    add_filter( 'bp_notifications_get_registered_components', 'custom_filter_notifications_get_registered_components' );
    
    // this hooks to post creation and saves the post id
    function bp_custom_add_notification( $post_id, $post ) {
            $post = get_post( $post_id );
            $author_id = $post->post_author;
            bp_notifications_add_notification( array(
                'user_id'           => $author_id,
                'item_id'           => $post_id,
                'component_name'    => 'publishpost',
                'component_action'  => 'publishpost_action',
                'date_notified'     => bp_core_current_time(),
                'is_new'            => 1,
            ) );   
    }
    add_action( 'publish_post', 'bp_custom_add_notification', 99, 2 );
    
    function custom_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) 
    {
    // New custom notifications
        if ( 'publishpost_action' === $action ) {
    
            $post = get_post( $item_id );
    
            $custom_title = $post->post_author . ' published a new post ' . get_the_title( $item_id );
            $custom_link  = get_permalink( $post );
            $custom_text = $post->post_author . ' published a new post ' . get_the_title( $item_id );
            // WordPress Toolbar
            if ( 'string' === $format ) {
                $return = apply_filters( 'publishpost_filter', '<a href="' . esc_url( $custom_link ) . '" title="' . esc_attr( $custom_title ) . '">' . esc_html( $custom_text ) . '</a>', $custom_text, $custom_link );
            // Deprecated BuddyBar
            } else {
                $return = apply_filters( 'publishpost_filter', array(
                    'text' => $custom_text,
                    'link' => $custom_link
                ), $custom_link, (int) $total_items, $custom_text, $custom_title );
            }
    
            return $return;
    
        }
    }
    add_filter( 'bp_notifications_get_notifications_for_user', 'custom_format_buddypress_notifications', 10, 5 );

    I need to get it so that when bbpress is activated i can see the custom notification description as we use bbpress for our forums

    #198305

    Topic: Topic View

    in forum Themes
    kahlidah
    Participant

    I have searched everywhere for an answer but cant find one to this

    I have created a single page forum, using a custom page and a shortcode for forum id. The layout for this page is completely different to the rest of my site. All is good with that until you click on a topic and the topic page reverts back to the standard template of the rest of my site.

    I need the single topic page to replicate that one custom page on my site and can’t for the life of me work out how. Would be good if I could just duplicate the page layout by creating a new page and using shortcode like I did with the forum page, but the only shortcode for topics I can find is [bbp-single-topic id=$topic_id] which calls for a specific topic id, not for all topics.

    How do I get around this. Thanks in advance.

    #198276
    Howdy_McGee
    Participant

    I’m receiving a couple undefined index notices whenever viewing the settings page:

    PHP Notice:  Undefined index: args in /wp-content/plugins/bbpress/includes/admin/admin.php on line 370
    PHP Notice:  Undefined index: sanitize_callback in /wp-content/plugins/bbpress/includes/admin/admin.php on line 374

    Any ideas what could be causing this?

    #198273
    Robin W
    Moderator

    you will need to do a custom import

    Custom Import

    #198250
    ahmetinal
    Participant

    i use this but i want this files to be in topic not bottom and files must view
    after upload doc view this code <iframe src="https://docs.google.com/viewer?url=MYLOCAL URL" style="width:600px; height:500px;" frameborder="0"></iframe>
    İts possible ?

    Robin W
    Moderator

    @antipole thanks for posting the solution and link to the code 🙂

    #198197

    In reply to: Styling bbPress forum

    Robin W
    Moderator

    add this to your theme’s custom css area or the custom css area tab of my style pack plugin

    .has-sidebar:not(.error404) #primary {
    	width: 100% !important;
    }
    #198190
    letaiwanais
    Participant

    hi.

    I would like to know how to manage the form for creating a new topic.

    With the plugin BBP Pack style, I have created a button “Create a new topic” and i would like that, once you click on that button, we can write our topic and publish it after.
    For that, i already have created a dedicated page (https://blogfcombeta.wpengine.com/creer-un-nouveau-sujet/) with a bbcode.
    What i want now is to redirect the create topic button on the dedicated page, and MUST important, to delete the current form displayed in the sub forum like this page : https://blogfcombeta.wpengine.com/forum-freelance/outils-freelance/outils-productivite-gestion-de-projet-freelance/

    Is It someone who know how to do that ?

    Thanks.

    PS : if you could also help me to well positionned the Subscribe button, it would be very pleasant !
    The site is still private so for access it, please using this iD : blogfcombeta / e8556cb8

    #198175
    akenach
    Participant

    Hi Folks

    i have more forums but only need show the forums by groups created by Buddypress, this is my code, only apears One course, can somebody help me?

    add_shortcode( 'DASH_forums', 'DASH_forums_func' );
    function DASH_forums_func() {
      $group_ids = groups_get_user_groups(bp_loggedin_user_id());
      foreach($group_ids["groups"] as $group_id) {
        $nombregrupo = groups_get_group(array( 'group_id' => $group_id )) -> name;
        $descripciongrupo = groups_get_group(array( 'group_id' => $group_id )) -> description;
    
        $html .= '<div id="enlacecurso"><a href="' . home_url() . '/groups/' . $nombregrupo . '/forum">' . $nombregrupo  . ' Group Forum</a>' . (end($group_ids["groups"]) == $group_id ? '' : '' ) ;
        $html .= '</div>';
        return $html;
      }
    }
Viewing 25 results - 3,826 through 3,850 (of 32,481 total)
Skip to toolbar