/** * Send a private message reply to a thread via a POST request. * * @return string HTML * @since BuddyPress (1.2) */ function bp_legacy_theme_ajax_messages_send_reply() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } check_ajax_referer('messages_send_message'); $result = messages_new_message(array('thread_id' => (int) $_REQUEST['thread_id'], 'content' => $_REQUEST['content'])); if (!empty($result)) { // pretend we're in the message loop global $thread_template; bp_thread_has_messages(array('thread_id' => (int) $_REQUEST['thread_id'])); // set the current message to the 2nd last $thread_template->message = end($thread_template->thread->messages); $thread_template->message = prev($thread_template->thread->messages); // set current message to current key $thread_template->current_message = key($thread_template->thread->messages); // now manually iterate message like we're in the loop bp_thread_the_message(); // manually call oEmbed // this is needed because we're not at the beginning of the loop bp_messages_embed(); ?> <div class="message-box new-message <?php bp_the_thread_message_css_class(); ?> "> <div class="message-metadata"> <?php /** * Fires before the single message header is displayed. * * @since BuddyPress (1.1.0) */ do_action('bp_before_message_meta'); ?> <?php echo bp_loggedin_user_avatar('type=thumb&width=30&height=30'); ?> <strong><a href="<?php echo bp_loggedin_user_domain(); ?> "><?php bp_loggedin_user_fullname(); ?> </a> <span class="activity"><?php printf(__('Sent %s', 'buddypress'), bp_core_time_since(bp_core_current_time())); ?> </span></strong> <?php /** * Fires after the single message header is displayed. * * @since BuddyPress (1.1.0) */ do_action('bp_after_message_meta'); ?> </div> <?php /** * Fires before the message content for a private message. * * @since BuddyPress (1.1.0) */ do_action('bp_before_message_content'); ?> <div class="message-content"> <?php bp_the_thread_message_content(); ?> </div> <?php /** * Fires after the message content for a private message. * * @since BuddyPress (1.1.0) */ do_action('bp_after_message_content'); ?> <div class="clear"></div> </div> <?php // clean up the loop bp_thread_messages(); } else { echo "-1<div id='message' class='error'><p>" . __('There was a problem sending that reply. Please try again.', 'buddypress') . '</p></div>'; } exit; }
<div class="col-md-3 col-sm-6 col-xs-8"> <div id="searchicon"><i class="icon-search-2"></i></div> <?php if (function_exists('bp_loggedin_user_link') && is_user_logged_in()) { ?> <ul class="topmenu"> <li><a href="<?php bp_loggedin_user_link(); ?> " class="smallimg vbplogin"><?php $n = vbp_current_user_notification_count(); echo isset($n) && $n ? '<em></em>' : ''; bp_loggedin_user_avatar('type=full'); ?> <span><?php bp_loggedin_user_fullname(); ?> </span></a></li> <?php do_action('wplms_header_top_login'); ?> <?php if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('woocommerce/woocommerce.php')) { global $woocommerce; ?> <li><a class="smallimg vbpcart"><span class="fa fa-shopping-cart"><?php echo $woocommerce->cart->cart_contents_count ? '<em>' . $woocommerce->cart->cart_contents_count . '</em>' : ''; ?> </span></a> <div class="woocart"><?php woocommerce_mini_cart();
/** * Send a private message reply to a thread via a POST request. * * @return string HTML * @since BuddyPress (1.2) */ function bp_dtheme_ajax_messages_send_reply() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } check_ajax_referer('messages_send_message'); $result = messages_new_message(array('thread_id' => $_REQUEST['thread_id'], 'content' => $_REQUEST['content'])); if ($result) { ?> <div class="message-box new-message"> <div class="message-metadata"> <?php do_action('bp_before_message_meta'); ?> <?php echo bp_loggedin_user_avatar('type=thumb&width=30&height=30'); ?> <strong><a href="<?php echo bp_loggedin_user_domain(); ?> "><?php bp_loggedin_user_fullname(); ?> </a> <span class="activity"><?php printf(__('Sent %s', 'logicalboneshug'), bp_core_time_since(bp_core_current_time())); ?> </span></strong> <?php do_action('bp_after_message_meta'); ?> </div> <?php do_action('bp_before_message_content'); ?> <div class="message-content"> <?php echo stripslashes(apply_filters('bp_get_the_thread_message_content', $_REQUEST['content'])); ?> </div> <?php do_action('bp_after_message_content'); ?> <div class="clear"></div> </div> <?php } else { echo "-1<div id='message' class='error'><p>" . __('There was a problem sending that reply. Please try again.', 'logicalboneshug') . '</p></div>'; } exit; }
/** * Send a private message reply to a thread via a POST request. * * @return string HTML * @since BuddyPress (1.2) */ function bp_legacy_theme_ajax_messages_send_reply() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } check_ajax_referer('messages_send_message'); $result = messages_new_message(array('thread_id' => (int) $_REQUEST['thread_id'], 'content' => $_REQUEST['content'])); if (!empty($result)) { // Get the zebra line classes correct on ajax requests global $thread_template; bp_thread_has_messages(array('thread_id' => (int) $_REQUEST['thread_id'])); if ($thread_template->message_count % 2 == 1) { $class = 'odd'; } else { $class = 'even alt'; } ?> <div class="message-box new-message <?php echo $class; ?> "> <div class="message-metadata"> <?php do_action('bp_before_message_meta'); ?> <?php echo bp_loggedin_user_avatar('type=thumb&width=30&height=30'); ?> <strong><a href="<?php echo bp_loggedin_user_domain(); ?> "><?php bp_loggedin_user_fullname(); ?> </a> <span class="activity"><?php printf(__('Sent %s', 'buddypress'), bp_core_time_since(bp_core_current_time())); ?> </span></strong> <?php do_action('bp_after_message_meta'); ?> </div> <?php do_action('bp_before_message_content'); ?> <div class="message-content"> <?php echo stripslashes(apply_filters('bp_get_the_thread_message_content', $_REQUEST['content'])); ?> </div> <?php do_action('bp_after_message_content'); ?> <div class="clear"></div> </div> <?php } else { echo "-1<div id='message' class='error'><p>" . __('There was a problem sending that reply. Please try again.', 'buddypress') . '</p></div>'; } exit; }
function widget($args, $instance) { extract($args); echo $before_widget; if (is_user_logged_in()) { do_action('bp_before_sidebar_me'); ?> <div id="sidebar-me"> <div id="bpavatar"> <?php bp_loggedin_user_avatar('type=full'); ?> </div> <ul> <li id="username"><a href="<?php bp_loggedin_user_link(); ?> "><?php bp_loggedin_user_fullname(); ?> </a></li> <li><a href="<?php echo bp_loggedin_user_domain() . BP_XPROFILE_SLUG; ?> /" title="<?php _e('View profile', 'vibe'); ?> "><?php _e('View profile', 'vibe'); ?> </a> </li> <li id="vbplogout"><a href="<?php echo wp_logout_url(get_permalink()); ?> " id="destroy-sessions" rel="nofollow" class="logout" title="<?php _e('Log Out', 'vibe'); ?> "><i class="icon-close-off-2"></i> <?php _e('LOGOUT', 'vibe'); ?> </a></li> <li id="admin_panel_icon"><?php if (current_user_can("edit_posts")) { echo '<a href="' . vibe_site_url() . 'wp-admin/" title="' . __('Access admin panel', 'vibe') . '"><i class="icon-settings-1"></i></a>'; } ?> </li> </ul> <ul> <?php $loggedin_menu = array('courses' => array('icon' => 'icon-book-open-1', 'label' => __('Courses', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG), 'stats' => array('icon' => 'icon-analytics-chart-graph', 'label' => __('Stats', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG . '/' . BP_COURSE_STATS_SLUG)); if (bp_is_active('messages')) { $loggedin_menu['messages'] = array('icon' => 'icon-letter-mail-1', 'label' => __('Inbox', 'vibe') . (messages_get_unread_count() ? ' <span>' . messages_get_unread_count() . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_MESSAGES_SLUG); $n = vbp_current_user_notification_count(); $loggedin_menu['notifications'] = array('icon' => 'icon-exclamation', 'label' => __('Notifications', 'vibe') . ($n ? ' <span>' . $n . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_NOTIFICATIONS_SLUG); } if (bp_is_active('groups')) { $loggedin_menu['groups'] = array('icon' => 'icon-myspace-alt', 'label' => __('Groups', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_GROUPS_SLUG); } $loggedin_menu['settings'] = array('icon' => 'icon-settings', 'label' => __('Settings', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_SETTINGS_SLUG); $loggedin_menu = apply_filters('wplms_logged_in_top_menu', $loggedin_menu); foreach ($loggedin_menu as $item) { echo '<li><a href="' . $item['link'] . '"><i class="' . $item['icon'] . '"></i>' . $item['label'] . '</a></li>'; } ?> </ul> <?php do_action('bp_sidebar_me'); ?> </div> <?php do_action('bp_after_sidebar_me'); /***** If the user is not logged in, show the log form and account creation link *****/ } else { if (!isset($user_login)) { $user_login = ''; } do_action('bp_before_sidebar_login_form'); ?> <form name="login-form" id="vbp-login-form" class="standard-form" action="<?php echo apply_filters('wplms_login_widget_action', vibe_site_url('wp-login.php', 'login-post')); ?> " method="post"> <label><?php _e('Username', 'vibe'); ?> <br/> <input type="text" name="log" id="side-user-login" class="input" tabindex="1" value="<?php echo esc_attr(stripslashes($user_login)); ?> "/></label> <label><?php _e('Password', 'vibe'); ?> <a href="<?php echo wp_lostpassword_url(get_permalink()); ?> " tabindex="5" class="tip" title="<?php _e('Forgot Password', 'vibe'); ?> "><i class="icon-question"></i></a><br/> <input type="password" tabindex="2" name="pwd" id="sidebar-user-pass" class="input" value=""/></label> <p class=""><label><input name="rememberme" tabindex="3" type="checkbox" id="sidebar-rememberme" value="forever"/><?php _e('Remember Me', 'vibe'); ?> </label></p> <?php do_action('bp_sidebar_login_form'); ?> <input type="submit" name="user-submit" id="sidebar-wp-submit" value="<?php _e('Log In', 'vibe'); ?> " tabindex="100"/> <input type="hidden" name="user-cookie" value="1"/> <?php if (bp_get_signup_allowed()) { printf(__('<a href="%s" class="vbpregister" title="' . __('Create an account', 'vibe') . '" tabindex="5" >' . __('Sign Up', 'vibe') . '</a> ', 'vibe'), site_url(BP_REGISTER_SLUG . '/')); } ?> <?php do_action('login_form'); //BruteProtect FIX ?> </form> <?php do_action('bp_after_sidebar_login_form'); } echo $after_widget; }
function widget($args, $instance) { extract($args); echo $before_widget; if (is_user_logged_in()) { do_action('bp_before_sidebar_me'); ?> <div id="sidebar-me"> <div id="bpavatar"> <a href="<?php echo bp_loggedin_user_domain() . BP_XPROFILE_SLUG; ?> /" title="<?php _e('Thông tin cá nhân', 'vibe'); ?> "><?php bp_loggedin_user_avatar('type=full'); ?> </a> </div> <ul style="width: 145px"> <li id="username"><a href="<?php bp_loggedin_user_link(); ?> "><?php bp_loggedin_user_fullname(); ?> </a></li> <li><a href="<?php echo bp_loggedin_user_domain() . BP_XPROFILE_SLUG; ?> /" title="<?php _e('Thông tin cá nhân', 'vibe'); ?> "><?php _e('Thông tin cá nhân', 'vibe'); ?> </a></li> <li id="vbplogout"><a href="<?php echo wp_logout_url(get_permalink()); ?> " id="destroy-sessions" rel="nofollow" class="logout" title="<?php _e('Đăng xuất', 'vibe'); ?> "><?php _e('Đăng xuất', 'vibe'); ?> </a></li> <li id="admin_panel_icon"><?php if (current_user_can("edit_posts")) { echo '<a href="' . vibe_site_url() . 'wp-admin/" title="' . __('Access admin panel', 'vibe') . '"><i class="icon-settings-1"></i></a>'; } ?> </li> </ul> <ul> <?php function child_wplms_get_mycred_link() { $mycred = get_option('mycred_pref_core'); if (isset($mycred['buddypress']) && isset($mycred['buddypress']['history_url']) && isset($mycred['buddypress']['history_location']) && $mycred['buddypress']['history_location']) { $link = bp_get_loggedin_user_link() . $mycred['buddypress']['history_url']; } else { $link = '#'; } return $link; } $loggedin_menu = array('taikhoan' => array('icon' => 'icon-book-open-1', 'label' => __('Tài khoản: ' . apply_filters('get_point_user', ''), 'vibe'), 'link' => child_wplms_get_mycred_link()), 'naptientaokhoan' => array('icon' => 'icon-book-open-1', 'label' => __('Nạp tiền tài khoản', 'vibe'), 'link' => get_home_url() . '/thanh-toan-khoa-hoc/'), 'courses' => array('icon' => 'icon-book-open-1', 'label' => __('Khóa học của tôi', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG)); if (bp_is_active('messages')) { $loggedin_menu['messages'] = array('icon' => 'icon-letter-mail-1', 'label' => __('Hộp thư đến', 'vibe') . (messages_get_unread_count() ? ' <span>' . messages_get_unread_count() . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_MESSAGES_SLUG); $n = vbp_current_user_notification_count(); // $loggedin_menu['notifications']=array( // 'icon' => 'icon-exclamation', // 'label' => __('Thông báo','vibe').(($n)?' <span>'.$n.'</span>':''), // 'link' => bp_loggedin_user_domain().BP_NOTIFICATIONS_SLUG // ); } if (bp_is_active('groups')) { $loggedin_menu['groups'] = array('icon' => 'icon-myspace-alt', 'label' => __('Nhóm', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_GROUPS_SLUG); } $loggedin_menu = apply_filters('wplms_logged_in_top_menu', $loggedin_menu); foreach ($loggedin_menu as $item) { echo '<li><a href="' . $item['link'] . '"><i class="' . $item['icon'] . '"></i>' . $item['label'] . '</a></li>'; } ?> </ul> <?php do_action('bp_sidebar_me'); ?> </div> <?php do_action('bp_after_sidebar_me'); /***** If the user is not logged in, show the log form and account creation link *****/ } else { if (!isset($user_login)) { $user_login = ''; } do_action('bp_before_sidebar_login_form'); ?> <h2 class="box-heading">Đăng nhập ITClass !</h2> <form name="login-form" id="vbp-login-form" class="standard-form" action="<?php echo apply_filters('wplms_login_widget_action', vibe_site_url('wp-login.php', 'login-post')); ?> " method="post"> <div class="col-md-6" style="padding: 0px 20px 10px"> <label><?php _e('Đăng nhập với tài khoản ItClass', 'dangnhapitclass'); ?> </label> <label><?php _e('Tên đăng nhập', 'vibe'); ?> <br /> <input type="text" name="log" id="side-user-login" class="input" tabindex="1" value="<?php echo esc_attr(stripslashes($user_login)); ?> " /></label> <label><?php _e('Mật khẩu', 'vibe'); ?> <a href="<?php echo wp_lostpassword_url(get_permalink()); ?> " tabindex="5" class="tip" title="<?php _e('Forgot Password', 'vibe'); ?> "><i class="icon-question"></i></a><br /> <input type="password" tabindex="2" name="pwd" id="sidebar-user-pass" class="input" value="" /></label> <p class="quenmatkhau"><label><input name="rememberme" tabindex="3" type="checkbox" id="sidebar-rememberme" value="forever" /><?php _e('Ghi nhớ', 'vibe'); ?> <a href="<?php echo wp_lostpassword_url(); ?> "> Quên mật khẩu </a></label> </p> <?php do_action('bp_sidebar_login_form'); ?> <!-- <input type="submit" name="wp-submit" id="sidebar-wp-submit" tabindex="4" value="--><?php //_e( 'Đăng nhập','vibe' ); ?> <!--" tabindex="100" /><p></p>--> <span class="error-login">Tài khoản hoặc mật khẩu không đúng !</span> <span class="btn btn-danger" id="id-dangnhap-it"><i style="display: none" class="noidungthongbaoloading icon-refresh glyphicon-refresh-animate"></i><?php _e('Đăng nhập', 'vibe'); ?> </span><br/> <input type="hidden" name="testcookie" value="1" /> <?php if (bp_get_signup_allowed()) { _e('Bạn chưa có tài khoản ? ', 'vibe'); printf(__('<a href="%s" class="vbpregister" title="' . __('Create an account', 'vibe') . '" tabindex="5" >' . __('Đăng ký', 'vibe') . '</a> ', 'vibe'), site_url(BP_REGISTER_SLUG . '/')); } ?> </div> <div class="box-separator"></div> <div class="box-right"> <?php //do_action( 'login_form' ); //BruteProtect FIX ?> <p class="comment-form-social-connect"> <label>Đăng nhập với mạng xã hội</label> </p> <a href="http://it.myclass.vn/wp-login.php?loginFacebook=1&redirect=http://it.myclass.vn" onclick="window.location = 'http://it.myclass.vn/wp-login.php?loginFacebook=1&redirect='+window.location.href; return false;"><div class="social-btn"><i class="icon-facebook social-icon"></i><span class="btn-text">Đăng nhập bằng Facebook</span></div></a> </div> </form> <?php do_action('bp_after_sidebar_login_form'); } echo $after_widget; }
/** * Adds a new comment to the database. * A copy of wp_new_comment() * @see wp_new_comment() */ function mpp_add_comment($commentdata) { //basic fields //set to default if (!isset($commentdata['comment_author'])) { $commentdata['comment_author'] = bp_loggedin_user_fullname(); } if (!isset($commentdata['comment_author_email'])) { $commentdata['comment_author_email'] = bp_core_get_user_email(get_current_user_id()); } if (!isset($commentdata['comment_author_url'])) { $commentdata['comment_author_url'] = bp_loggedin_user_domain(); } /** * Filter a comment's data before it is sanitized and inserted into the database. * * @since 1.5.0 * * @param array $commentdata Comment data. */ $commentdata = apply_filters('preprocess_comment', $commentdata); $commentdata['comment_post_ID'] = (int) $commentdata['post_id']; //media Id or Gallery ID if (isset($commentdata['user_ID'])) { $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID']; } elseif (isset($commentdata['user_id'])) { $commentdata['user_id'] = (int) $commentdata['user_id']; } $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0; //$parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : ''; $commentdata['comment_parent'] = $commentdata['comment_parent'] > 0 ? $commentdata['comment_parent'] : 0; $commentdata['comment_author_IP'] = preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']); $commentdata['comment_agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? substr($_SERVER['HTTP_USER_AGENT'], 0, 254) : ''; $commentdata['comment_date'] = current_time('mysql'); $commentdata['comment_date_gmt'] = current_time('mysql', 1); $commentdata = wp_filter_comment($commentdata); $commentdata['comment_approved'] = 1; //make approved by default wp_allow_comment($commentdata); $comment_ID = wp_insert_comment($commentdata); do_action('mpp_comment_added', $comment_ID, $commentdata['comment_approved']); return $comment_ID; }