Open extra topbar

Retrieving user from querystring

If you are new here, please see some information on how to ask for support. Thank you!

Retrieving user from querystring

dashed-slug.net Forums General discussion Retrieving user from querystring

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5585
    tfontoura
    Participant

    This is what I’d like to accomplish:

    1. Add a button “Send funds to user” into bp user profile page (done);
    2. Upon clicking, it loads wallet page with querystring "?moveUser=johndoe" (done);
    3. Retrieve from querstring and insert user “johndoe” in respective “moveUser” field of move form.

    Stuck in #3.
    Any ideas? Thanks in advance.

    (Wordfence in this website, for some reason, doesn’t allow me to elaborate any further)

    #5590
    alexg
    Keymaster

    Hello,

    First of all, it looks like what you are trying to accomplish is some type of tipping feature. So, if you haven’t already, see if the Tip the Author extension can perform the function you want.

    If you want to do exactly what you described, you will need to add some JavaScript to your page.

    You would need to attach your code to the wallets_ready event:

    
    $( 'html' ).on( 'wallets_ready', function( event, coins, nonces ) {
        // TODO add your code here
    } );
    

    Inside this, you can read your GET parameter.

    Once you have your user name in a variable, you can add it to the wallets_move form like so:

    
    if ( userName ) {
        wp.wallets.viewModels.wallets.moveUser( userName );
    }
    

    Please let me know if you have any more questions about this.

    with regards

    #5603
    tfontoura
    Participant

    Perfect! Thanks!

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