Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 2,101 through 2,125 (of 32,466 total)
  • Author
    Search Results
  • #216723
    tierarepro
    Participant

    Actually, it was not fixed.
    Many other users have reported the same issue now.

    What is weird that some users can log in normally, but for some it throws that same error page.

    {"success":false,"data":[{"code":"bbp_converter_db_connection_failed","message":"Database connection failed."}]}

    #216720
    Back to Front
    Participant

    Hi there,

    I’m looking for a general advice if I’m hading in the right direction how to allow users to categorise their topics and replies? I’m making progess but having trouble to display those topics in the term archives, display the terms in the forum posts, etc.

    In building in custom taxonomies should I be building on top of the existing topic tags, making them hierarchical –

    Or taking the approach of registering two new taxonomies –

    • ‘region’ eg ‘Australia, New Zealand, Tasmania’
    • ‘issue’ eg ‘homelessness, rough sleeping, couchsurfing

    I’ve then added a term picker to the new topic form –

    But I’m stuck getting topics/replies to display on the the term archives,
    this doesn’t seem to work to eg to display topic on this archive
    https://www.forum.backtofrontdesign.co/region/victoria/
    am i using the correct post type slugs?

    function add_post_types_to_archives( $query ) {
    	// We do not want unintended consequences.
    	if ( is_admin() || ! $query->is_main_query() ) {
    		return;    
    	}
    
            if ( is_category() && empty( $query->query_vars['suppress_filters'] ) ) {
    
    		// Add more slugs with the other CPTs.
    		$post_types = array( 'topic');
    
    		$query->set(
    	  		'post_type',
    			array_merge(
    				array( 'post' ),
    				$post_types
    			)
    		);
    	}
    }

    I’ll keep persevering to display the terms on forum archives and single topics, but any advice or assistance from the community would be so much appreciated to get this campaign up and running.

    Forums


    A project for https://www.oldertenants.org.au/

    #216710

    In reply to: New Views Code Help

    Robin W
    Moderator

    I take it you have an add action statement

    add_action( 'bbp_register_views' ....

    View Topic By

    #216707
    erich199
    Participant

    I’m creating my own custom forum view using the register_views code. The function works but for some reason the url isn’t working. What am I missing?

           function my_custom_register_views() {
         // Latest Replies Custom View
        bbp_register_view(
            'latest-replies',
            __( 'Latest Replies', 'my_custom_register_views' ),
            apply_filters( 'bbp_register_view_latest_replies', array(
                    'orderby' => 'meta_value',
                    'order' => 'DESC',
                    'meta_key' => '_bbp_last_active_time',
                    'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()),
                    'post_type' => bbp_get_topic_post_type(),
                    'show_stickies' => false
            )
        ) );
    }
    #216700
    Robin W
    Moderator

    always learning – I’ve never considered that a plugin would stop caching to mobiles πŸ™‚

    Basically it is extra code to not cache mobiles – you have to find out what the http request is coming from and then stop the default cached request. you need to have a list of mobiles to work this out.

    Normally you would only do this if your mobile site needed different output, rather than not be cached!

    So seems that your plugin is really just a shop door to a paid product.

    I’ve always used w3 total cache, but then it was the first one I picked many years ago, and it seems to work fine, so I just keep using it.

    it does have the ability to turn off mobile caching, use a different theme, or redirect to a different site.

    Robin W
    Moderator

    that still doesn’t tell, me how you are doing the online bit.

    so you must be using some code/stuff at that point to show this. so what widget or code are you using ?

    herdager
    Participant

    Hello, I use a widget bbpress that allow the option to display “members online” but I can’t separate the normal members and the admin members

    Can I use shortcodes or a custom html to insert that options on my homepage? using elementor builder?

    #216688

    In reply to: User Last Login

    thinkercorner11
    Participant

    I fixed it πŸ™‚ . Sorry, there was no problem with your code, or the code from the developer of the theme, there was a problem with a other plugin. I use the WordFence Security plugin, which also saves the last login metadata, but in a I different place, so I have deleted the first part of the snippet (which is saving the last login metadata) and changed

    $last_login = get_user_meta($user_id, ‘last_login’, true);

    to

    $last_login = get_user_meta( $user_id, ‘wfls-last-login’, true);

    So thanks for the help, looks like the problem is solved.

    Robin W
    Moderator

    so bbpress does not do this bit, so what plugin or code are you using to display this area?

    #216685

    In reply to: User Last Login

    Robin W
    Moderator

    that’s basically a rewrite of my code, so suggest that you have a problem somewhere.

    You are putting this code in your functions file – yes ?

    in which case can you show the actual code including the function/lines before it and after it

    #216682

    In reply to: User Last Login

    thinkercorner11
    Participant

    Hmm, he said there is no function, which is overriding these functions, but he send me this code:

    function wpb_lastlogin() { 
        $last_login = get_user_meta(bbp_get_displayed_user_field( 'ID' ), 'last_login', true);
        if ($last_login) {
            $the_login_date = date_i18n(get_option('date_format'), $last_login);
        } else {
            $the_login_date = 'The user is not logged in yet.';
        }
        return $the_login_date; 
    }

    But still not working. It also could be that I messed up the integration process a bit, because I used a plugin to save the last login in the admin panel, and after this I was trying to use the snippet. Is there a way to reset the last login metadata?

    #216665
    tierarepro
    Participant

    I changed my WordPress database password and when I try to login I get the following error on wp-login.php

    {"success":false,"data":[{"code":"bbp_converter_db_connection_failed","message":"Database connection failed."}]}

    and on error.log

    [14-Dec-2020 08:43:29 UTC] PHP Warning: register_shutdown_function(): Invalid shutdown callback 'BBP_Converter_DB::__destruct' passed in /public_html/wp-content/plugins/bbpress/includes/admin/classes/class-bbp-converter-db.php on line 33

    I tried to delete and reinstall bbpress plugin, but it didn’t help.
    Any idea what is going on?

    #216655
    boogieboa
    Participant

    Thank you, @chalkie1983uk. Where in bbpress would the second snippet of code go?

    I’ve got 28 plugins installed. I’m not trying to add any more.

    Cheers

    #216653
    chalkie1983uk
    Participant

    You could use something like this in the functions.php file:

    function is_user_logged_in() {
        $user = wp_get_current_user();
     
        return $user->exists();
    }

    then look into adding a function in the bbpress like so:

    if ( is_user_logged_in() ) {
        {display the content}
    } else {
        {setup redirect}
    }

    Its a bit hard as you don’t want any plugins or addons, if you did it would be easier to just create a plugin which would automatically hook it in.

    #216647
    Robin W
    Moderator

    so is this code ONLY in style pack, if it is also in the theme, please remove it from there

    #216646

    In reply to: User Last Login

    thinkercorner11
    Participant

    Thanks for the fast reply, but unfortunately it didn’t work. It’s still showing my last login date everywhere. I have tried to look what login date will show, when I am not logged in, but it is showing the same, so I think it has something to do, that it is showing the admin last login (not the one of the current logged in user). One possibility also could be that some code of the theme is overriding the functions of bbPress, so I will ask the developer if there is any theme related code to get the user id.

    #216641

    In reply to: User Last Login

    Robin W
    Moderator

    suspect this is what you need – untested !!

    $user_id = bbp_get_displayed_user_id() ;
    $last_login = get_user_meta($user_id, 'last_login', true);

    so if you go down the route you have, you’d add a second shortcode

    function rew_lastlogin () {
    	$user_id = bbp_get_displayed_user_id() ;
    	$last_login = get_user_meta($user_id, 'last_login', true);
        $the_login_date = date_i18n(get_option('date_format'), $last_login);
       return $the_login_date; 
    }
    
    add_shortcode('bbp_lastlogin','rew_lastlogin');

    and then use

    <?php echo β€˜Last seen: β€˜. do_shortcode(β€˜[bbp_lastlogin]’) .’ ago’; ?>

    #216639
    Robin W
    Moderator

    ok, changing themes will not I think get you any further. Without being able to see your site, I can’t really help further, as I can’t examine what is being downloaded to your browser, and what is either not taking effect or being overridden.

    I take it you have been amending the 1.5em to see whether it changes – I just put a figure in there.

    as a last guess, you could try

    #bbpress-forums ul.forum-titles li.bbp-forum-info {
    	font-size: 1.5em !important;
    }
    
    #bbpress-forums ul.forum-titles li.bbp-forum-topic-count {
    	font-size: 1.5em !important;
    }
    
    #bbpress-forums ul.forum-titles li.bbp-forum-reply-count {
    	font-size: 1.5em !important;
    }
    
    #bbpress-forums ul.forum-titles li.bbp-forum-freshness {
    	font-size: 1.5em !important;
    }
    #216634
    Robin W
    Moderator

    you should not need to change theme !

    So you put this code in additional css – yes ?

    #216629
    Robin W
    Moderator
    #bbpress-forums ul.forum-titles li.bbp-forum-info {
    	font-size: 1.5em;
    }
    
    #bbpress-forums ul.forum-titles li.bbp-forum-topic-count {
    	font-size: 1.5em;
    }
    
    #bbpress-forums ul.forum-titles li.bbp-forum-reply-count {
    	font-size: 1.5em;
    }
    
    #bbpress-forums ul.forum-titles li.bbp-forum-freshness {
    	font-size: 1.5em;
    }
    #216620
    #216612
    Robin W
    Moderator

    This will display emails in topics

    add_action( 'bbp_theme_after_reply_author_details', 'rew_author_email' );
    
    function rew_author_email () {
    	$id = bbp_get_reply_id() ;
    	if (bbp_is_topic( $id ) ) {
    		$author_id      = bbp_get_topic_author_id( $id );
    		$user_info = get_userdata($author_id );
    		$user_email = $user_info->user_email;
    		echo $user_email;
    		
    	}
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

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

    or use

    Code Snippets

    #216611
    Robin W
    Moderator

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

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

    or use

    Code Snippets

    add_filter( 'bbp_current_user_can_publish_replies', 'rew_do_not_allow_anon' );
    
    function rew_do_not_allow_anon ($retval) {
    	if ( ! is_user_logged_in() ) {
    		$retval = false ;
    	}
    return $retval ;
    }
    #216593
    Robin W
    Moderator

    $content_to_add = '<a href="\create-new-post?vis='.$current_user_id.'">Add new blog</a>';

    #216590
    michaelgoal
    Participant

    function is like this and not what i posted before:
    and my problem is this:
    ?vis=$current_user_id (you can see it if you are going to the link “Add new blog”)

    function add_content_before_first_reply_content($content,$id){
    
    	$post = get_post($id);
    	$topic_id = bbp_get_topic_id();
    	$reply_id = bbp_get_reply_id();
    	$current_user_id = get_current_user_id();
    	$content_to_add = '<a href="\create-new-post?vis=$current_user_id">&nbsp;Add new blog 
                              &nbsp;&nbsp;</a>';
    
    	if ($topic_id === $reply_id) {
    		
    		$content .= $content_to_add;
    	}
    
    	return $content;
    
    }
    add_filter( 'bbp_get_reply_content', 'add_content_before_first_reply_content', 99, 2 );
Viewing 25 results - 2,101 through 2,125 (of 32,466 total)
Skip to toolbar