Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 476 through 500 (of 32,295 total)
  • Author
    Search Results
  • #236308
    Masahiko Kawai
    Participant

    I have eliminated the need to enter my email address by doing the following

    
    function bbp_set_default_email( $post_author_email ) {
    	if ( empty( $post_author_email ) ) {
    		$post_author_email = 'anonymous@example.com';
    	}
    	return $post_author_email;
    }
    add_filter( 'bbp_pre_anonymous_post_author_email', 'bbp_set_default_email', 10, 1 );
    
    function bbp_remove_default_email( $r, $args ) {
    	if ( $r['bbp_anonymous_email'] == 'anonymous@example.com' ) {
    		$r['bbp_anonymous_email'] = '';
    	}
    	return $r;
    }
    add_filter( 'bbp_filter_anonymous_post_data', 'bbp_remove_default_email', 10, 2 );
    

    First, use the filter hook “bbp_pre_anonymous_post_author_email” to set the default email address if the email address is blank.
    This avoids the “Invalid email address.” error.

    Second, if the return value “$r[‘bbp_anonymous_email’]” is set to the email address set earlier, return it blank.

    This way, if an email address is entered, its value is returned, if it is blank, it is returned blank.

    tronn
    Participant

    With the latest releases when navigating to a forum (not the forum index), any Elementor code is gone. Same when using just a sidebar or blocks.

    I found an old advice here https://kriesi.at/support/topic/bbpres-no-sidebar-in-topics/ but unclear where the mentioned sidebar.php is located (perhaps theme specific).

      Other things I’ve tried

    • Configured to use the same forum slug (forum, no root)
    • Disabled the main theme, use the latest WordPress default theme.
    • Disabled a redirection add-on.
    #236260
    johnboyfred11
    Participant

    Thanks Robin, unfortunately didn’t work. Surely there must be a way, there’s certainly a will but from what I have read I need to add some code somewhere! The other alternative I have read about is deactivating other plugins one by one, its very frustrating given it worked beautifully when first set up.

    #236233
    Robin W
    Moderator

    @codejp3 the issue with the convertors is 2 fold.

    1. it needs the users on both sites to be exactly the same user_ID’s
    2. With a million replies it’ll fall over and need repeating/restarting – going the database route is the best option

    #236232
    codejp3
    Participant

    @tealcfr – what Robin W suggested is probably your best bet if you need it done immediately.

    Considering that there are plenty of other topics on this very same thing and there’s been a 9 year old ticket for this very thing (https://bbpress.trac.wordpress.org/ticket/2605), your options are limited. A simple and logical approach without any code like Robin suggested above, or custom queries and perhaps some custom code like I suggested before that.

    I’ve taken a look at /includes/converters/bbPress1.php and /includes/classes/class-bbp-converter-base and I think it’s realistic to make a bbPress2.php converter to use within the default bbPress importer (and would also solve the outstanding ticket #2605). If you don’t have the skills to do that, I’d consider doing it as an addition to the bbPress community, but I’d want you (and others) to test it before it gets submitted as a patch. I could have it ready for testing within a week or two. Not a good option if you’re in a rush.

    #236223
    codejp3
    Participant

    I don’t have time to do a detailed answer right now, but what’s wrong mysqldump:
    mysqldump -u db_username -p db_name dbprefix_posts --where="post_type='forum' OR post_type='topic' OR post_type='reply'" > bbp_content.sql

    That will give you a db dump of all forum content.

    Then within phpmyadmin or whatever, doing a select query to get all of the post IDs for that forum content (forums/topics/replies):
    `
    SELECT ID FROM dbprefix_posts WHERE post_type=’forum’ OR post_type=’topic’ OR post_type=’reply’;
    `

    Export that query result from phpmyadmin which should give you a new query similar to this:
    `
    SELECT ID FROM dbprefix_posts WHERE (dbprefix_posts.ID = 5) OR (dbprefix_posts.ID = 8) OR (dbprefix_posts.ID = 11) OR (dbprefix_posts.ID = 43) OR (dbprefix_posts.ID = 86) OR (dbprefix_posts.ID = 87) OR (dbprefix_posts.ID = 88) OR (dbprefix_posts.ID = 89) OR (dbprefix_posts.ID = 91) OR (dbprefix_posts.ID = 92) OR (dbprefix_posts.ID = 93) OR (dbprefix_posts.ID = 94) OR (dbprefix_posts.ID = 95) OR (dbprefix_posts.ID = 96) OR (dbprefix_posts.ID = 97) OR (dbprefix_posts.ID = 98) OR (dbprefix_posts.ID = 99) OR (dbprefix_posts.ID = 100) OR (dbprefix_posts.ID = 110) OR (dbprefix_posts.ID = 111) OR (dbprefix_posts.ID = 112) OR (dbprefix_posts.ID = 114) OR (dbprefix_posts.ID = 115) OR (dbprefix_posts.ID = 116) OR (dbprefix_posts.ID = 117);
    `

    Then you just need to do a little find/replace to re-do the query so that it grabs all of the post_meta for those forum posts (forums/topics/replies).

    find all: dbprefix_posts
    replace with: dbprefix_postmeta

    change the beginning: ‘SELECT ID FROM’
    to: ‘SELECT * FROM’

    then find all remaining: ID
    replace with: post_id

    That will give you a new query ready to dump the post_meta like this:
    `
    SELECT * FROM dbprefix_postmeta WHERE (dbprefix_postmeta.post_id = 5) OR (dbprefix_postmeta.post_id = 8) OR (dbprefix_postmeta.post_id = 11) OR (dbprefix_postmeta.post_id = 43) OR (dbprefix_postmeta.post_id = 86) OR (dbprefix_postmeta.post_id = 87) OR (dbprefix_postmeta.post_id = 88) OR (dbprefix_postmeta.post_id = 89) OR (dbprefix_postmeta.post_id = 91) OR (dbprefix_postmeta.post_id = 92) OR (dbprefix_postmeta.post_id = 93) OR (dbprefix_postmeta.post_id = 94) OR (dbprefix_postmeta.post_id = 95) OR (dbprefix_postmeta.post_id = 96) OR (dbprefix_postmeta.post_id = 97) OR (dbprefix_postmeta.post_id = 98) OR (dbprefix_postmeta.post_id = 99) OR (dbprefix_postmeta.post_id = 100) OR (dbprefix_postmeta.post_id = 110) OR (dbprefix_postmeta.post_id = 111) OR (dbprefix_postmeta.post_id = 112) OR (dbprefix_postmeta.post_id = 114) OR (dbprefix_postmeta.post_id = 115) OR (dbprefix_postmeta.post_id = 116) OR (dbprefix_postmeta.post_id = 117);
    `

    You can then export all of the post_meta as sql dump file(s)

    Then you just have to import those dump files into the new DB, and run the bbPress fixes to re-do counts and stuff like that.

    NOTE: this approach will only work if you’re importing into a fresh DB where there are no posts with the same ID as the old DB. To import into a DB where there are existing/conflicting post IDs, a little extra work would have to be done.

    Like I said, don’t have time to give you a “polished” script to run or anything, but this should point you in the right direction.

    #236222
    Robin W
    Moderator

    php level.

    Frankly it’s really not easy to move forums, topics and replies between sites if not moving the while site.

    bbpress users custom post types, and manages the relationships between them via both post_parent and post meta. If you just export and import again, if the post ID frtom the source site is already being used by the destinatiion site, the the wp import process just allocates a free number, so the relationships gets all messed up.

    ditto if the user ID’s do not exactly match, then again these get to be wrong.

    I have done transfers as paid jobs for clients in the past, and have some code that does a few bits that get over this, but it is not really generic, so would need someone who knows WordPress database well and is happy with php. I am short on time at the moment to do the job.

    #236219
    Robin W
    Moderator

    how code savvy are you ?

    #236210
    codejp3
    Participant

    I’m posting this on behalf of another user from this topic/post. I can’t verify this, but they claim that the TinyMCE visual editor used to show for guest posters (yes, guest posting is enabled on their forum).

    They’re claiming that at some point within the past few months, that stopped.

    I tried on my dev server and confirmed that guests do NOT see any visual editor buttons, but I don’t know how long that has been the case, or if guests were ever able to see the TinyMCE editor in the first place.

    I’m scratching my brain trying to figure out how to enable the TinyMCE editor for guests. There’s nothing helpful related to this in the WP TinyMCE docs, WP Rich Text Editor Filters, or in the TinyMCE v4 docs. Browsing through /wp-includes/class-wp-editor.php (specifically the editor_settings method) was also a bust.

    The only check I’ve been able to find that determines whether or not to display it is “user_can_richedit()”, and even forcing ALL users to have richedit capabilities doesn’t solve it:
    add_filter('user_can_richedit', '__return_true');

    So my question – How do you enable the TinyMCE editor for guests???

    #236192

    In reply to: Plugin bbP g-plus-one

    ricoto
    Participant

    Hi,
    So I downloaded the new version.
    Now I have this error:
    Warning: Undefined variable $reply_id in C:\xampp\htdocs\w9\wp-content\plugins\g-plus-one2\g-plus-one.php on line 43

    Then I added this line 43:
    $reply_id = bbp_get_reply_id();

    I have no more error message but I have no G+1 button.
    I have enabled it in the settings.

    Anyway I just realized that this plugin is a Google like+1 me I’m just looking for the user to like the answer

    #236187
    ricoto
    Participant

    Hi,

    I created a shortcode to move it to a tab on my page.

    The problem is that when I place this shortcode(Post Comments as bbPress Topics) in this tab it also remains at the bottom of my page at the initial place of the comments so I have it duplicated.

    And if I remove the display of comments in the template my shortcode is not displayed.

    How to do please?

    #236186

    In reply to: Plugin bbP g-plus-one

    ricoto
    Participant

    There is this error in the response form when I activate the plugin:

    Fatal error: Uncaught TypeError: Cannot access offset of type string on string in C:\xampp\htdocs\w9\wp-content\plugins\g-plus-one\g-plus-one.php:42 Stack trace: #0 C:\xampp\htdocs\w9\wp-includes\class-wp-hook.php(308): g_plus_one_display('') #1 C:\xampp\htdocs\w9\wp-includes\class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #2 C:\xampp\htdocs\w9\wp-includes\plugin.php(517): WP_Hook->do_action(Array) #3 C:\xampp\htdocs\w9\wp-content\themes\oceanwp\bbpress\loop-single-reply.php(62): do_action('bbp_theme_befor...') #4 C:\xampp\htdocs\w9\wp-includes\template.php(785): require('C:\\xampp\\htdocs...') #5 C:\xampp\htdocs\w9\wp-content\plugins\bbpress\includes

    #236174
    david8mali
    Participant

    Hello, is there any shortcode or other way to display exactly the same profile data on another subpage? I have created a subpage with some information on it, before it I want to put the profile of the user who logs in. His profile will be displayed

    currently i have it at this address /members/test_user. I want this data to be displayed elsewhere

    #236153
    Robin W
    Moderator

    this is a notification error, and is not fatal.

    Bbpress authors have not changed this one yet.

    WordPress recommends that debug is not used on livre sites, so users should not see this.

    It was a WordPress decision to change blacklist and whitelist due to racial connotations.

    if you want to stop this displaying change the code in the file (lines 818-820) from

    // Strict mode uses WordPress "blacklist" settings
    	if ( true === $strict ) {
    		$hook_name   = 'blacklist';
    		$option_name = 'blacklist_keys';

    to

    // Strict mode uses WordPress "blacklist" settings
    	if ( true === $strict ) {
    		$hook_name   = 'disallowed';
    		$option_name = 'disallowed_keys';

    and keep a note of this change

    #236147

    Topic: Account

    in forum Installation
    Robin W
    Moderator

    unless you are using an existing forum plugin, the answer is either to pay someone to write code, or transfer by copy/paste

    aclottmann
    Participant

    Thanks, @robin-w. Understood. Exploring custom code now and other ideas for structuring things differently now. Much appreciated. BTW – what was “this additional plugin”? Am I missing something?

    #236103

    In reply to: enlarge width of forum

    Robin W
    Moderator

    This is theme related

    try this in the custom css part of your theme

    .youzify-forum .youzify-page-main-content .youzify-main-column {
    	width: 100% !important;
    }
    Robin W
    Moderator

    As described this would be very complicated, requiring both single sign on, and data links between two wordpress sites.

    I suspect it is doable, but would take many hours work and probably custom code to achieve.

    Using a single site, you could have bbpress and use this additional plugin to create private forums for groups whilst having other forums visible by all groups.

    This will not fix the sub groups having events and blog posts

    #236015

    In reply to: Forum Dashboard

    Robin W
    Moderator
    #236013

    In reply to: Customize Shortcodes

    shake1
    Participant

    I made the following because of an error, does it look ok?

    
    function filter_bbp_get_view_query_args( $args, $view ) {
        // Check if the view exists
        if ( function_exists( 'bbp_get_view' ) ) {
            if ( ! bbp_get_view( $view ) ) {
                return new WP_Error( 'invalid_view', __( 'Invalid view specified.', 'bbpress' ), $view );
            }
        }
    
        if ( 'popular' === $view ) {
            $args['date_query'] = array(
                array(
                    'after' => '1 week ago',
                ),
            );
        }
        return $args;
    }
    add_filter( 'bbp_get_view_query_args', 'filter_bbp_get_view_query_args', 10, 2 );
    
    
    #236011
    shake1
    Participant

    Questions about customization. I am using a translation tool, so my English may be unnatural.

    In [bbp-single-view id='no-replies'], closed topics are also displayed, so I would like to limit it to open topics, does the following code seem ok? Please advise.

    
    add_action( 'bbp_register_views', 'custom_bbp_no_replies' );
    
    function custom_bbp_no_replies() {
    	bbp_register_view(
    		'no-replies', 
    		__( 'Topics with no replies', 'bbpress' ),
    		apply_filters(
    			'bbp_topic_no_replies_query', 
    			array(
    				'post_parent' => 'any', 
    				'post_status' => bbp_get_public_status_id(),  // Changed to show only open topics
    				'meta_key' => '_bbp_reply_count',
    				'meta_value' => 1,
    				'meta_compare' => '<',
    				'meta_type' => 'NUMERIC'
    			)
    		), 
    		false
    	);
    }
    
    
    #236009
    shake1
    Participant

    Excuse me for asking a question about customization.
    I am using a translation tool, so my English may be unnatural.

    I would like to limit the posts displayed in [bbp-single-view id='popular'] to 7 days.

    
    function filter_bbp_get_view_query_args( $args, $view ) {
        // Check if the view exists
        if ( ! bbp_get_view( $view ) ) {
            return new WP_Error( 'invalid_view', __( 'Invalid view specified.', 'bbpress' ), $view );
        }
    
        if ( 'popular' === $view ) {
            $args['date_query'] = array(
                array(
                    'after' => '1 week ago',
                ),
            );
        }
        return $args;
    }
    add_filter( 'bbp_get_view_query_args', 'filter_bbp_get_view_query_args', 10, 2 );
    
    
    #236008
    Robin W
    Moderator

    ok, can you remove that code, and install this plugin :

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>bug fixes and you’ll see a tick box

    Fix ‘A variable Mismatch has been detected’ click and save

    #236006

    In reply to: Forum Dashboard

    Robin W
    Moderator

    dashboard>forums>add new or

    /wp-admin/post-new.php?post_type=forum

Viewing 25 results - 476 through 500 (of 32,295 total)
Skip to toolbar