Advertisement
Guest User

How to force member to have enough points to send a BuddyPress Gift

a guest
May 21st, 2010
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.56 KB | None | 0 0
  1. <?php get_header() ?>
  2.  
  3.     <div id="content">
  4.  
  5.         <div class="padder">
  6.  
  7.  
  8.  
  9.             <div id="item-header">
  10.  
  11.                 <?php locate_template( array( 'members/single/member-header.php' ), true ) ?>
  12.  
  13.             </div>
  14.  
  15.  
  16.  
  17.             <div id="item-nav">
  18.  
  19.                 <div class="item-list-tabs no-ajax" id="object-nav">
  20.  
  21.                     <ul>
  22.  
  23.                         <?php bp_get_displayed_user_nav() ?>
  24.  
  25.                     </ul>
  26.  
  27.                 </div>
  28.  
  29.             </div>
  30.  
  31.  
  32.  
  33.             <div id="item-body">
  34.  
  35.  
  36.  
  37.                 <div class="item-list-tabs no-ajax" id="subnav">
  38.  
  39.                     <ul>
  40.  
  41.                         <?php bp_get_options_nav() ?>
  42.  
  43.                     </ul>
  44.  
  45.                 </div>
  46.  
  47.  
  48.  
  49.                 <h4><?php echo bp_word_or_name( __('Your Gifts', 'bp-gifts' ), __( "%s' Gifts", 'bp-gifts' )  ,false,false) ?></h4>
  50.  
  51.                
  52.  
  53. <?php if (is_user_logged_in() && !bp_is_my_profile()) { ?>
  54.  
  55.  
  56. <!-- ___________________________________CubePoints Buddypress Integration__________________ -->
  57. <?php
  58.     $cb_bp_x_points = cp_displayPoints($bp->loggedin_user->id,1,$return,0,$format);
  59.     $gift_value_cbbp = get_option('bp_gift_given_cp_bp');
  60.     $gift_value_cbbp2 = str_replace('-', "" , $gift_value_cbbp );  
  61.  
  62.     if ($cb_bp_x_points >= $gift_value_cbbp2) :
  63. ?>
  64. <!-- ___________________________________CubePoints Buddypress Integration__________________ -->
  65.  
  66.  
  67. <div id="bpgifts-waiting" style="display:none"><img src="<?php echo plugins_url('/buddypress-gifts/includes/templates/css/loading.gif') ?>" /></div>
  68. <div id="bpgifts-alert"></div><br />
  69.  
  70.                
  71.  
  72. <div class="sendgift-panel">
  73.  
  74. <div class="carousel">
  75.  
  76. <ul id="mycarousel" class="jcarousel-skin-tango">
  77.  
  78.    <!-- The content goes in here -->
  79.  
  80.    <?php
  81.  
  82.    $allgift = bp_gifts_allgift();
  83.  
  84.    foreach ($allgift as $giftitem) {
  85.  
  86.     echo '<li><img class="giftitem" id="'.$giftitem->id.'" name="'.$giftitem->gift_name.'" src="'.plugins_url('/buddypress-gifts/includes/images/').$giftitem->gift_image.'" alt="" /></li>';
  87.  
  88.     }
  89.  
  90.     ?>
  91.  
  92. </ul>
  93.  
  94. </div>
  95.  
  96.     <br/>
  97.  
  98.     <div class="sendgift-box">
  99.  
  100.     <div class="giftbox"><img class="giftbox" id="999" name="emptybox" src="<?php echo plugins_url('/buddypress-gifts/includes/images/admin/emptybox.png') ?>" style="float:left"/>
  101.  
  102.     </div>
  103.  
  104.  
  105.  
  106.     <div id="gift-message">
  107.  
  108.         <div id="gift-textarea">
  109.  
  110.             <textarea name="gift-message" id="giftms" value="" style="overflow:hidden" cols="50" ></textarea>
  111.  
  112.         </div>
  113.  
  114.  
  115.  
  116.         <div id="gift-button">
  117.  
  118.             <span class="highlight" id="sendgift-button" style="cursor:hand">Send Gift</span>
  119.  
  120.         </div>
  121.  
  122.     </div>
  123.  
  124.     </div>
  125.  
  126. </div>
  127.  
  128. <br class="clear" />
  129.  
  130.  
  131. <!-- ___________________________________CubePoints Buddypress Integration__________________ -->
  132. <?php else : ?>
  133.     <br /><h2 align="center">You need <?php echo $gift_value_cbbp2 ?> points to sent a gift.</h2><br /><br />
  134. <? endif; ?>
  135. <!-- ___________________________________CubePoints Buddypress Integration__________________ -->
  136.  
  137.  
  138. <?php } ?>
  139.  
  140.  
  141. <!--------------------- display gift activity loop --------------------------------->
  142.  
  143.  
  144.  
  145. <?php if ( bp_has_activities('scope=mentions&action=new_gifts&display_comments=threaded') ) : ?>
  146.  
  147.  
  148.  
  149.     <div class="pagination">
  150.  
  151.         <div class="pag-count"><?php bp_activity_pagination_count() ?></div>
  152.  
  153.         <div class="pagination-links"><?php bp_activity_pagination_links() ?></div>
  154.  
  155.     </div>
  156.  
  157.  
  158.  
  159.     <ul id="activity-stream" class="activity-list item-list">
  160.  
  161.  
  162.  
  163.     <?php while ( bp_activities() ) : bp_the_activity(); ?>
  164.  
  165.  
  166.  
  167.         <li class="<?php bp_activity_css_class() ?>" id="activity-<?php bp_activity_id() ?>">
  168.  
  169.  
  170.  
  171.             <div class="activity-avatar">
  172.  
  173.                 <a href="<?php bp_activity_user_link() ?>">
  174.  
  175.                     <?php bp_activity_avatar( 'type=full&width=100&height=100' ) ?>
  176.  
  177.                 </a>
  178.  
  179.             </div>
  180.  
  181.  
  182.  
  183.             <div class="activity-content">
  184.  
  185.  
  186.  
  187.                 <div class="activity-header">
  188.  
  189.                     <?php bp_activity_action() ?>
  190.  
  191.                 </div>
  192.  
  193.  
  194.  
  195.                 <?php if ( bp_get_activity_content_body() ) : ?>
  196.  
  197.                     <div class="activity-inner">
  198.  
  199.                         <?php bp_activity_content_body() ?>
  200.  
  201.                     </div>
  202.  
  203.                 <?php endif; ?>
  204.  
  205.  
  206.  
  207.                 <?php do_action( 'bp_activity_entry_content' ) ?>
  208.  
  209.                
  210.  
  211.                 <div class="activity-meta">
  212.  
  213.                     <?php if ( is_user_logged_in() && bp_activity_can_comment() ) : ?>
  214.  
  215.                         <a href="<?php bp_activity_comment_link() ?>" class="acomment-reply" id="acomment-comment-<?php bp_activity_id() ?>"><?php _e( 'Reply', 'buddypress' ) ?> (<span><?php bp_activity_comment_count() ?></span>)</a>
  216.  
  217.                     <?php endif; ?>
  218.  
  219.                
  220.  
  221.                     <?php if ( is_user_logged_in() ) : ?>
  222.  
  223.                         <?php if ( !bp_get_activity_is_favorite() ) : ?>
  224.  
  225.                             <a href="<?php bp_activity_favorite_link() ?>" class="fav" title="<?php _e( 'Mark as Favorite', 'buddypress' ) ?>"><?php _e( 'Favorite', 'buddypress' ) ?></a>
  226.  
  227.                         <?php else : ?>
  228.  
  229.                             <a href="<?php bp_activity_unfavorite_link() ?>" class="unfav" title="<?php _e( 'Remove Favorite', 'buddypress' ) ?>"><?php _e( 'Remove Favorite', 'buddypress' ) ?></a>
  230.  
  231.                         <?php endif; ?>
  232.  
  233.                     <?php endif;?>
  234.  
  235.                
  236.  
  237.                     <?php do_action( 'bp_activity_entry_meta' ) ?>
  238.  
  239.                 </div>
  240.  
  241.                
  242.  
  243.                 <?php if ( bp_activity_can_comment() ) : ?>
  244.  
  245.                     <div class="activity-comments">
  246.  
  247.                         <?php bp_activity_comments() ?>
  248.  
  249.                
  250.  
  251.                         <?php if ( is_user_logged_in() ) : ?>
  252.  
  253.                         <form action="<?php bp_activity_comment_form_action() ?>" method="post" id="ac-form-<?php bp_activity_id() ?>" class="ac-form-gifts" <?php bp_activity_comment_form_nojs_display() ?>>
  254.  
  255.                             <div class="ac-reply-avatar"><?php bp_loggedin_user_avatar( 'width=25&height=25' ) ?></div>
  256.  
  257.                             <div class="ac-reply-content">
  258.  
  259.                                 <div class="ac-textarea">
  260.  
  261.                                     <textarea id="ac-input-<?php bp_activity_id() ?>" class="ac-input" name="ac_input_<?php bp_activity_id() ?>"></textarea>
  262.  
  263.                                 </div>
  264.  
  265.                                 <input type="submit" name="ac_form_submit" value="<?php _e( 'Post', 'buddypress' ) ?> &rarr;" /> &nbsp; <?php _e( 'or press esc to cancel.', 'buddypress' ) ?>
  266.  
  267.                                 <input type="hidden" name="comment_form_id" value="<?php bp_activity_id() ?>" />
  268.  
  269.                             </div>
  270.  
  271.                             <?php wp_nonce_field( 'new_activity_comment', '_wpnonce_new_activity_comment' ) ?>
  272.  
  273.                         </form>
  274.  
  275.                         <?php endif; ?>
  276.  
  277.                        
  278.  
  279.                     </div>
  280.  
  281.                 <?php endif; ?>
  282.  
  283.             </div>
  284.  
  285.            
  286.  
  287.         </li>
  288.  
  289.  
  290.  
  291.     <?php endwhile; ?>
  292.  
  293.  
  294.  
  295.     </ul>
  296.  
  297.  
  298.  
  299. <?php else : ?>
  300.  
  301.     <div id="message" class="info">
  302.  
  303.         <p><?php echo bp_word_or_name( __('You still don\'t have any gift yet!', 'bp-gifts' ), __( "Either %s hasn't received any gift yet or they have restricted access", 'bp-gifts' )  ,false,false) ?></p>
  304.  
  305.     </div>
  306.  
  307. <?php endif; ?>
  308.  
  309.             </div><!-- #item-body -->
  310.  
  311.  
  312.  
  313.         </div><!-- .padder -->
  314.  
  315.     </div><!-- #content -->
  316.  
  317.  
  318.     <?php locate_template( array( 'sidebar.php' ), true ) ?>
  319.  
  320.  
  321. <?php get_footer() ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement