WordPress User Document - ZuFusion

WordPress User Document

Thank you for purchasing my plugin. If you have any questions that are beyond the scope of this documentation, please feel free to email via my user page contact form here. Thanks so much!

1. Introduction

WordPress User Document plugin includes many features that help users manage their documents easily. The admin can create / edit / delete / approve / reject documents at backend

In addition, published documents can be viewed directly online without using any additonal reading plugin.

Additionally, statistic widget helps promote the site by highlighting total views, total likes, and total documents

Main features:

  • Upload and manage documents with No Limits!

  • View documents using Google Viewer or PDF.js via your site

  • Allow users to manage their documents and share permission at frontend

  • Allow Administrators to manage documents at backend

  • Allow Administrators to manage licenses at backend

  • Widgets: Top Viewed Documents, Most Liked Documents, Most Discussed Documents, Statistic, Tag Cloud, Categories, Featured Documents, Document search, Top Downloads

  • Many configurations in Admin Control Panel: Roles, Settings, etc

  • Searching and Sorting Option

  • Email notification

  • Administrators can add documents to users

  • Secure documents under login for each user

  • Limit file types to be uploaded

  • Limit maximum file size

  • Unlimited documents for users

  • Email editor to customize all emails

  • WordPress capabilities and roles integration to limit who can do what

  • Secure files for download

  • Support BuddyPress group

  • Require logged in or non-logged in to download documents

  • IP block option to prevent downloads from unwanted IP addresses

  • Email as attachment to attach the document into their personal emails.

  • The Administrators can create / edit / delete / approve / reject documents

  • Allow automatically approve the document created by role

  • Like/UnLike document system

  • Document view/download/like counter

  • Document version control

  • Custom templates.

  • Template type: plugin or theme

  • Widget support

  • Responsive layout

  • Cross Browser (IE11+, Chrome, Safari, Firefox, Opera, Edge)

  • Translation Ready

  • Documentation included

2. Installation

Download the zipped package from Codecanyon and extract to your desktop. Before processing the installation, you need to upgrade WordPress to WordPress 5.0 or later.

You can use FTP or WordPress to install

2.1 Using WordPress

  • Log into your WP dashboard

  • Go to Plugins > Add New > Upload

  • Click Choose File .

  • Navigate to find the "wordpress-user-document.zip" file in the extracted package.

  • Click "Install Now" button.

  • Click Active plugin to activate WordPress User Document

2.2 Using FTP

  • Log into your site via FTP

  • Find the "wordpress-user-document" folder in the extracted package. Then upload this folder to the wp-content/plugins folder in your WordPress directory on your server

  • Log Into WordPress and go to Plugins > Installed Plugins. Find WordPress User Document in the list

  • Active "WordPress User Document" plugins

3. Manage licenses

Click on the Manage Documents -> Manage Licenses menu item. You will see a welcome screen like this:

Now, Right click the Add new button to add new license.

3. Create category

Click on the Manage Documents -> Categories menu item. You will see a welcome screen like this:

4. Create tag

Click on the Manage Documents -> Tags menu item. You will see a welcome screen like this:

5. Manage Documents

After the users submitted the their documents to your site, the documents display all here to you review the their documents.

Click on the Manage Documents -> All Documents menu item. You will see a welcome screen like this:

Here, Administrators can toggle Approved/Featured/Allow download status for the document without going to edit the detail document.

5.1 Reject a document

If you want to reject a the document and send the email notification for reason reject to user, you edit the detail document then select reject in Privacy box.

5.2 Approve a document

After you reviewed a the document and you want to approved the document, you edit the detail document then select approved in Privacy box. An approved notification will be sent to user

5.3 Create/edit a document

You can create/edit a document and assign to an author

6. Users to manage their documents

You need to create a My Account page to users can manage their documents, Default the plugin will create this page automatically

In which the content of my account page will includes the [wud_my_account] shortcode to display manage documents for user

With shortcode you can display anywhere. you can display them in a post/page like this

Finally, you need to set my account page for the plugin, Go to Manage Documents -> Settings -> Document

