Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 201 through 225 (of 32,315 total)
  • Author
    Search Results
  • #239741
    darkmattersastro
    Participant

    I have a very strange issue with links on my forum.

    If a user posts this, the post will appear on the forum properly:

    <a href="https://astrobin.com/okz16b/E/"><img src="https://astrobin.com/okz16b/E/rawthumb/gallery/get.jpg?insecure"/></a>

    If they post this instead, it will not allow them to post it:

    <a href="https://astrob.in/okz16b/E/"><img src="https://astrob.in/okz16b/E/rawthumb/gallery/get.jpg?insecure"/></a>

    If you look, the difference is one link refers to astrobin.com and one to astrob.in. I cannot find anywhere to allow astrob.in links in users posts.

    Anyone know where I can set this? 🙂

    #239727
    Allinop
    Participant
    li.bbp-header {
    display : none ;
    }

    That removes ‘creator’ ‘topic’ above the main topic post but not above the reply box which still shows ‘creator’ ‘topic’

    The second css removes the post date which i would like to have.

    With regards to the topic title I would like to achieve the same styling in this forum, a minimalistic topic title in bold with no breadcrumbs

    #239726
    Robin W
    Moderator

    Try

    li.bbp-header {
    display : none ;
    }
    
    div.bbp-topic-header div.bbp-meta {
    display : none ;
    }
    uksentinel
    Participant

    Post to original Q and A as formatting is not correct for PHP code

    https://wordpress.org/support/topic/add-xootix-login-to-bbpress/#post-17505394

    uksentinel
    Participant

    So as a slight deviation, I managed to resolve how to add a login link to “You must be logged in to reply to this topic.” and not “You must be logged in to create new topics.”.

    I use the login plugin (paid) created by Xootix and I asked them for the necessary code (PHP) to add a link to the “You must be logged in to reply to this topic.” or at least enable the wording to be clickable.

    Below is PHP code provided by Xootix and I added it to the Themes functions.php and this works very well

    add_action( ‘wp_footer’, function(){
    if( is_user_logged_in() ) return;
    ?>

    <style type=”text/css”>
    .bbp-no-reply .bbp-template-notice{
    cursor: pointer;
    }
    </style>
    <script type=”text/javascript”>
    jQuery(document).ready(function($){
    $(‘body’).on( ‘click’, ‘.bbp-no-reply .bbp-template-notice’, function(){
    $(‘.xoo-el-login-tgr’).trigger(‘click’);
    } )
    })
    </script>
    <?php
    } );

    #239698
    Robin W
    Moderator

    I think this does what you want

    add_filter ('bbp_get_reply_author_avatar', 'rew_avatar', 10 , 3) ;
    add_filter ('bbp_get_topic_author_avatar', 'rew_avatar' , 10 , 3) ;
    
    function rew_avatar ( $author_avatar, $id, $size)  {
    	if ( bbp_is_reply( $id ) ) {
    		$author = bbp_get_reply_author_display_name( $id );
    		$text = 'alt="icon avatar for '.$author.'"' ; 
    	}
    	if ( bbp_is_topic( $id ) ) {
    		$author = bbp_get_topic_author_display_name( $id );
    		$text = 'alt="icon avatar for '.$author.'"' ; 
    	}
    	$author_avatar = str_replace('alt=\'\'',$text,$author_avatar);
    return $author_avatar ;
    }
    #239696

    In reply to: Subscribe to Forum

    newtech1
    Participant

    I just got around to testing the above. I copied the code into themes function.php. Under fish caught it still says array instead of the fish species chosen in the dropdown. Also the image still does not show up.

    Any other suggestions? the Fish caught I can change it so that the user has to type in the fish species caught. Just much easier for them to choose the dropdown when entering, especially if on the lake when posting.

    It is important for the image to show up in the email because that draws much more interest than no image showing up.

    Allinop
    Participant

    Re: Website: allinop.comI have used the following css to modify the [bbp-topic-index]

    .bbp-topic-voice-count,
    .bbp-topic-reply-count,
    .bbp-topic-freshness {  /* Hides elements related to voice count, reply count, and topic freshness */
      display: none;
    }
    
    .avatar-14 {  /* Hides avatars with the class "avatar-14" */
      display: none !important;
    }
    
    .bbp-search-form {  /* Hides the bbPress search form */
      display: none;
    }

    I have 2 issues:

    Firstly, the topic titles do not take the entire horizontal space.
    It is as if the hidden elements still occupy the space.
    I have tried ‘hidden: none’ instead ‘display: none’ to no avail.

    Secondly, I’ve been trying to also remove the border around the list of latest topics.

    I have unsuccessfully tried:

    .bbp-topic {
      border: none;
    }

    and

    .bbp-topic {
      outline: none;
    }

    I would be grateful for any ideas.

    #239657
    getfree
    Participant

    Main problem, in addition to my non PHP abilities, was me using GPT 3.5. After a paid upgrade things started going way smoother, and the code works. Some parts of the parsed text such as some colouring are blocked by a theme or a plugin, but that is fine.

    Anyway, it was nice to visualize the symbols and the hand histories to the forum users.

    #239641

    Topic: Forum styling

    in forum Installation
    brett3am
    Participant

    Hello, I used the shortcode [bbp-forum-index] for my forum page so that I could adjust the sizing and spacing, but when you enter a forum past the index page, I lose those adjustments as it of course loads a different page for the forums after the index page. Is there a way to add a shortcode to the pages that load after index or do I need to do all my styling via CSS?

    #239621
    jgasba
    Participant

    To anyone stumbling into this thread wondering how the subscriptions are stored in the database, it has been updated.

    To find out what users are subscribed to a topic or thread you need to look for the _bbp_subscription meta_key in the wp_postmeta table. There is one for each user subscribed where meta_value is the ID of the user subscribed.

    So for example, to know how many users are subscribed to a forum or topic, just count the number of _bpp_subscription metadata present with post_id of the specific forum or topic

    uksentinel
    Participant

    Any guidance on the code I need to add would be most welcomed after the You cannot create new topics.

    Thanks

    uksentinel
    Participant

    Hi

    I am running BBPRESS and am looking to add a login link to Add login link to “You must be logged in to create new topics.” which appears at the bottom of Topics list when you are not logged in.

    I have copied out the Forum-Topic.php file and it is located in my Themes BBPRESS folder.

    Code in my Forum-Topic.php that I am looking to add to is ….

    <div id=”no-topic-<?php bbp_forum_id(); ?>” class=”bbp-no-topic”>
    <div class=”bbp-template-notice”>

    • <?php is_user_logged_in()
      ? esc_html_e( ‘You cannot create new topics.’, ‘bbpress’ )
      : esc_html_e( ‘You must be logged in to create new topics.’, ‘bbpress’ );
      ?>
    #239572
    Robin W
    Moderator
    .bbpress .forum h4.author {
    	display: none;
    }
    #239567
    Robin W
    Moderator

    add this to the additional css of your theme

    body.forum-archive.bbpress h5.description p {
    	display: none;
    }
    #239555

    In reply to: Subscribe to Forum

    webcreations907
    Participant

    Just meant you need to have the that code before the afc_replace array, like below

    
    
    if( !function_exists('acf_email_bbp_subscription_mail') ){
    	function acf_email_bbp_subscription_mail( $message, $topic_id, $forum_id, $user_id ) {
    		if ( function_exists( 'get_field' ) && $topic_id != 0 ) {
    			
    			// Part for fish caught before the afc_replace
    			$fish_caught = get_field('fish_caught');
    
    			if( is_array( $fish_caught ) && isset( $fish_caught['label'] ) ){
    				$fish_caught = $fish_caught['label'];
    			}else{
    				$fish_caught = '';
    			}
    
    			// Part for image, before the afc_replace
    			$image = get_field('image');
    
    			if( is_array( $image ) && isset( $image['url'] ) && !empty( $image['url'] ) ){
    				$image = '<img src="'.esc_attr($image['url']).'" alt="'.esc_attr( $image['alt'] ).'">';
    			}else{
    				$image = '';
    			}
    
    			
    			$afc_replace = array(
    				'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    				'{anglers}'         => get_field( 'anglers', $topic_id ),
    				'{fish_caught}'     => $fish_caught,
    				'{image}'           => $image
    				);
    
    			$message = strtr( $message , $afc_replace);
    		}
    
    		return $message;
    	}
    	add_filter( 'bbp_forum_subscription_mail_message' , 'acf_email_bbp_subscription_mail', 100 , 4 );
    }
    
    
    #239552

    In reply to: Remove white bar

    Robin W
    Moderator

    This is not related to bbpress, but to your youzify plugin

    add this to your custom css

    .youzify-bbp-topic-head {
    	display: none;
    }
    #239548

    In reply to: Subscribe to Forum

    newtech1
    Participant

    Thank you for your ongoing help we are almost there.
    But I am sorry I am not understanding this new information regarding the fish_caught field.
    I understand I would replace
    `$afc_replace = array(
    ‘{catch_date_time}’ => get_field( ‘catch_date_time’, $topic_id),
    ‘{anglers}’ => get_field( ‘anglers’, $topic_id )
    );`

    with this code
    `$afc_replace = array(
    ‘{catch_date_time}’ => get_field( ‘catch_date_time’, $topic_id),
    ‘{anglers}’ => get_field( ‘anglers’, $topic_id )
    ‘{fish_caught}’ => $fish_caught
    );`

    But not understanding where I would put this code

    $fish_caught = get_field('fish_caught');
    
    if( is_array( $fish_caught ) && isset( $fish_caught['label'] ) ){
    	$fish_caught = $fish_caught['label'];
    }else{
    	$fish_caught = '';
    }

    in the midst of this code. I am sure I am getting ( ) { } in the wrong places.

    if( !function_exists('acf_email_bbp_subscription_mail') ){
    	function acf_email_bbp_subscription_mail( $message, $topic_id, $forum_id, $user_id ) {
    		if ( function_exists( 'get_field' ) && $topic_id != 0 ) {
    #239535

    In reply to: Subscribe to Forum

    webcreations907
    Participant

    For the fish caught sounds like you want the label name, you’d want the code to check the value before that $acf_replace array. Something like below..

    
    
    $fish_caught = get_field('fish_caught');
    
    if( is_array( $fish_caught ) && isset( $fish_caught['label'] ) ){
    	$fish_caught = $fish_caught['label'];
    }else{
    	$fish_caught = '';
    }
    
    $afc_replace = array(
    	'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    	'{anglers}'         => get_field( 'anglers', $topic_id ),
    	'{fish_caught}'     => $fish_caught
    	);
    
    

    Same thing for the image I imagine, so you’d want the ‘url’ of the array, like above you’d want to check if it exists/uploaded before the replace array.

    
    
    $image = get_field('image');
    
    if( is_array( $image ) && isset( $image['url'] ) && !empty( $image['url'] ) ){
    	$image = '<img src="'.esc_attr($image['url']).'" alt="'.esc_attr( $image['alt'] ).'">';
    }else{
    	$image = '';
    }
    
    $afc_replace = array(
    	'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    	'{anglers}'         => get_field( 'anglers', $topic_id ),
    	'{image}'           => $image
    	);
    
    

    Hope that helps, sorry for the delay back. I’m just a user on here so was trying to help out some while I was logged in. I’d go to ACF documention and check out their field types as they have them listed there on getting the values.

    #239527

    In reply to: Subscribe to Forum

    newtech1
    Participant

    Error-Image field
    In the email the image will not display. Most likely it is because of how I have the image field being created. I do not want posters to insert images into the website media gallery. So I have created a custom field for images. Here is the script for the image field. Is there a way to make it so images show up in the email notification? I am assuming the only work around is to allow them to access the media library.

    I know there was another way for posting images using custom field but I could never get it to work.

    <?php 
    $image = get_field('image');
    if( !empty( $image ) ): ?>
        <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
    <?php endif; ?>
    #239513

    In reply to: Subscribe to Forum

    newtech1
    Participant

    I am happy to report that code works great. The two custom fields show up in the email notification.

    Here are all the custom fields. I should be able to take what you have done and make all them work. Hopefully not break anything.

    <strong>YOU CHOOSE HOW MUCH INFORMATION YOU ENTER</strong><br>
    <strong>Catch Date & Time:</strong> <?php the_field( 'catch_date_time' ) ; ?><br>
    <strong>Anglers:</strong> <?php the_field( 'anglers' ) ; ?><br>
    <strong>Weather:</strong> <?php the_field( 'weather' ) ; ?><br>
    <strong>Fish Caught:</strong> <?php the_field( 'fish_caught' ) ; ?><br>
    <strong>Kept or Released:</strong> <?php the_field( 'kept_or_released' ) ; ?><br>
    <strong>Lake Point Marker:</strong> <?php the_field( 'lake_point_marker' ) ; ?><br>
    <strong>Water_Features:</strong> <?php the_field( 'water_features' ) ; ?><br>
    <strong>Speed:</strong> <?php the_field( 'speed' ) ; ?><br>
    <strong>Fish Depth:</strong> <?php the_field( 'fish_depth' ) ; ?><br>
    <strong>Lake Depth:</strong> <?php the_field( 'lake_depth' ) ; ?><br>
    <strong>Method Used:</strong> <?php the_field( 'method_used' ) ; ?><br>
    <strong>Lure & Color:</strong> <?php the_field( 'lure_color' ) ; ?><br>

    BUT there are two custom fields that are done differently, do not know how I would do them. It is the image field and the location field, but maybe they work the same way.

    <strong>Image:</strong>
    <?php 
    $image = get_field('image');
    if( !empty( $image ) ): ?>
        <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
    <?php endif; ?> <br>
    
    <br>
    <br>
    <strong>Fishing Location: </strong> <?php the_field( 'location' ) ; ?><br>
    <?php 
    $location = get_field('location');
    if( $location ): ?>
        <div class="acf-map" data-zoom="13">
            <div class="marker" data-lat="<?php echo esc_attr($location['lat']); ?>" data-lng="<?php echo esc_attr($location['lng']); ?>"></div>
        </div>
    <?php endif; ?>
    #239507

    In reply to: Subscribe to Forum

    webcreations907
    Participant

    I have some updated code for you to try, after installing that ACF plugin I realized it wasn’t saving the post meta(your custom fields) before the mail was being called.

    So you’ll need to remove all the code previously listed including the first function, and try the below instead.

    So all you should have added is the below in your code snippets plugin, or functions.php file.

    
    
    if( function_exists( 'bbp_get_topic_post_type' ) ){
    	function newtech2_bbpress_new_topic( $post_id, $post , $update, $post_before ){
    	
    		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return;
    
    		if( !function_exists('bbp_get_topic_post_type') ){
    			return;
    		}
    
    		if ( bbp_get_topic_post_type() !== $post->post_type || ! is_admin() ) {
    			return;
    		}
    
    		if ( ! in_array( $post->post_status, [ 'private', 'publish' ] ) ) {
    			return;
    		}
    
    		if( isset( $post_before->post_status ) && $post_before->post_status == 'draft' ){
    			do_action( 'bbp_new_'.bbp_get_topic_post_type(), $post->ID , $post->post_parent, [] , $post->post_author );
    		}
    	}
    
    	add_action( 'wp_after_insert_post', 'newtech2_bbpress_new_topic', 10, 4);
    }
    
    if( !function_exists('acf_email_bbp_subscription_mail') ){
    	function acf_email_bbp_subscription_mail( $message, $topic_id, $forum_id, $user_id ) {
    		if ( function_exists( 'get_field' ) && $topic_id != 0 ) {
    			$afc_replace = array(
    				'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    				'{anglers}'         => get_field( 'anglers', $topic_id )
    				);
    
    			$message = strtr( $message , $afc_replace);
    		}
    
    		return $message;
    	}
    	add_filter( 'bbp_forum_subscription_mail_message' , 'acf_email_bbp_subscription_mail', 100 , 4 );
    }
    
    

    You’ll just leave the below in your email template as before.

    
    
    Catch Time: {catch_date_time}
    Anglers: {anglers}
    
    

    Hopefully that works out for you

    #239506

    In reply to: Subscribe to Forum

    webcreations907
    Participant

    If you’re using the style pack to edit your email template, add the below as a test to your email template.

    
    Catch Time: {catch_date_time}
    Anglers: {anglers}
    
    

    Then add this function to your functions.php file or code snippets plugin which ever your using.

    
    
    if( !function_exists('afc_email_bbp_subscription_mail') ){
    	function afc_email_bbp_subscription_mail( $message, $reply_id, $topic_id ) {
    		if ( function_exists( 'get_field' ) && $topic_id != 0 ) {
    
    			$afc_replace = array(
    				'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    				'{anglers}'         => get_field( 'anglers', $topic_id )
    				);
    
    			$message = strtr( $message , $afc_replace);
    		}
    		return $message;
    	}
    	add_filter( 'bbp_forum_subscription_mail_message' , 'afc_email_bbp_subscription_mail', 100 , 3 );
    }
    
    

    Then test it out by creating a topic in a forum that has subscribers you can test with, and make sure to set those values when creating your topic.

    #239504

    In reply to: Subscribe to Forum

    webcreations907
    Participant

    They are not in a template but in a functions run through filters, so if you were using bbpress without any plugins for email templates then the function it’s being called from is bbp_notify_topic_subscribers and the filter to change the message is bbp_subscription_mail_message.

    You can’t just added function with the same name, because it will cause your site to throw errors. But you can use the filter to change the message.

    Are you using bbp style pack template? If so give me the field name of one of you custom ACF fields for when you create topics, and I’ll see if I can come up with something for you.

    #239500

    In reply to: Subscribe to Forum

    newtech1
    Participant

    I put the following code within my theme’s functions.php file. I created a topic under the only forum I have on the site. I published it. Subscribers never received the notification. I checked emails log. It does not show any email being sent out. I am still wondering if the issue can be that if a topic is created within the backend instead of frontend could be causing the problem.

    /**
    *begin edit for subscribe notification to work
    */
    if( function_exists( 'bbp_get_topic_post_type' ) ){
    	function newtech1_bbpress_new_topic( $post ) {
    		if( isset( $post->post_type ) && $post->post_type == bbp_get_topic_post_type() ){
    			do_action( 'bbp_new_'.bbp_get_topic_post_type(), $post->ID , $post->post_parent, [] , $post->post_author );
    		}
    	}
    	add_action(  'draft_to_publish' ,  'newtech1_bbpress_new_topic', 10 );
    }
    /**
    *end edit for subscribe notification to work
    */
Viewing 25 results - 201 through 225 (of 32,315 total)
Skip to toolbar