Support » Plugin: WP Photo Album Plus » Call to wppaAjaxRemovePhoto on frontend missed parameter

  • Resolved jeroenpeters1986

    (@jeroenpeters1986)


    Hi opaJaap,

    I have frontend uploads enabled and I also would like to approve the pics on the frontend when I am logged in. I tried this but it doesn’t work in your latest version.

    I debugged it and I saw that there is a call to wppaAjaxRemovePhoto with 2 parameters, where it expects 3.

    It seems to me (but offcourse, I cannot be sure) that parameter one was either removed or added.

    There are three parameters expected: wppaAjaxRemovePhoto(mocc, photo, isslide), but mocc isn’t passed (not as null or undefined either). It starts with photo (id) and then a boolean. It tries to generate a URL with the boolean as photo-id and that doesn’t work:
    https://www.example.nl/wp-content/plugins/wp-photo-album-plus/wppa-ajax-front.php?action=wppa&wppa-action=remove&photo-id=true
    It gives (alert) a Security Check error message.

    It seemed like an easy fix and I would have proposed the new code here, but it isn’t clear to me what mocc should be. I hope this is clear enough 🙂

    Kind regards,

    Jeroen Peters

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Wow! Clever.

    Must have been there for ages…

    wppa('mocc') is the counter (sequence number) of wppa container on the page, so the ajax call knows where on the page it came from, and what layout may need to be changed. Mocc stands for Master OCCurrance. ( as opposed to occ: Occurrance, being the sequence number in a particular post ). Both counters start at 1.

    Yes, a simple fix, but also another error, one of the two places true should be false, indicating if t was from a slide.

    The fix is in wppa-links.php lines 782:

    
    <a class="wppa-approve-'.$id.'" style="font-weight:bold; color:red; cursor:pointer;" onclick="if ( confirm(\''.__('Are you sure you want to remove this photo?', 'wp-photo-album-plus').'\') ) wppaAjaxRemovePhoto('.wppa('mocc').', \''.$id.'\', false)">
    

    and 799:

    
    <a class="wppa-approve-'.$id.'" style="font-weight:bold; color:red; cursor:pointer;" onclick="if ( confirm(\''.__('Are you sure you want to remove this photo?', 'wp-photo-album-plus').'\') ) wppaAjaxRemovePhoto('.wppa('mocc').', \''.$id.'\', true)">
    

    You should rather install the current development version 6.6.04.001 where it is fixed.
    Instructions on how to install: http://wppa.nl/docs-by-subject/development-version/

    Thank you very much for finding and analyzing this issue.

    Thread Starter jeroenpeters1986

    (@jeroenpeters1986)

    No problem, my pleasure! As it’s not my site but someone else’s (vereniging), I will wait for the new production release so ensure nothing breaks.
    Thanks for making such a quick fix!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Call to wppaAjaxRemovePhoto on frontend missed parameter’ is closed to new replies.