6.1 All Documents

All documents of user will be displayed here, includes the both pending and approved documents

6.2 Pending

All documents which need to wait administrator review documents

6.3 Approved

All documents which approved by administrator will be displayed here

6.4 Create a document

To create a new document, you click on Create Document button

Fields information:

  • Document Title: Document Title

  • Document Content: give some general information about the document

  • Document Excerpt: give some excerpt about the document

  • Document Image: add feature image for the document

  • Category: select a category and sub-category (if any) to classify the document

  • Tags: add some tags to the document

  • License: choose a license for the document

  • Document file: browse the document from computer with file types support

  • Max File Size: the maximum file size to be uploaded

  • Privacy:

    + Allow Download: allow other users to download the document

    + Email Attachment: allow other users to attach the document into their personal emails.

    + Configure who can see the document + Configure who can edit the document

    + Configure who can comment on the document

  • License associated: choose the available license associated

  • Anti-Spam Question

  • Terms and agreement confirm

You fill all required fields in document form then click on Submit button to submit the document to server, an email notification will be sent to administrators for reviewing the document .

6.5 Update a document

Go to My Account to find out any documents you want to edit , click on Edit button.

Administrator can allow/disable the ability of Edit/Delete their own documents in the settings page

7. Document Home Page

This page will list out all documents created by all users, You need to create a Document page to display documents, Default the plugin will create this page automatically

Now, you need to set Document page for the plugin, Go to Manage Documents -> Settings -> Document

Set Document page such as

You can use [wud_documents] shortcode to display list documents on any pages

8. Email notification

Go to Manage Documents > Settings -> Notification.

You can enable/disable notification, the plugin allows use editor to customize all emails

9. User roles

Go to Manage Documents > Settings -> Roles.

The plugin use WordPress capabilities and roles integration to limit who can do what

10. Settings

Go to Manage Documents > Settings. the plugin allows to configure File types, roles, preivew, limit upload file size, email, ...

11. The Plugin Template

11.1 Default Templates

The plugins allow use template for display layout, so you can custom template easily

You can see in the folder {root}/wp-content/plugins/wordpress-user-document/templates/

11.2 Custom Template

The plugin support overwrite, custom template from default template. You only create a wordpress-user-document in the root of activating theme. Copy the template of the plugin you need to custom to here and change what you wan to

11.3 Hook template

The plugin use action hook to render template, here is some basic actions, you can view some template of the plugin to know more actions

11.3.1 Single template

<?php
get_header('doc');

/**
 * Hook: wud_before_container.
 *
 */
do_action('wud_before_container');
   /**
    * Hook: wud_sidebar_right.
    *
    */
   do_action( 'wud_sidebar_left' );

    /**
     * Hook: wud_before_main_content.
     */
    do_action('wud_before_main_content');

     while (have_posts()) : the_post();
        wud_get_template('single/single');
     endwhile;
    /**
     * Hook: wud_after_main_content.
     *
     */
    do_action('wud_after_main_content');

    /**
     * Hook: wud_sidebar_right.
     *
     */
    do_action( 'wud_sidebar_right' );

/**
 * Hook: wud_after_container.
 *
 */
do_action('wud_after_container');
?>

<?php get_footer('doc'); ?>

11.3.2 Archive template

<?php
get_header('doc');

/**
 * Hook: wud_before_container.
 *
 */
do_action('wud_before_container');

/**
 * Hook: wud_sidebar_right.
 *
 */
do_action( 'wud_sidebar_left' );

/**
 * Hook: wud_before_main_content.
 */
do_action('wud_before_main_content');

if (have_posts()) {

    /**
     * Hook: wud_before_document_loop.
     */
    do_action('wud_before_document_loop');

    wud_document_loop_start();

    if (wud_get_loop_prop('total')) {
        while (have_posts()) {
            the_post();
            do_action('wud_doc_in_loop');
            wud_get_template_part('single/content', 'document');
        }
    }

    wud_document_loop_end();

    /**
     * Hook: wud_after_document_loop.
     */
    do_action('wud_after_document_loop');
} else {
    /**
     * Hook: wud_no_documents_found.
     */
    do_action('wud_no_documents_found');
}


/**
 * Hook: wud_after_main_content.
 *
 */
do_action('wud_after_main_content');

/**
 * Hook: wud_sidebar_right.
 *
 */
do_action( 'wud_sidebar_right' );

/**
 * Hook: wud_after_container.
 *
 */
do_action('wud_after_container');
?>

<?php get_footer('doc'); ?>

12. Hooks: Actions and filters

Introduction: What are hooks?

Hooks in WordPress essentially allow you to change or add code without editing core files. They are used extensively throughout WordPress and WordPress User Document and are very useful for developers.

There are two types of hook: actions and filters.

  • Action Hooks allow you to insert custom code at various points (wherever the hook is run).

  • Filter Hooks allow you to manipulate and return a variable which it passes

Using hooks

If you use a hook to add or manipulate code, you can add your custom code in a variety of ways:

Using action hooks

To execute your own code, you hook in by using the action hook do_action('action_name');. Here is where to place your code:

add_action( 'action_name', 'your_function_name' );

function your_function_name() {
// Your code
}

Using filter hooks

Filter hooks are called throughout are code using apply_filter( 'filter_name', $variable );. To manipulate the passed variable, you can do something like the following:

add_filter( 'filter_name', 'your_function_name' );

function your_function_name( $variable ) {
// Your code
return $variable;
}

With filters, you must return a value.

13. Hooks: The plugin supported

The developer can use these hooks function to customize display, fields, build query, ....

Actions:

  • do_action('wud_before_container')

  • do_action('wud_sidebar_left')

  • do_action('wud_before_main_content')

  • do_action('wud_before_document_loop')

  • do_action('wud_doc_in_loop')

  • do_action('wud_after_document_loop')

  • do_action('wud_no_documents_found')

  • do_action('wud_after_main_content')

  • do_action('wud_sidebar_right')

  • do_action('wud_after_container')

  • do_action('wud_archive_description')

  • do_action('wud_archive_main_header')

  • do_action( 'wud_account_home_start' )

  • do_action( 'wud_account_home_end' )

  • do_action( 'wud_account_navigation' )

  • do_action( 'wud_account_content' )

  • do_action( 'wud_query', $q, $this )

  • do_action( "wud_doc_shortcode_before_{$this->type}_wrapper", $this->attributes )

  • do_action( "wud_doc_shortcode_before_{$this->type}_loop", $this->attributes )

  • do_action( 'wud_doc_before_loop' )

  • do_action( 'wud_doc_after_loop' )

  • do_action( "wud_doc_shortcode_after_{$this->type}_loop", $this->attributes );

  • do_action( "wud_doc_shortcode_{$this->type}_loop_no_results", $this->attributes );

  • do_action( "wud_doc_shortcode_after_{$this->type}_wrapper", $this->attributes );

