Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #3775

    First, thanks for creating an Ultimate Member add-on for sharing files between members. It’s a core feature of Ultimate Member that is missing and I’m glad that your team have provided a great solution.

    After purchasing, installing and integrating the plugin into my client’s website, I noticed a couple issues. Particularly when selecting a page as the Document Form Page and the $form_page field storing a URL. The functions seem to expect an ID instead.

    1) Document Form Page dropdown does not change when selecting a page
    The database field actually updates correctly but this is not reflected in the dropdown due to a PHP bug. Although the $form_page field contains the page URL, it’s being compared to the page ID in the code to add the “select” attribute or not.

    This can be fixed on line 187 of /wp-content/plugins/um-docs/includes/um-docs-admin.php
    INCORRECT: $option = ‘<option value=”‘ . get_page_link( $page->ID ) . ‘” ‘ . ( $form_page == $page->ID ? ‘ selected ‘ : ” ) . ‘>’;
    CORRECT: $option = ‘<option value=”‘ . get_page_link( $page->ID ) . ‘” ‘ . ( $form_page == get_page_link( $page->ID ) ? ‘ selected ‘ : ” ) . ‘>’;

    Pperhaps it should just be stored as an ID instead of a URL to begin with.
    INCORRECT: $option = ‘<option value=”‘ . get_page_link( $page->ID ) . ‘” ‘ . ( $form_page == $page->ID ? ‘ selected ‘ : ” ) . ‘>’;
    CORRECT: $option = ‘<option value=”‘ . $page->ID . ‘” ‘ . ( $form_page == $page->ID ? ‘ selected ‘ : ” ) . ‘>’;

    2) Now, there are other functions such as “function um_get_document_edit_link” which expect an ID from the $form_page field and instead it’s returning a URL. When $form_page is equal to a URL, as the option value attribute is set to above, then this function does not work.
    else {$url = get_permalink($form_page);}

    If it’s already returning a URL, it should be:
    else {$url = $form_page;}

    3) The AJAX “load more documents” button appears whether there are more documents to load or not. Often, all of the files are already showing and the button serves no purpose at that point.

    Again, I appreciate you creating and maintaining this plugin. Having looked through much of the code myself, you did a great job. I’m sure I’ll use it for my next project as well! Thanks.



    Hi Scott,
    Thanks for catching these. You are correct, in #1 it should have been $page->ID and in #2 it should accept only ID and generate the URL.

    I have already included the fix for the next plugin update.


    Thanks for the fast reply and for fixing.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.