lundi 26 janvier 2015

disable user interaction if they are the last ones on a $x value

So i've banging my head to the wall for the last 2 days So my issue is with this line


elseif ($current_user->ID == $bhistory['userid'])


i want the users to get error, if they are the last ones of $bhistory


my issue is that its not working, users are the last ones of $bhistory and they still able to click and be the last ones again and again and again of $bhistory again.


also please can someone explain this line of code in english


foreach($bidding_history as $kk => $bhistory){



<?php
$bidding_history = $current_bidding_data;
if(is_array($bidding_history) && !empty($bidding_history) ){
?>

<ul class="list-group">
<?php

foreach($bidding_history as $kk => $bhistory){
?>
<li class="list-group-item"><span class="badge pull-right"><small><?php echo $bhistory['username'] ?></small></span> <small><a href=""><?php echo $bhistory['userid']; ?></a></small></li>
<?php } ?>
</ul>

<?php }else{ ?>

<div class="text-center"><h4><?php echo $CORE->_e(array('auction','87')); ?></h4></div>



<?php
global $current_user;
$current_user = wp_get_current_user();
// MAKE BID OPTIONS
if($auction_type != 2){

// BIDDING DATA
$BIDDINGSTRING = "";

// CHECK IF THIS IS AN AFFILIATE PRODUCT OR NOT
$aff_p = get_post_meta($post->ID,'buy_link',true);
if(strlen($aff_p) > 1){
$link_l = get_home_url()."/out/".$post->ID."/buy_link/";
$btn_l = "<a href='".$link_l."' class='btn btn-primary right'>".$CORE->_e(array('auction','53'))."</a>";

// STOP BIDDING ON OWN ITEMS & IF LAST BIDDER
}elseif ($current_user->ID == $bhistory['userid']){
$btn_l = "<button class='btn' href='javascript:void(0);' onclick=\"alert('".$CORE->_e(array('auction','54'))."');\" id='bid_button'>".$CORE->_e(array('auction','70'))."</button>";
}else{ if($userdata->ID == $post->post_author) {
$btn_l = "<button class='btn' href='javascript:void(0);' onclick=\"alert('".$CORE->_e(array('auction','54','flag_noedit'))."');\" id='bid_button'>".$CORE->_e(array('auction','70'))."</button>";
}else{
$btn_l = "<button class='btn' href='javascript:void(0);' onclick=\"UpdateBidding();\" id='bid_button'>".$CORE->_e(array('auction','70'))."</button>";
}
}


S


Aucun commentaire:

Enregistrer un commentaire