BuddyDev

Search

Redirect user trought PHP after create a gallery

  • Participant
    Level: Enlightened
    Posts: 23
    Jkk on #34034

    Dear Buddydev,

    How it’s possible redirect users to the newly created gallery page via PHP code?
    Waiting your reply.

    Kind regards,
    jkk

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #34039

    Hello Jkk,

    Thank you for posting. It is default behaviour of MediaPress means when user or group gallery created it redirect the user to upload media screen of gallery. Please do let me know which type of gallery you are dealing with i.e. users, groups or sitewide galleries? and how are you creating gallery?.

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 23
    Jkk on #34041

    Hi Ravi,

    Thank you for the reply.
    I forget to mention that we are created the page trought the magnific popu in ajax mode, and i’ve add to the create.php these lines:
    jQuery(“#mpp-gallery-create-form”).submit(function(event){
    event.preventDefault();
    var $form = jQuery(this);
    var $inputs = $form.find(“input, select, button, textarea”);
    var serializedData = $form.serialize();
    $inputs.prop(“disabled”, true);

    request = jQuery.ajax({
    url: “create.php”,
    type: “post”,
    data: serializedData
    });

    request.done(function (response, textStatus, jqXHR){
    console.log(“Gallery created!”);
    });

    request.always(function () {
    $inputs.prop(“disabled”, false);
    });

    });

    What I should put in the request.done to redirect to the gallery created?
    Thank you in advance.

    Kind regards,
    jkk

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #34069

    Hello Jkk,

    You can return the gallery URL in the ajax response and use javascript to redirect the user to this gallery URL page.

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 23
    Jkk on #34074

    Hi Ravi,

    Thank you for the reply.
    I don’t understand at all, can you please make an example?

    Kind regars,
    Jkk

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #34075

    Hello Jkk,

    As per the code mentioned above, Please check the jQuery manual for the “jQuery.ajax” function and look for the dataType attribute and how a response can be sent after completing the request.

    Try to google it for jQuery ajax tutorial with PHP.

    Regards
    Ravi

You must be logged in to reply to this topic.

This topic is: not resolved