PDF Upload durch Admin in Benutzer Profil (woocommerce)

  • Hi , ich würde ein Plugin/widget benötigen wo der Administrator in ein Benutzerprofil ein ePDF hochladen kann welches dann auf der Frontend Benutzerseite angezeigt wird.

    Hintergrund: Der Besucher kauft ein Paket (über woocomemrce) und bekommt durch den Anbieter nach kurzer Zeit ein zusammengestelltes Paket als PDf (wird per hand an die Wünsche angepaßt) auf der Kontoseite (Woocommerce) hochgeladen wo es der Käufer dann runterladen kann.

    • Anzeige

    Hallo!

    Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.

    • ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
    • ✔️ Deutsche Server & DSGVO-konform
    • ✔️ Persönlicher Support (kein 0815-Ticket-System)

    Mehr erfahren

  • Ich hab ee smit dem Plugin Cimy Field Value geschaft .


    Durch erzeugen eines Shortcodes konnte ich es auf die Kundenseite einbinden

    Leider wird der Dateilink nur als Text angezeigt.


    /** Dateiupload User */
    function shortcode_cimyFieldValue( $atts ) {


    global $current_user;
    $user_id = ( is_user_logged_in() ? $current_user->ID : NULL );


    /*
    * First, check to make sure the get_cimyFieldValue() function
    * exists. This way, if the plugin is not installed the site
    * doesn't blow up...
    */
    if( function_exists( 'get_cimyFieldValue' ) ) {


    // Grab the shortcode parameters
    extract( shortcode_atts( array(
    'user' => $user_id,
    'field' => '',
    'type' => '',
    'value' => ''
    ), $atts ));


    /*
    * Call the get_cimyFieldValue() function using any of the
    * user-entered parameters
    */
    if( $user_id != NULL ) {
    return get_cimyFieldValue( $user, $field, $value, $type );

    }
    }


    }


    // Adds the above function as as shortcode
    add_shortcode( 'my_cimy_field', 'shortcode_cimyFieldValue' );


    Ich habs mal mit dem code versucht : if ($type == "file") {
    echo '<a target="_blank" href="'.$value.'">';
    echo basename($value);
    echo '</a><br />';
    echo "\n\t\t";
    }

    aber es hat nichts geändert.

    Es soll als Link oder wenn eine checkbox ist soll auch diese angezeigt werden. Sow ei im Profil.

  • Habe es mit dem Code gelöst das der Link angezeigt wird.

    function cimy_extra_field_sc( $atts ) {

    get_currentuserinfo();
    $user_id = get_current_user_id();

    $a = shortcode_atts( array(
    'field' => 'something'
    ), $atts );

    $field_name = "{$a['field']}";

    $value = get_cimyFieldValue($user_id, $field_name);


    if( $value != NULL ) {
    echo '<span class="download-kunde-text"><h1>Ihre Information steht zum Download bereit</h1></span>';
    echo '<span class="download-kunde-text"><p>Hier finden Sie alle nötigen Informationen in der PDF Datei</p></span>';
    return '<span class="download-kunde"><a target="_blank" href="'.$value.'"><i class="fa fa-file-pdf-o"></i> Download File</a><br /></span>';

    }
    }
    add_shortcode( 'CIMY', 'cimy_extra_field_sc' );

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!