• i have a php snippet to get account expiry of the user from my wp db..
    now i use a few wp functions to get it running($current_User) get_currentuserinfo().
    this works nicely in opera but not in chrome where the result is empty..
    I am logged in both(as thats the most obviuos doubt which comes..) here is the code..

    <?php
    $con=mysqli_connect("host","uname","admin","\wrdp1");
    $result = mysqli_query($con,"SELECT * FROM wp_usermeta");
    
    require( $_SERVER['DOCUMENT_ROOT'].'/wp-load.php' );
    require( $_SERVER['DOCUMENT_ROOT'].'/wp-content/plugins/s2member/s2member.php' );
    global $current_user;
    get_currentuserinfo();
    echo "Hello " , $current_user->display_name , "! \n";
    echo '<html>', "<br><br>",'</html>';
    echo "Your account will expire on :";
    $name=$current_user->user_login;
    $result = mysqli_query($con,"SELECT ID FROM wp_users where user_login='".$name."';");
    if (mysqli_num_rows($result) == 0) {
        echo "No record";
        exit;
    }
    while ($row = mysqli_fetch_assoc($result)) {
    $uid=$row["ID"];
    }
    $result2 = mysqli_query($con,"SELECT meta_value FROM wp_usermeta where user_id='".$uid."' AND meta_key = 'wp_s2member_auto_eot_time';");
    while ($row2 = mysqli_fetch_assoc($result2)) {
    echo '<html>', "<br>",'</html>';
        echo date("j F Y",$row2["meta_value"]);
    }
    echo '<html>', "<br><br>",'</html>';
    echo "Need an extension?", '<html><br><a href="https://www.gettefl.com/course-extension/">Click here.</a></html>';
    mysqli_close($con);
    ?>

    ive put this in a snippet in moodle on wp site

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘$currentuser working in opera, empty in chrome!!!’ is closed to new replies.