Show login form when guest users click on "send enquiry" in listing detail page

This topic contains 11 replies, has 4 voices, and was last updated by  Dirk 6 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #436326

    komal n
    Free User

    Hi everyone,

    I want to add the functionality in the directory where only logged in users can send enquiry. So guest users can see send enquiry link but when they click on that link, it prompts them to be logged in first by showing a login form and a link to register if they are new users.

    Thanks in advance,

    #436338

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    GeoDirectory doesn’t have a feature for that, but you could try hiding the link to the form when users are not logged in.

    That would be with Custom CSS. Try this page to read about how to create custom CSS.

    https://wpgeodirectory.com/docs/customizing-your-style/

    Can you share a link to the page with the send enquiry link?

    #436346

    Dirk
    Full Member
    Post count: 390

    No hook available? Should be in GDv2 if you don’t have one…

    #436364

    Alex Rollin
    Moderator
    Post count: 27815

    I will flag this for the developers and let you know.

    #436575

    Dirk
    Full Member
    Post count: 390

    Hi Alex,

    no answer?

    #436638

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    This could be done right now with hooks if you were a dev but i’ll look at adding this as an option.

    Stiofan

    #436681

    Dirk
    Full Member
    Post count: 390

    @stiofan,

    the question is what hook? Codex is not giving a hint!
    I found one hook, but this hook is too late as already the popup starts to open.

    Dirk

    #436904

    Dirk
    Full Member
    Post count: 390

    Can someone direct me to the hook documentation. I was not able to find it on the codex.
    Shouldn’t be that difficult as Stiofan told.

    Dirk

    #436918

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    I had a play with this today and it can almost be done by default, you can restrict the ninja form to require to be logged in and you can show any custom message (Under NF>Advanced>Restrictions)

    The auto redirect part would still require customisation, this could be done via JS or by duplicating the GD NF widget code as the exact hooks that would make it only require 1 hook are not present at the moment.

    Stiofan

    #436924

    Dirk
    Full Member
    Post count: 390

    No no, not for GDv2. I will implement this for GDv1. So please send me the hook you mentioned.

    #436961

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Ah v1!
    You can do something like this (no tested)

    
    
    add_filter('b_send_inquiry_url','_my_new_url');
    function _my_new_url($url){
    if(!get_current_user_id()){
        return "https://example.com/wp-login.php?redirect_to=".urlencode(geodir_curPageURL())."?gd_popup=send_enquiry";
    }else{
    return $url;
    }
    }

    Stiofan

    #436963

    Dirk
    Full Member
    Post count: 390

    Yes, that is the hook I was looking for.

    Thanks,
    Dirk

Viewing 12 posts - 1 through 12 (of 12 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount