jappan (@jappan)

Forum Replies Created

Viewing 15 replies - 1 through 15 (of 15 total)

  • jappan
    Participant

    @jappan

    add_filter('bp_email_use_wp_mail', function () {
        return true;
    });

    you should add this code in function.php


    jappan
    Participant

    @jappan

    add_filter( 'bbp_get_form_reply_content', function( string $reply_content ) {
        if ( isset( $_GET['bbp_reply_to'] ) && (int) $_GET['bbp_reply_to'] ) {
            $display_name = get_the_author_meta( 'display_name', get_post_field( 'post_author', (int) $_GET['bbp_reply_to'] ) );
            return '@' . $display_name . PHP_EOL . $reply_content;
        }
    	return $reply_content;
    });

    You should add this code in “functions.php”.


    jappan
    Participant

    @jappan

    so I expect that it will be necessary to add “http://tokyolyric.com/wp-content/uploads/〇〇” url.


    jappan
    Participant

    @jappan

    I want to display the image file arbitrarily uploaded by the the poster on the topic screen in the bulletin board part of this site.

    https://tokyolyric.com/forums/


    jappan
    Participant

    @jappan

    I’m sorry to ask you many questions.

    I asked a question before, but I haven’t solved it yet.
    so I really need a code to solve it.

    I want to add “http://www.example.com/wp-content/uploads/○○” to the image.

    This is the code I made from Mr.Robin, but i haven’t been able to add the url to the image and display it yet.

    I’ve been studying for 2 days, and expecting that using <?php $upload_dir = wp_upload_dir(); ?>will come closer to solution, but…


    add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
    function bbp_extra_fields() {
    $value11 = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field2', true);
       echo '<label for="bbp_extra_field2">pic</label><br>';
       echo "<input type='file' name='bbp_extra_field2'  accept='.jpg,.jpeg,.png,.gif'  value='".$value11."'>";
    }
    add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
    add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );
    function bbp_save_extra_fields($topic_id=0) {
    	if (isset($_POST) && $_POST['bbp_extra_field2']!='')
        update_post_meta( $topic_id, 'bbp_extra_field2',$_POST['bbp_extra_field2'] );
    }
    add_action('bbp_template_before_replies_loop', 'bbp_show_extra_fields');
    function bbp_show_extra_fields() {
      $topic_id = bbp_get_topic_id();
      $value2 = get_post_meta( $topic_id, 'bbp_extra_field2', true);
      $img = '<img src=".$value2.">' ;
     echo "pic: ".$value2."<br>";
     echo "picture:".$img."<br>";	
    }

    jappan
    Participant

    @jappan

    Could you please give me the proper code? I really appreciate it.


    jappan
    Participant

    @jappan

    I understand that there was a problem with the file I uploaded…
    So, I have to convert the arbitrarily uploaded file to a URL.
    Or I have to upload the image to the server once,right?


    jappan
    Participant

    @jappan

    Thank you as always. Mr Robin.
    I tried the code but it didn’t work.
    so i would like to know again.

    I have set up a third field for clarity.
    ↓this is my code↓

    add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
    function bbp_extra_fields() {
       $value = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field1', true);
       echo '<label for="bbp_extra_field1">URL</label><br>';
       echo "<input type='url' name='bbp_extra_field1' value='".$value."'>";
    
       $value11 = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field2', true);
       echo '<label for="bbp_extra_field2">pic</label><br>';
       echo "<input type='file' name='bbp_extra_field2'  value='".$value11."'>";
    }
    
    add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
    add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );
    
    function bbp_save_extra_fields($topic_id=0) {
      if (isset($_POST) && $_POST['bbp_extra_field1']!='')
        update_post_meta( $topic_id, 'bbp_extra_field1', $_POST['bbp_extra_field1'] );
      if (isset($_POST) && $_POST['bbp_extra_field2']!='')
        update_post_meta( $topic_id, 'bbp_extra_field2', $_POST['bbp_extra_field2'] );
    }
    
    add_action('bbp_template_before_replies_loop', 'bbp_show_extra_fields');
    function bbp_show_extra_fields() {
      $topic_id = bbp_get_topic_id();
      $value1 = get_post_meta( $topic_id, 'bbp_extra_field1', true);
      $value2 = get_post_meta( $topic_id, 'bbp_extra_field2', true);
      $img1 = '<img src="'.$value2.'">' ;
      echo "Field 1: ".$value1."<br>";
       echo "Field 2: ".$value2."<br>";
    	echo "Field 3: ".$img1."<br>";	
    }



    jappan
    Participant

    @jappan

    Ok! Mr.Robin
    This is my code

    <!DOCTYPE html><html lang="ja"><head><div class="login-box">
    <?php if ( is_user_logged_in() ) : ?>
     <a href="<?php echo bp_loggedin_user_domain(); ?>
    "><?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ); ?></a><?php global $user_identity; echo $user_identity; ?>
    <a href="<?php echo wp_logout_url( bp_get_root_domain() ) ?>">logout</a>
    <?php else : ?><a href="http://localhost/wp01/wp-login-php">login</a><?php endif; ?></div></head>

    jappan
    Participant

    @jappan

    I achievement this php problems! THX!


    jappan
    Participant

    @jappan

    I plan to use CSS to manage the placement.


    jappan
    Participant

    @jappan

    The profile above is from the login-widget, and the profile below is from my php code.
    However, it doesn’t not have a link to the user’s profile.

    I would like to add a link to the profile screen in the image and username like above one!!!

    please teach me…
    i’m sorry for the inconvenience


    jappan
    Participant

    @jappan

    Thank you Mr.Robin!!!
    I tried using PHP code to put this button in place.
    ↓Here is the code↓

    <!DOCTYPE html>
    <html lang="ja">
    <head>
    <div class="login-box">
    <?php if ( is_user_logged_in() ) : ?>
        <?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ); ?>
    <?php global $user_identity; echo $user_identity; ?>
    	<a href="<?php echo wp_logout_url( bp_get_root_domain() ) ?>">ログアウト</a>
    <?php else : ?>
    	<a href="https://tokyolyric.com/wp-login-php">ログイン</a>
    <?php endif; ?>
    </a>
    </div>
    </head>

    but I can’t go to “user’s profile page” from “the user’s image” and “user name”.

    please let me know if there is any description to add to the code!!!

    This is my website URL


    jappan
    Participant

    @jappan

    i’m making a website for programming learning, so i’d like to know the answer…


    jappan
    Participant

    @jappan

    i want to set bottun like thisi want to set button like tis

Viewing 15 replies - 1 through 15 (of 15 total)