Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 2,101 through 2,125 (of 32,460 total)
  • Author
    Search Results
  • #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 );
    #216579
    Tamie
    Participant

    OK Astra does not have a child theme. Now what? And what code do I use to fix this flaw?

    https://www.theshrinkingwoman.com/tswforums/

    #216570
    Robin W
    Moderator

    @neon67 – I wrote style pack because I had hundreds of code changes that did little bits and no way to control. So either it’s style pack, or you’ll need to start working out how the functions file in style pack does it – it’s around line 2356.

    #216564
    boogieboa
    Participant

    Hi there,

    How do we make site visitors who are not logged-in redirect to a registration page when they click on any topic or post in the forum? It should be a code in functions.php, I think. Any suggestions?

    It would be great to automatically send them back to where they came from once registration is complete. Is this possible?

    Many thanks,
    B

    #216548
    Robin W
    Moderator

    put this in the custom css area of your theme

    #bbpress-forums #bbp-your-profile fieldset fieldset.password {
    		display: none;
    }

    and let me know if it works !

    neon67
    Participant

    Yes, Image Upload for BBPress now. But it can be any other.

    Q. about redirecting a folder from one place to another.
    Perhaps there is a simple solution with code?

    mllapan
    Participant

    Thanks, but I found this is_bbpress function, and solved it.

    add_filter( 'the_content', 'post_ads_1_paragraph' );
     
    function post_ads_1_paragraph( $content ) {
        $ad_code = '<div class="advert" style="display: none;">Reklama1</div>';
     
        if ( is_single() && ! is_admin() && ! is_bbpress() ) {
            return prefix_insert_after_1nd_paragraph( $ad_code, 1, $content );
        }
    	
        return $content;
    }
      
    function prefix_insert_after_1nd_paragraph( $insertion, $paragraph_id, $content ) {
        $closing_p = '</p>';
        $paragraphs = explode( $closing_p, $content );
        foreach ($paragraphs as $index => $paragraph) {
     
            if ( trim( $paragraph ) ) {
                $paragraphs[$index] .= $closing_p;
            }
     
            if ( $paragraph_id == $index + 1 ) {
                $paragraphs[$index] .= $insertion;
            }
        }
         
        return implode( '', $paragraphs );
    }
    Robin W
    Moderator

    This is the bit which displays topics and replies in loop_single_reply

    <?php do_action( 'bbp_theme_before_reply_content' ); ?>
    
    <?php bbp_reply_content(); ?>
    
    <?php do_action( 'bbp_theme_after_reply_content' ); ?>

    you can hook to either of the action hooks here, or a filter in bbp_get_reply content which is called by bbp_reply_content which is in \includes\replies\template.php line 576 and ends with a filter

    return apply_filters( 'bbp_get_reply_content', $content, $reply_id );

    mllapan
    Participant

    I have this function to display advertisement after first paragprah in posts:

    add_filter( 'the_content', 'post_ads_1_paragraph' );
     
    function post_ads_1_paragraph( $content ) {
        $ad_code = '<div class="advert" style="display: none;">Reklama1</div>';
     
        if ( is_single() && ! is_admin() ) {
            return prefix_insert_after_1nd_paragraph( $ad_code, 1, $content );
        }
         
        return $content;
    }
      
    function prefix_insert_after_1nd_paragraph( $insertion, $paragraph_id, $content ) {
        $closing_p = '</p>';
        $paragraphs = explode( $closing_p, $content );
        foreach ($paragraphs as $index => $paragraph) {
     
            if ( trim( $paragraph ) ) {
                $paragraphs[$index] .= $closing_p;
            }
     
            if ( $paragraph_id == $index + 1 ) {
                $paragraphs[$index] .= $insertion;
            }
        }
         
        return implode( '', $paragraphs );
    }

    The problem is that this function is somehow hooked to bbpress forum listing (forum description) to, and shows after forum description.
    So how can I remove it from bbpress so it affects only posts?

    See word “reklama1” after each forum description: https://mllapan.com/forumi/forum/magazin/

    #216445
    bolhachefe
    Participant

    Hi there!

    Check it out my new BBPress forum site with customs design and codes:

    https://bolhabrasil.org/

    Cheers!

    #216429
    xprojectsx
    Participant

    to answer the last question that you gave: in mine
    Replies with no post_parent: 13001
    Replies with no parent in post meta: 0

    Help me, Obi-Wan Kenobi. You're my only hope.

    #216407
    Robin W
    Moderator

    is_bbpress()

    #216406
    haddlyapis
    Participant

    I have been trying to assign some js files only to their respective pages on my site, instead of loading them everywhere and have been successful apart from with my forum area.
    in my functions.php file i have tried the following:

    
    add_action ('wp_print_scripts', 'deregister_forum_scripts');
    
    function deregister_forum_scripts(){
         if ( !is_page('forum') (is_page() && in_array( 19306, get_post_ancestors( get_the_ID() ) ) ) ) {
         wp_deregister_script('forum-js');
    
    }}
    

    whereby i got the id 19306 from my database by doing:
    select ID from wp_posts where post_name = 'forum';
    As the page is http://www.apis.de/forum/
    The issue is, even if I leave out the second part of the “if” statement (i.e. “is_page()….), it doesn’t work.
    I assume this is because my forum is implemented differently to the rest of my site and is not a normal “is_page(….)”.
    Can anyone advise here how to target the forum via PHP?
    Also, i don’t think i should be using “get_post_ancestors” but “get_page_children“. But that is another topic.

    #216390
    akira010203
    Participant

    Hello, my skills are too limited to do that. I’ve simply moved it carefully to be visible for all.

    Can you please remove all our posts previous posts to clean the topic ?

    TO CONCLUDE :

    function rew () {
    
     if ( is_user_logged_in() ) {
    echo '<p><a href="http://your_url/new-posts"><div class="newposts">Show new posts</div></a></p>' ;
    }
    else
    echo '<p><a href="http://your_url/new-posts"><div class="newposts">Show new posts</div></a></p>' ;
    }

    Put this into function.php of your child theme

    .newposts {  
    	 float: left;
    	 background-color:#DD9933;
             padding: 5px 6px;
    	 margin:5px 5px 2em 0;
    			
    }
    
    .newposts a { 
            color:#f2f2f2 !important;
    	border:none;
    	border-radius:0;
    	box-shadow: none;
    	color:#ffffff;
    	font-size:13px;
    }
    

    And put that into your custom style.css. If your button doesnt appear while your loggued or while you’re not, take care of the margin and the padding of the CSS!

    You will have to create a new page “new-posts”. Add [bbp-topic-index] to this page to display your topics in order (most recent ones). If you need a more customizable list, install BBP-Style Pack and go to the Shortcodes section.

    #216379
    akira010203
    Participant

    You can see it now, I put :

    .newposts {  
    	float: left;
    	background-color:#DD9933;
    	padding: 5px 6px;
    	margin:0px 5px 2em 0;
    			
    }
    
    .newposts a { 
            color:#f2f2f2 !important;
    	border:none;
    	border-radius:0;
    	box-shadow: none;
    	color:#ffffff;
    	font-size:13px;
    #216375
    archux
    Participant

    Thank you for input
    I found what caused issue.

    the call for visual composer footer in a shortcode was:

    apply_filters( ‘the_content’, $the_post->post_content );

    The apply of do_shortcode to $the_post->post_content before echo fixed the text format output of shortcodes and footer now works.

    Thank you.

Viewing 25 results - 2,101 through 2,125 (of 32,460 total)
Skip to toolbar