Filters:

  • apply_filters('wud_editor_settings', $wud_editor_settings)

  • apply_filters('wud_editor_content', isset($doc['post_content']) ? $doc['post_content'] : '')

  • apply_filters('wud_table_rows_per_page', 15) // default is 15 rows on per page of table

  • apply_filters( 'wud_my_account_message', '' ) // display message if user has not logged in

  • apply_filters('wud_widget_tag_cloud_args', $args)

  • apply_filters('wud_widget_categories_args', $cat_args, $instance)

  • apply_filters('wud_get_template_part', $template, $slug, $name) // Allow 3rd party plugins to filter template file from their plugin.

  • apply_filters('wud_template_path', 'wordpress-user-document/')

  • apply_filters('wud_get_template', $file, $template)

  • apply_filters( 'wud_visited_url', $url )

  • apply_filters('wud_message_notice', $messagewrapstart . $message . $messagewrapend, $action, $message, $messagewrapstart, $messagewrapend)

  • apply_filters('wud_main_class', $class, $sidebar)

  • apply_filters('wud_sidebar_class', $class)

  • apply_filters('wud_sidebar_main', $wud_settings->get_input_value( 'sidebar', 'sidebar' ))

  • apply_filters('wud_sidebar_single', $wud_settings->get_input_value( 'sidebar_single', 'no_sidebar' ))

  • apply_filters('wud_sidebar_value', $sidebar, $sidebar_main, $sidebar_single)

  • apply_filters( 'wud_page_title', $page_title )

  • apply_filters( 'wud_is_document', wud_is_documents() || wud_is_document_taxonomy() || wud_is_single_document() )

  • apply_filters('wud_get_' . $page . '_page_id', $page_id)

  • apply_filters( 'wud_document_loop_start', ob_get_clean() )

  • apply_filters( 'wud_document_loop_end', ob_get_clean() )

  • apply_filters( 'wud_document_post_class', $classes, $document )

  • apply_filters( 'wud_loop_documents_rows', $rows )

  • apply_filters( 'wud_loop_documents_columns', $columns )

  • apply_filters('wud_show_page_title', true)

  • apply_filters( 'wud_get_query_vars', $this->query_vars )

  • apply_filters( 'loop_doc_post_in', array() )

  • apply_filters( 'loop_doc_per_page', wud_get_default_documents_per_row() * wud_get_default_documents_rows_per_page() )

  • apply_filters( 'wud_default_document_orderby', $wud_settings->get_input_value('default_document_sortby', 'latest') )

  • apply_filters( 'wud_get_catalog_ordering_args', $args, $orderby, $order )

  • array_filter( apply_filters( 'wud_doc_query_meta_query', $meta_query, $this ) )

  • array_filter( apply_filters( 'wud_doc_query_tax_query', $tax_query, $this ) )

  • array_filter( apply_filters( 'wud_doc_query_date_query', $date_query, $this ) )

  • apply_filters( 'wud_shortcode_documents_query', $query_args, $this->attributes, $this->type )

  • apply_filters( 'wud_doc_query_max_rand_cache_count', 5 )

  • apply_filters( 'wud_pagination_args', $args )

  • apply_filters( 'wud_docs_admin_list_table_filters',$args )

  • apply_filters('wud_doc_filters', $output)

  • apply_filters( 'wud_get_endpoint_url', $url, $endpoint, $value, $permalink )

  • apply_filters('wud_sortby_options', $sor_options)

  • apply_filters('wud_range_date_options', $range_date_options)

  • apply_filters( 'wud_doc_thumbnail_size', $size, $thumbnail_id, $post )

  • apply_filters( 'wud_doc_thumbnail_html', $content, $post->ID, $thumbnail_id )

  • apply_filters( 'wud_widget_tag_cloud_args',$args )

  • apply_filters('wud_load_font_awesome', $wud_settings->get_input_value('load_fontawesome', 'yes'), $wud, $wud_settings) // enable/disbale font awesome

  • apply_filters('wud_load_grid', 'yes', $wud, $wud_settings)

  • apply_filters( 'wud_reject_doc_message', $mail_body, $doc['ID'] )

  • apply_filters( 'wud_approved_doc_message', $mail_body, $doc['ID'] )

  • apply_filters( 'wud_admin_new_doc_message', $mail_body, $doc['ID'] )

  • apply_filters( 'wud_admin_update_doc_message', $mail_body, $doc['ID'] )

14. Updating Plguin

Once the new version gets released, you can update via WordPress or FTP .

Update via FTP:

This is the safest way. If you have access via FTP to your site files, you can update the old one simply by overwriting your wp-content/plugins/wordpress-user-document folder with the newer one.

Update via WordPress:

You deactivate and delete the plugin on the Plugin’s administration page of WordPress and upload and active the updated plugin. We recommend the via FTP solution, because it’s safer.

Notice: You should not use the way Update via WordPress. Because this way if you have any changes in plugin folder it will be deleted.

15. Credits & resources

Once again, thank you for purchasing my plugin! If you have any questions that are beyond the scope of this documentation, please feel free to email via my user page contact form here!

Last updated