Results 1 to 4 of 4

Thread: php tech with wordpress

  1. #1
    Xarzu's Avatar
    Xarzu is offline Hello World
    Join Date
    Oct 2009
    Posts
    68

    Default php tech with wordpress

    I have a question about referrals for my wordpress blog. This might be more of a PHP question than a wordpress question. After I manage to add the field to the sign-up page where the user can add a referral ID, how do I add the functionality where that referral ID can be inserted automatically in the sign-in page? I know that in PHP you can add strings at the end of a URL like?this or like?this=that but how does one make sure that this translates to a string being added to a field in the web page?

  2. #2
    hakre's Avatar
    hakre is offline Here For The Peanuts
    Join Date
    Jun 2010
    Posts
    129

    Default

    You get access to those parameter via $_GET in PHP. $_GET['this'] will contain the strong "that" then.

    PHP Code:
    <input type="hidden" name="referralid" 
        value="<?php echo htmlspecialchars($_GET['referralid'], ENT_QUOTES); ?>">
    This is all in the docs: http://www.php.net/manual/en/languag...s.external.php

    This is just a very basic example but it might be helpful to lead you some way. If real(tm) money is involved, I would advice you to get in touch with someone you can discuss your problem with more details and who can teach you about the things you need to learn. I just suggest that, because this can have security implications and you business processes might need some futher thinking, but this is out of the scope for my answer.
    hakre on wordpress (clicking this all three minutes help to keep the cache fresh - thanks)

  3. #3
    andreasnrb's Avatar
    andreasnrb is offline Kegger
    Join Date
    Jun 2009
    Posts
    594

    Default

    The WP way: For escaping in attributes you should use esc_attr_e($value) it echos also.
    <input type="hidden" name="referralid" value="<?php esc_attr_e($_GET['referralid']) ?>">

  4. #4
    Xarzu's Avatar
    Xarzu is offline Hello World
    Join Date
    Oct 2009
    Posts
    68

    Default

    The sign-up page, in wordpress, where I want to have the referral space, uses a plug-in to add fields. Unfortunately, the referral space is not one of the fields. How do I add a custom field seperate from the plug-in.

    I think solving this problem might be complex. I wonder where I should start.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •