Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 4,051 through 4,075 (of 32,517 total)
  • Author
    Search Results
  • #196257
    rgilman
    Participant

    How can I code an activity stream that lists only the most recent post for each topic, not all recent posts (which can include many posts from the same topic) as the standard widget does?

    I’m using bbPress 2.5.14, BuddyPress 3.20 and WordPress 4.9.8 on a local dev server so no public link to the site.

    #196256
    GeekyJules
    Participant

    I’m trying to write a conditional statement to auto tag new topics based on forum.

    This is what I have so far

    add_action ( 'bbp_insert_topic', 'myprefix_assign_tag_to_post' , 10, 1 );
    add_action ( 'bbp_new_topic', 'myprefix_assign_tag_to_post', 10, 1 );
    add_action ( 'bbp_edit_topic', 'myprefix_assign_tag_to_post', 10, 1 );
    
    function myprefix_assign_tag_to_post($topic_id) {
    if( bbp_is_forum ( '168' ) && bbp_current_user_can_publish_topics() ) {
    	wp_set_post_terms( $topic_id, 'introductions', 'topic-tag', true );
    }
    
    elseif( bbp_is_forum ( '1343' ) && bbp_current_user_can_publish_topics() ) {
    		wp_set_post_terms( $topic_id, 'discovery', 'topic-tag', true );
    
    }
    }
    

    The problem is, this automatically tags the new topics with “Introductions” regardless of the forum. I tried replacing ‘bbp_is_forum’ with ‘bbp_is_single_forum’, and the same thing happens. I’ve tried replacing it with ‘bbp_is_forum_archive’ and nothing happens. I’ve even tried replacing the ID with slug, with and without the single quotes, trying it with just one IF statement, and I’m not getting the desired results.

    I also tried using is_page, hoping it would be using the default WordPress call since it used in the functions.php for topics. No joy.

    So, if someone could please tell me what I should be using instead of is_forum, is_single_forum, is_etc, that would be great.

    #196253
    maxlevel
    Participant

    I have 5 different forums.
    Only one of them should serve as a Q&A forum where people can ask us questions. Nobody should be able to reply before we reply. I could think of two ways to make that happen:

    1. The forum is moderated and all topics have to be approved before they are posted together with our answers. After posting other people can reply too.

    2. All the topics are initially private. So we can answer it and then make it public for receiving further replies.

    I could not find code or plugins to make that happen and would be very grateful for any advice.

    #196241

    In reply to: Custom Topic Statuses?

    krioteh
    Participant

    Buddy-bbPress Support The topic still works with bbPress 2.6, albeit with errors.
    You can return the form to the console settings of a specific forum using this code:

    
    add_action('add_meta_boxes', 'bbbp_support'); 
    add_action('save_post', 'bbbp_save'); 
    
    function bbbp_support() {
    	add_meta_box('bbbp_support', 'BbbPress Support', 
    	'bbbp_support_callback', 'forum'); 
    }
    // HTML код блока
    function bbbp_support_callback( $forum = falce ){
    		if ( empty( $forum->ID ) ) {
    			return;
    		}
    
    		$support_feature = bpbbpst_get_forum_support_setting( $forum->ID );
    
    		$mailing_list_style = '';
    		if ( 3 === (int) $support_feature ) {
    			$mailing_list_style = 'style="display:none"';
    		}
    
    		$support_only_style = 'style="display:none"';
    
    		if ( 2 === (int) $support_feature ) {
    			$support_only_style = '';
    		}
    
    		bpbbpst_display_forum_setting_options( $support_feature );
    		?>
    		<div class="bpbbpst-mailing-list" <?php echo $mailing_list_style;?>>
    			<h4><?php _e( 'Who should receive an email notification when a new support topic is posted ?', 'buddy-bbpress-support-topic' );?></h4>
    
    			<?php bpbbpst_checklist_moderators( $forum->ID );?>
    		</div>
    
    		<?php do_action_ref_array( 'bpbbpst_forum_support_options', array( $forum->ID, $mailing_list_style ) ); ?>
    
    		<div class="bpbbpst-support-guides" <?php echo $support_only_style;?>>
    			<h4><?php _e( 'New Topic form extras', 'buddy-bbpress-support-topic' );?></h4>
    			<label class="screen-reader-text" for="support-topic-intro"><?php esc_html_e( 'New Topic Guide', 'buddy-bbpress-support-topic' ); ?></label>
    			<textarea rows="3" cols="40" name="_bpbbpst_support_topic[intro]" id="support-topic-intro" style="width:100%"><?php echo bpbbpst_get_forum_support_topic_intro( $forum->ID );?></textarea>
    			<p class="description"><?php printf( esc_html__( 'Use this field to insert some instructions above the new topic form. Allowed tags are: %s', 'buddy-bbpress-support-topic' ), join( ', ', array_keys( (array) wp_kses_allowed_html( 'forum' ) ) ) ); ?></p>
    
    			<label class="screen-reader-text" for="support-topic-tpl"><?php esc_html_e( 'New Topic Template', 'buddy-bbpress-support-topic' ); ?></label>
    			<textarea rows="3" cols="40" name="_bpbbpst_support_topic[tpl]" id="support-topic-tpl" style="width:100%"><?php echo bpbbpst_get_forum_support_topic_template( $forum->ID );?></textarea>
    			<p class="description"><?php esc_html_e( 'The text added within this field will be used as a template for the content of new topics.', 'buddy-bbpress-support-topic' ); ?></p>
    		</div>
    		<?php
    
    		do_action_ref_array( 'bpbbpst_forum_support_options_after_guides', array( $forum->ID, $support_only_style ) );
    	}
    	function bbbp_save( $forum_id = 0 ) {
    		$support_feature   = false;
    		$is_forum_category =  bbp_is_forum_category( $forum_id );
    
    		if ( ! empty( $_POST['_bpbbpst_forum_settings'] ) ) {
    			$support_feature = absint( $_POST['_bpbbpst_forum_settings'] );
    		}
    
    		// Forum is not a category, save the support metas
    		if ( ! empty( $support_feature ) && ! $is_forum_category ) {
    			update_post_meta( $forum_id, '_bpbbpst_forum_settings', $support_feature );
    
    			if ( 3 === (int) $support_feature ) {
    				delete_post_meta( $forum_id, '_bpbbpst_support_recipients' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_topic_intro' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_topic_tpl' );
    			} else {
    				$recipients = ! empty( $_POST['_bpbbpst_support_recipients'] ) ? array_map( 'intval', $_POST['_bpbbpst_support_recipients'] ) : false ;
    
    				if ( ! empty( $recipients ) && is_array( $recipients ) && count( $recipients ) > 0 ) {
    					update_post_meta( $forum_id, '_bpbbpst_support_recipients', $recipients );
    				} else {
    					delete_post_meta( $forum_id, '_bpbbpst_support_recipients' );
    				}
    
    				if ( 2 === (int) $support_feature ) {
    					if ( ! empty( $_POST['_bpbbpst_support_topic']['intro'] ) ) {
    						update_post_meta( $forum_id, '_bpbbpst_support_topic_intro', wp_unslash( $_POST['_bpbbpst_support_topic']['intro'] ) );
    					} else {
    						delete_post_meta( $forum_id, '_bpbbpst_support_topic_intro' );
    					}
    
    					if ( ! empty( $_POST['_bpbbpst_support_topic']['tpl'] ) ) {
    						update_post_meta( $forum_id, '_bpbbpst_support_topic_tpl', wp_unslash( $_POST['_bpbbpst_support_topic']['tpl'] ) );
    					} else {
    						delete_post_meta( $forum_id, '_bpbbpst_support_topic_tpl' );
    					}
    				} else if ( ! empty( $_POST['_bpbbpst_support_topic'] ) ) {
    					delete_post_meta( $forum_id, '_bpbbpst_support_topic_intro' );
    					delete_post_meta( $forum_id, '_bpbbpst_support_topic_tpl' );
    				}
    			}
    
    			do_action( 'bpbbpst_forum_settings_updated', $forum_id, $support_feature );
    
    		// Check for support metas to eventually remove them
    		} else if ( $is_forum_category ) {
    			$support_feature = get_post_meta( $forum_id, '_bpbbpst_forum_settings', true );
    
    			if ( ! empty( $support_feature ) ) {
    				delete_post_meta( $forum_id, '_bpbbpst_forum_settings' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_recipients' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_topic_intro' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_topic_tpl' );
    			}
    		}
    
    		return $forum_id;
    	}
    

    Unfortunately, I have not yet found a way to eliminate errors when editing themes in the console: (

    #196239
    Robin W
    Moderator

    @domeboys I have remove the error code as it looked like it contained the card details of one of your customers.

    I can only repeat that you had a working site a week or so ago, and something changed to create the issues you have now. bbpress has not changed, but something has caused an error.

    This could be down to many issues, including updates you have done, or database corruption.

    I appreciate that you are feeling very frustrated.

    In your position, I would be asking HostGator to revert my site to before the issue and see if that fixes. I would also suggest you turn on debug to see if that reveals a site error.

    bbpress runs on over 300,000 websites worldwide, but there are infinite combinations of themes, plugins and data that make it impossible to say that bbpress will work in all circumstances, but the fact that your was, should mean that it could be again.

    I wish you luck in resolving.

    #196231
    eviang
    Participant

    Hi there, I took a look at that article (https://codex.bbpress.org/getting-started/forum-moderation/common-tasks/#deleting-topics) and cannot see the Trash Admin Link referenced for deleting topics from the frontend.

    Could you please advise where this might be found?

    Thanks,
    Evian

    #196220
    BrianHenryIE
    Participant

    I’ve been working on a converter to import our Invision v4 forum to bbPress. I’ve got the users, forums and topics all importing reasonably well.

    https://github.com/EnhancedAthlete/bbPress-Invision-v4-Converter

    I’m having trouble with the titles which are stored in a language table:

    core_sys_lang_words

    | word_id | ... | word_app | ... | word_key | word_default | word_custom | ...
    | 8379 | ... | forums | ... | forums_forum_2 | Generic Discussion | Generic Discussion | ...

    To retrieve a single forum title, I can use:
    SELECT word_default as forum_name FROM ipbforum.core_sys_lang_words WHERE word_key = CONCAT('forums_forum_', 2)

    or to retrieve them all, something like:

    
    SELECT word_default 
    FROM ipbforum.core_sys_lang_words 
    WHERE word_app = 'forums' 
    	AND word_key IN 
        (SELECT CONCAT(prefix, id)  FROM 
    		(SELECT 'forums_forum_' as prefix, ipbforum.forums_forums.id 
            FROM ipbforum.forums_forums) 
            AS t)
    

    Or all with the forum ids:

    
    SELECT ipbforum.core_sys_lang_words.word_default as forum_name, word_key_table.forum_id as forum_id 
    FROM ipbforum.core_sys_lang_words, 
    	(SELECT CONCAT(prefix, id) AS word_key, 
    					id AS forum_id 
    			FROM 
    				(SELECT 'forums_forum_' AS prefix, 
    								ipbforum.forums_forums.id 
    						FROM ipbforum.forums_forums) 
                            AS temp)
    	AS word_key_table
    WHERE ipbforum.core_sys_lang_words.word_key = word_key_table.word_key
    

    but I’m struggling to figure out how to write that in the BBP_Converter_Base extended class field_map[].

    I’ve looked at some other converters and don’t see anything similarly complicated so I’m assuming there’s a more straightforward way.

    Any pointers appreciated! Once this is figured, the converter should be good enough for most people’s use.

    #196214
    filout
    Participant

    In this thread (see bottom) i found the code. I think is better to remove it…

    #196189
    Robin W
    Moderator

    this seems to be some custom code the function vvd is not a bbpress one. I presume you have added this to your functions file, or a plugin has it ?

    I googled and got this thread where the snippet is mentioned

    http://bbpress37.rssing.com/chan-7465926/all_p128.html

    function vvd_no_view_ip( $author_ip, $r, $args ){
    	return __return_empty_string();
    }
    add_filter('bbp_get_author_ip','vvd_no_view_ip', 10, 3 );

    is this the code you are using ?

    haddly
    Participant

    so, with some help from a collegue, this is how to do it:

    update wp_users  
        set wp_users.user_email = "myemail@email.com"
        where
        wp_users.ID IN (
        select  
        wp_usermeta.user_id
        from wp_usermeta
        where (wp_usermeta.meta_key = "wp_capabilities") &&  (wp_usermeta.meta_value like 
        "%bbp_participant%")   
        )
        ;
    #196173
    filout
    Participant

    Hi,

    i get the error
    Too few arguments to function vvd_no_view_ip(), 2 passed in /home/sites/site64/web/wp-includes/class-wp-hook.php on line 286 and exactly 3 expected.
    Users can create topics and write comments in it but when i want to see the topc and get this error

    Regards, Thomas

    I used WordPress v4.9.8 and bbPress v2.5.14.

    #196146
    domeboys
    Participant

    This morning, my site, thecardinalnation.com was presenting 500 errors to all visitors. After three hours with support from my hosting provider, HostGator, they were able to isolate the problem to the bbPress plugin, which is now disabled. Obviously, my forums are down, but the base site is again available.

    HG Level 2 support provided the following, which they said indicates that bbPress is trying to pull from PHP 5.4, although the site is now on 7.0. (The site was on 5.4 to start the day, but it was upgraded to 7.0 as part of their trouble-shooting.) HG also said that the 500 error problem would remain even if we took PHP back to 5.4.

    The site is current on all code:
    Wordpress 4.9.8
    bbPress 2.5.14

    [Tue Nov 13 10:30:27 2018] [error] [client 192.185.1.20] Failed loading /opt/php54/lib/php/extensions/no-debug-non-zts-20100525/ZendGuardLoader.so: /opt/php54/lib/php/extensions/no-debug-non-zts-20100525/ZendGuardLoader.so: undefined symbol: zval_used_for_init, referer: http://thecardinalnation.com/login/

    I am not an IT professional, but will do my best to get any additional information as required. Thank you in advance.

    Brian Walton

    #196143
    cfrutos
    Participant

    Got to make a change in a website(can’t include it) and it uses bbpress. I’m relatively new to wp also, sorry for the trouble.

    The /forums route is being added to the nav bar and it’s configured correctly to be accessed but for some reason only the /forums route is not including a correct header/checking if there is a user logged in. How or where could I configure this.

    #196129

    In reply to: username reply thread

    Robin W
    Moderator

    set $id = the number of the user eg 6 and then use

    bbp_get_reply_author ($id)

    #196127
    liyacaty
    Participant

    Hi all.
    After a lot of testings and experiments in order to get the board running with all the same functionalities I had before in 3.0.14, I tried to install a clean version of 3.20, then install the extensions needed. The tentative was successful so I decided to follow this way to bring my old board to the new version in production mode.
    The problem is related to the data migration from 3.0 to 3.2.
    I’ve managed to export the old data from a clean 3.0.x DB (without any mod installed) and then import them in the new, empty 3.2 DB, but the two structures differ a lot, giving me many errors.
    I’ve tried to manage those errors, but editing a 150MB SQL file it’s a huge waste of time.
    I’ve looked for a routine in the php migration code present in the install subdir, but I didn’t find anything usable in a easy way.
    Has anyone met the same problem and is there anybody that could give me a draft solution?
    Thanks in advance.

    haddly
    Participant

    Hi there,
    I want to do a test mailing in my staging area, to see if a new WP plugin works for BBpress. In order to do this, i want to change all emails to my personal email address for all that are subscribed to the forum (so i don’t accidentally send out mails to real users,(this has actually happened to me before)). The problem is that the WP user_email is found in the DB wp_users and the forum meta info is found in the DB wp_usermeta. What SQL statement would i use if i wanted to change the email of all bbpress “Participants” to “myemail@email.com”. I want to do something like:
    UPDATE wp_users SET user_email = "myemail@email.com" WHERE wp_usermeta.meta_key = "participant";

    #196119
    Robin W
    Moderator

    ummm…. AsynCRONous bbPress Subscriptions changes from bbpress one email and bcc to send lots of single emails, so you have moved to the system that your server doesn’t like.

    Email providers stopping lots of emails is why bbpress moved to a single email with bcc, although now many email providers are stopping that, so it’s really hard to know what to do.

    code to send in sets would be complicated

    #196112
    shibaa987
    Participant

    Well, the above function also worked but needed some modification.

    Here is the code snippet that actually worked:

    function bbp_increase_forum_per_page( $args = array() ) {
    $args[‘posts_per_page’] = get_option( ‘_bbp_forums_per_page’, 100 );
    return $args;
    }
    add_filter( ‘bbp_before_has_forums_parse_args’, ‘bbp_increase_forum_per_page’ );

    #196109
    lookingahead
    Participant

    Oh wow — I figured it out, nm!! 🙂

    You can do it via CSS….like this:

    #group-admins {
      pointer-events: none;
      cursor: default;
      text-decoration: none;
      color: black;
    }

    And in bbPress apparently that is the correct way to write that code; the #group-admins part will likely work for everyone, just as it is, because it appears to be the default name for that.

    Whew!

    lookingahead
    Participant

    @robin-w turns out it was a BuddyPress issue. 🙂

    in the BuddyPress forums, an admin there posted this fix — and it worked!

    here’s what they said:

    Hi,

    This is hardcoded in bbpress plugin here bbpress\includes\extend\buddypress\groups.php.

    Find the line $this->slug = ‘forum’; but I think changing this may create some issues but you can check if it works fine for you or not. Also changing anything in core file is never recommended because on the next update you will lose it and then have to redo again.

    One recommendation is that always take a backup of your site when you are doing such core changes.

    Thanks

    i hate editing in the core files, but….well, this was a last resort that apparently has no other solution for now. i’ll keep looking though, and update my files in a better way if any alternative comes up.

    #196107
    lookingahead
    Participant

    I hate to resurrect an old thread, but it contains pretty much everything I’d need to reference.

    The code posted by @crzyhrse above WORKS — for removing the profile links from author avatars when those authors are replying to a thread in a forum. BRILLIANT!

    Now, I’d like to use the same technique/code on the ‘Group Administrator’ avatars.

    I want to KEEP the images, the name…just like how the code posted (above) by @crzyhrse works with people in a discussion. For the life of me, though, I can’t seem to figure out how to use that same code to disable the links in ‘Group Administrator’ avatars, while keeping the images and names intact.

    Anyone happen to have any ideas?

    Here’s the code I’m using…note that the first half is the code that works to shut off links to author profiles PERFECTLY…it’s the second chunk of code that doesn’t seem to affect ‘Group Administrators’ in the same manner.

    Here goes:

    /* Remove link urls from forum author instances...
    */
    add_filter( 'bbp_get_author_link', 'remove_author_links', 10, 2);
    add_filter( 'bbp_get_reply_author_link', 'remove_author_links', 10, 2);
    add_filter( 'bbp_get_topic_author_link', 'remove_author_links', 10, 2);
    function remove_author_links($author_link, $args) {
    $author_link = preg_replace(array('{<a[^>]*>}','{}'), array(" "), $author_link);
    return $author_link;
    }
    
    /* Remove link urls from admin avatars...
    */
    add_filter( 'BBP_Users_Admin_link', 'remove_Users_Admin_links', 10, 2);
    function remove_Users_Admin_links($Users_Admin_link, $args) {
    $Users_Admin_link = preg_replace(array('{<a[^>]*>}','{}'), array(" "), $Users_Admin_link);
    return $Users_Admin_link;
    }
    

    Thanks in advance for any and all assistance!

    #196089
    19dapperdrake53
    Participant

    HELP: WP 4.9.8; bbPress 2.5.15; site: azor.vip

    Hello, I am a senior citizen noob building a one-off site. I wish to post admin questions from my backend what will appear live on my site.

    I have written my post and clicked on Published. Nothing happens. Some time ago when I asked this same question, I was told to do something with shortcodes. I became frustrated because I don’t know what a shortcode is, where I find it, and what I do with it. So I am re-visiting my original question.

    I would be very grateful if you could give me some steps.

    #196065
    eigodeasobo
    Participant

    I would like to output topics with multiple tags.

    For that, I wrote the following code, but it did not work as I expected.

    <section class="fluits">				
    <?php
    $args_fluits = array(
      'post_type' => 'topic',
      'tax_query' => array(
        array(
          'taxonomy' => 'tag_fluits',
          'field'    => 'term_id',
          'terms'    => array( 11, 22 ),
        ),
      ),
    );
    $query_fluits = new WP_Query( $args_fluits );
    ?> 
    <?php if ( bbp_has_topics( $query_fluits ) ) : ?>
      <?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
      <?php bbp_get_template_part( 'loop',       'topics'    ); ?>
      <?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    <?php else : ?>
      <?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>
    <?php endif; ?>		
    </section>
    
    <section class="vegetables">				
    <?php
    $args_vegetables = array(
      'post_type' => 'topic',
      'tax_query' => array(
        array(
          'taxonomy' => 'tag_vegetables',
          'field'    => 'term_id',
          'terms'    => array( 33, 44 ),
        ),
      ),
    );
    $query_vegetables = new WP_Query( $args_vegetables );
    ?> 
    <?php if ( bbp_has_topics( $query_vegetables ) ) : ?>
      <?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
      <?php bbp_get_template_part( 'loop',       'topics'    ); ?>
      <?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    <?php else : ?>
      <?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>
    <?php endif; ?>		
    </section>

    Any hints or different args to use to achieve this?

    Thanks.

    lookingahead
    Participant

    @robin-w oh, i used a string modifier to change ‘forum’ to ‘discussion’ — that is how i got the tabs in buddypress groups to say ‘discussion’ versus ‘forum’

    i’ll go back and modify it to say ‘chat’ later, but for now many things in the site that used to say ‘forum’ say ‘discussion’….because i can change that at-will and it’s not causing conflicts, i’ve not updated it yet to say ‘chat.’

    the problem that is currently unmovable though is the group forum slug name; it still says ‘forum’ at the end of all buddypress groups. that was unaffected by the string modifier, and is apparently hard-coded.

    i went to the wp_options table and it does currently say ‘chat’…..sooooo…….apparently that setting is not being used in buddypress when it creates group forum slugs. it is defaulting to ‘forum’ no matter what i do.

    is there another place within bbpress where the instructions on how to create a slug for any type of forum whatsoever is listed…even ‘hard-coded’ as a default setting?

    Robin W
    Moderator

    the slug is a setting held in the database, not in code or a file.

    the single forum root slug is held in wp_options in the database, and is changed by the setting in
    dashboard>settings>forums>single forum slug where you have a label of ‘discuusion’ and I even with buddypress have a description of ‘Forum’, so something is messing round with that and stopping you setting ‘forum’ I think.

    I don’t get ‘discussion’ as the single forum label when I use buddypress, so something else is setting that, hence my suggestions above.

    so if you go to wp_options table and find _bbp_root_slug you can see what it is set to.

    You could just go to wp_options table and find _bbp_root_slug and set it to ‘chat’

Viewing 25 results - 4,051 through 4,075 (of 32,517 total)
Skip to toolbar