Forum Replies Created

Viewing 15 replies - 136 through 150 (of 158 total)
  • Thread Starter NetMonkey

    (@headmonkey)

    Actually, that was a mistake. That was my test code. The code I’m using is this:

    // Call WordPress function get_currentuserinfo()
    // For 4 standard WP fields and wp_get_current_user()
    // To call 4 custom WP my-user-fields
        /**
         * @example Safe usage: $current_user = wp_get_current_user();
         * if ( !($current_user instanceof WP_User) )
         *     return;
         */
    
    function get_currentuserinfo() {
    global $user_firstname, $user_lastname, $user_login, $user_email;
          get_currentuserinfo();
    
    function wp_get_current_user() {
    $current_user = wp_get_current_user ();
    $myvar = ($current_user->has_prop('my-field')) . $current_user->get('my-field') . '\n';
    $myvar = $WP_vals = array ();
    
    	$WP_vals = array(
    
    	'firstname' . $current_user->user_firstname . '\n',
    	'lastname' . $current_user->user_lastname . '\n',
    	'username' . $current_user->user_login . '\n',
    	'email' . $current_user->user_email . '\n',
    	'address' . $current_user->mepr-address-one . '\n',
    	'city' . $current_user->mepr-address-city . '\n',
        'state' . $current_user->mepr-address-state . '\n',
        'zip' . $current_user->mepr-address-zip . '\n'
    	);	
    
       return $WP_vals;
    	}
    }
    Thread Starter NetMonkey

    (@headmonkey)

    My most recent code that doesn’t produce syntax errors, but also produces a fail response, looks like this:

    // Call WordPress function get_currentuserinfo()
    // For 4 standard WP fields and wp_get_current_user()
    // To call 4 custom WP my-user-fields
        /**
         * @example Safe usage: $current_user = wp_get_current_user();
         * if ( !($current_user instanceof WP_User) )
         *     return;
         */
    
    function get_currentuserinfo() {
    global $user_firstname, $user_lastname, $user_login, $user_email;
          get_currentuserinfo();
    
    function wp_get_current_user() {
    $current_user = wp_get_current_user ();
    $myvar = ($current_user->has_prop('my-field')) . $current_user->get('my-field') . '\n';
    $myvar = $WP_vals = array ();
    
    	$WP_vals = array(
    
    	echo    'firstname' . $current_user->user_firstname . "\n";
    	echo	'lastname' . $current_user->user_lastname . "\n";
    	echo	'username' . $current_user->user_login . "\n";
    	echo	'email' . $current_user->user_email . "\n";
    	echo	'address' . $current_user->mepr-address-one . '<br />';
    	echo	'city' . $current_user->mepr-address-city . '<br />';
        echo    'state' . $current_user->mepr-address-state . '<br />';
        echo    'zip' . $current_user->mepr-address-zip . '<br />';
    	);	
    
    //    return $WP_vals;
    	}
    }
    Thread Starter NetMonkey

    (@headmonkey)

    bcworkz,

    I’ve been troubleshooting my code now for two weeks trying to get it to work. Now that I’ve worked through all of the syntax errors, I simply get a – Status: fail, response.

    So I thought it would be smart to see where my code is failing and I began to look into the codex examples for all of the methods to get user info to create a test file.

    None of the code I see works. I either get a syntax error, or a blank browser window. Could you please write a few lines of code I could use that would display in a browser window if the current user is logged in – username, user email, etc.? Thanks.

    Thread Starter NetMonkey

    (@headmonkey)

    Thanks for all of your input. The password presents a new issue to overcome. I’m using a user registration form plugin that I believe I can get a hook into, to do something creative here.

    Let me ask you this. If I create a second custom user password field in the DB, named anything_user_password and write data to both the WP standard password user meta and the custom and the same time, if my custom password field is set as just a text field with no other properties, shouldn’t I be able to retrieve the password from the custom password field?

    Or, since the password as it relates to all of this is just to supply something for the other login, theoretically I could have one password I would give to the other site that was a constant, so if the user changed their password on site 1, it would never effect their login on site 2. Sounds reasonable to me.

    And last, so you’d recommend I use get_currentuserinfo() to build the 4 standard fields in the array? Can it get all of my custom user data fields stored in usermeta?

    If not, would it be best from the start to call the 4 standard user fields with get_currentuserinfo() and call the 6 custom fields (which would include the custom password field) with wp_get_current_user?

    Thread Starter NetMonkey

    (@headmonkey)

    Moderator,

    My apologies for my last post not containing my code by backticks or using the code button. It won’t happen again.

    Today may be a breakthrough. I just read a post from 2011 online that said since WP 3.3, the way user data is called for custom meta fields like my mepr-fields, has changed. This and my post code could be the reason it’s not working as expected.

    The post is here > http://goo.gl/x5deHi I’m just not sure of the code syntax now that I should use to call those custom fields… I’m also starting to think that maybe only the one array called query_vals should be used and the calls to WP_user should be added to that query somehow.

    Thread Starter NetMonkey

    (@headmonkey)

    Hey bcworkz,

    Thanks for your comments. Hacking this code is the most difficult and time consuming php hack I’ve ever done. My code doesn’t even look like the post currently.

    I’ve done several code edits based on suggestions from across the internet, and it still doesn’t work!

    Let me show you and everyone what the original file looked like that I’ve tested, which works (every time) and produces a (Status: ok) result.

    But keep in mind, the file in this form does nothing that automates any process. You must retype all of the values over and over again to register every new user.

    The whole purpose of my edited file is to automate a process for the user, providing a convenience so they don’t have to register twice for two sites. Here is the static array version.

    line1 php

    // Set the Query POST parameters
    $query_vals = array(
    	'api_username' => 'api-username-here',
    	'api_password' => 'password-here',
    	'api_key' => 'key-here',
    	'firstname' => 'Mary',
    	'lastname' => 'Tester',
    	'address' => '122 Anywhere Street',
    	'city' => 'Little Rock',
    	'state' => 'AR',
    	'zip' => '72223',
    	'country' => 'US',
    	'email' => '[email protected]',
    	'username' => 'MaryTester',
    	'password' => 'password',
    	'perkalert' => 0,
    	'offer_radius' => 20,
    	'send_welcome_email' => 1
    );
    
    // Generate the POST string
    $postdata = '';
    foreach($query_vals as $key => $value) {
    	$postdata .= $key.'='.urlencode($value).'&';
    }
    
    // Chop of the trailing ampersand
    $postdata = rtrim($postdata, '&');
    
    // create a new cURL resource
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://secureserver/register_member.xml');
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
    
    // Save response to a string
    $response = curl_exec($ch);
    curl_close($ch);
    
    $xml = simplexml_load_string($response);
    
    //var_dump($xml);
    echo "Status: ".$xml->status;

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    line 48

    The first three (api fields) will always have the same value, as will the last three fields. So six fields can remain static, but the other 10 fields will always change and must be queried from the WP user DB.

    Then the user data is held in an array along with the other static first six fields, then we generate a post string, connect via curl to the other server, save the response to a simplexml load string and get a response from the server of ok or fail and we’re done.

    I’ve recoded the WP user array code five times based on suggestions and recoded the post string code maybe seven times and I still get a (fail) server message.

    Step 1 is – I first need the correct code syntax to query WP for the user fields shown. BTW, the (mepr-fields) listed in my first post are correct, they are custom usermeta fields in the WP DB.

    Should I be using – get_currentuser, or should I use wp_get_current_user? After seeing so many code changes, I don’t know how to code the WP user info needed for the array.

    CLCUSA,

    What theme are you using?

    Thread Starter NetMonkey

    (@headmonkey)

    Wow! Thanks Timm, it worked without any problems after following your recommended fix. Back to normal now without the p tags!

    Thanks bro,

    Barry

    Thread Starter NetMonkey

    (@headmonkey)

    Thanks for a quick response Timm. I just manually downloaded the new fixed 0.6 version to a local folder. Are you saying that to upgrade, I should (not) click on the automatic update inside the plugins section?

    Should I uninstall the 0.5 version or deactivate it first? What’s the exact procedure I should follow? Confused here…

    Barry

    CLCUSA,

    I’m not sure that all WordPress themes have a head.php template. If yours does, look in the templates folder using ftp, or unzip the theme to a local folder on your computer and look there to see.

    You need to locate these type entries at the very top of either a head, header, or possibly a functions file:

    <!DOCTYPE html>
    <!–[if lt IE 7]> <html class=”no-js lt-ie9 lt-ie8 lt-ie7″ <?php language_attributes(); ?>> <![endif]–>
    <!–[if IE 7]> <html class=”no-js lt-ie9 lt-ie8″ <?php language_attributes(); ?>> <![endif]–>
    <!–[if IE 8]> <html class=”no-js lt-ie9″ <?php language_attributes(); ?>> <![endif]–>
    <!–[if gt IE 8]><!–> <html class=”no-js” <?php language_attributes(); ?>> <!–<![endif]–>
    <head>
    <meta charset=”utf-8″>

    Just below the meta tag above is where you would cut-n-paste the new IE meta tag.

    Barry

    Hey,

    I did try the content=”IE+EDGE”/> , but it didn’t work for me. Like I said in my last post, It had to go in my (head.php page)where there were several other declarations, not header.php.

    I’m on an Apache server, but I may have read where the meta tag: <meta http-equiv=”X-UA-Compatible” content=”IE=Edge”/> does work on a Windows server.

    I don’t remember for sure because I read SO MANY posts online yesterday. Anyway, I’m fixed now!

    Barry

    For my purposes, you can call this one closed.

    Barry

    I figured it out guys. By placing this meta tag in my head.php, not header.php file, I got it to work in IE 11:

    <meta http-equiv=”X-UA-Compatible” content=”IE=9″>

    I knew that there was an answer here somewhere. After all, it’s just code.

    Barry

    Yes, I have cleared the cache. Fromm all that I read on the Adobe blog, once I made the edit to my (animationname_edgePreload.js) file which has new YepNope code in it, IE 11 was supposed to process it correctly, but that’s not happening yet.

    I don’t know if it knows where to find it. I’m asking if there’s something I can put in my header.php file to make IE 11 aware.

    Hello ti2m,

    That’s one answer, but I bought the full Adobe cs6 suite with Adobe Edge 1.5. To do what you suggested, I have to join the creative cloud and at a minimum, be billed 20.00 a month, when I don’t create enough animations to justify spending $240.00 a year for the app.

    From all I’ve read, all that’s needed here for IE 11 to work correctly is for IE 11 to see and process my newly edited (animationname_edgePreload.js) file which has new YepNope code in it.

    That’s what I was hoping to see in a reply, the best method to force IE 11 to process my edited file. That’s why I mentioned a possible php conditional statement.

    Do you have another suggestion, now knowing what I’m trying to accomplish?

Viewing 15 replies - 136 through 150 (of 158 total)